Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add codespell config, workflow (just to detect typos) and have some typos fixed #70

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
2 changes: 1 addition & 1 deletion sleap_io/io/labelstudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions sleap_io/io/nwb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions sleap_io/model/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

"""
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/io/test_nwb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tests/model/test_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down