From 627379f8523ccf34d1ca1b712be30533900ee9e9 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 27 Nov 2023 19:34:52 -0500 Subject: [PATCH 1/3] Add github action to codespell main on push and PRs --- .github/workflows/codespell.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..3ebbf550 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,22 @@ +--- +name: Codespell + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Codespell + uses: codespell-project/actions-codespell@v2 From b4dcc6a7c13e21341befbb70a97f0a96505df6cb Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 27 Nov 2023 19:34:53 -0500 Subject: [PATCH 2/3] Add rudimentary codespell config --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 1c385f2c..b0c0de98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,3 +57,9 @@ line-length = 88 [pydocstyle] convention = "google" match-dir = "sleap_io" + +[tool.codespell] +skip = '.git,*.pdf,*.svg' +check-hidden = true +# ignore-regex = '' +# ignore-words-list = '' From fa496094a5bb066a24fa56c1571f914805da20b1 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 27 Nov 2023 19:34:57 -0500 Subject: [PATCH 3/3] [DATALAD RUNCMD] run codespell throughout fixing typo automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- CONTRIBUTING.md | 2 +- sleap_io/io/labelstudio.py | 2 +- sleap_io/io/nwb.py | 6 +++--- sleap_io/model/instance.py | 6 +++--- tests/io/test_nwb.py | 2 +- tests/model/test_instance.py | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 474bad78..64008d7a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,7 +79,7 @@ For more reference see: ### Testing Testing is done via [`pytest`](https://docs.pytest.org/). -Tests should be created in the [`tests/`](tests) subfolder following the convention `test_{MODULE_NAME}.py` which mimicks the main module organization. +Tests should be created in the [`tests/`](tests) subfolder following the convention `test_{MODULE_NAME}.py` which mimics the main module organization. It is highly recommended checking out other existing tests for reference on how these are structured. diff --git a/sleap_io/io/labelstudio.py b/sleap_io/io/labelstudio.py index c04a731b..ccab6f4c 100644 --- a/sleap_io/io/labelstudio.py +++ b/sleap_io/io/labelstudio.py @@ -2,7 +2,7 @@ Some important nomenclature: - `tasks`: typically maps to a single frame of data to be annotated, closest - correspondance is to `LabeledFrame` + correspondence is to `LabeledFrame` - `annotations`: collection of points, polygons, relations, etc. corresponds to `Instance`s and `Point`s, but a flattened hierarchy diff --git a/sleap_io/io/nwb.py b/sleap_io/io/nwb.py index 6618eb74..ac1b8080 100644 --- a/sleap_io/io/nwb.py +++ b/sleap_io/io/nwb.py @@ -174,7 +174,7 @@ def write_nwb( e.g. pose_estimation_metadata["video_timestamps"] = np.array(timestamps) or pose_estimation_metadata["video_sample_rate] = 15 # In Hz - 2) The other use of this dictionary is to ovewrite sleap-io default + 2) The other use of this dictionary is to overwrite sleap-io default arguments for the PoseEstimation container. see https://github.com/rly/ndx-pose for a full list or arguments. """ @@ -221,7 +221,7 @@ def append_nwb_data( e.g. pose_estimation_metadata["video_timestamps"] = np.array(timestamps) or pose_estimation_metadata["video_sample_rate"] = 15 # In Hz - 2) The other use of this dictionary is to ovewrite sleap-io default + 2) The other use of this dictionary is to overwrite sleap-io default arguments for the PoseEstimation container. see https://github.com/rly/ndx-pose for a full list or arguments. @@ -366,7 +366,7 @@ def build_pose_estimation_container_for_track( timestamps = pose_estimation_metadata_copy.pop("video_timestamps", None) sample_rate = pose_estimation_metadata_copy.pop("video_sample_rate", 1.0) if timestamps is None: - # Keeps backward compatbility. + # Keeps backward compatibility. timestamps = np.arange(track_data_df.shape[0]) * sample_rate else: timestamps = np.asarray(timestamps) diff --git a/sleap_io/model/instance.py b/sleap_io/model/instance.py index 5d48907e..4d351853 100644 --- a/sleap_io/model/instance.py +++ b/sleap_io/model/instance.py @@ -26,9 +26,9 @@ class Point: complete: Has the point been verified by the user labeler. Class variables: - eq_atol: Controls absolute tolerence allowed in `x` and `y` when comparing two + eq_atol: Controls absolute tolerance allowed in `x` and `y` when comparing two `Point`s for equality. - eq_rtol: Controls relative tolerence allowed in `x` and `y` when comparing two + eq_rtol: Controls relative tolerance allowed in `x` and `y` when comparing two `Point`s for equality. """ @@ -166,7 +166,7 @@ def _compare_points( Returns: True if `a` and `b` are considered equal, otherwise False """ - # First check we are speaking the same languague of nodes + # First check we are speaking the same language of nodes if not set(a.keys()) == set(b.keys()): return False diff --git a/tests/io/test_nwb.py b/tests/io/test_nwb.py index 1d2034d8..b6b183fc 100644 --- a/tests/io/test_nwb.py +++ b/tests/io/test_nwb.py @@ -206,7 +206,7 @@ def test_complex_case_append_with_timestamps_metadata(nwbfile, centered_pair): extracted_starting_time = pose_estimation_series.starting_time assert extracted_starting_time == 0 - # Other store timestamps and the timestmaps should be a subset of the videotimestamps + # Other store timestamps and the timestamps should be a subset of the videotimestamps else: extracted_timestamps = pose_estimation_series.timestamps assert np.in1d( diff --git a/tests/model/test_instance.py b/tests/model/test_instance.py index 204636e6..8a36dddb 100644 --- a/tests/model/test_instance.py +++ b/tests/model/test_instance.py @@ -72,7 +72,7 @@ def test_predicted_point(): ppt2 = PredictedPoint(x=1.2, y=3.4, visible=True, complete=False, score=0.9) assert ppt1 == ppt2 - # Test equivelance of Point and PredictedPoint + # Test equivalence of Point and PredictedPoint pt3 = Point(x=1.2, y=3.4, visible=True, complete=False) assert not ppt1 == pt3 # PredictedPoint is not equivalent to Point assert not pt3 == ppt1 # Point is not equivalent to PredictedPoint