From 25a37178da8c9a8bbc47937e1789ae27e82acec3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Feb 2025 17:09:35 +0000 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#401) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.6...v0.9.4) - [github.com/codespell-project/codespell: v2.3.0 → v2.4.1](https://github.com/codespell-project/codespell/compare/v2.3.0...v2.4.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 4 ++-- movement/kinematics.py | 3 +-- movement/validators/files.py | 2 +- tests/test_unit/test_kinematics.py | 6 +++--- tests/test_unit/test_sample_data.py | 18 +++++++++--------- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9258a3fb..318f29a6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.6 + rev: v0.9.4 hooks: - id: ruff - id: ruff-format @@ -53,7 +53,7 @@ repos: additional_dependencies: [setuptools-scm, wheel] - repo: https://github.com/codespell-project/codespell # Configuration for codespell is in pyproject.toml - rev: v2.3.0 + rev: v2.4.1 hooks: - id: codespell additional_dependencies: diff --git a/movement/kinematics.py b/movement/kinematics.py index 4abe9e99..2880a488 100644 --- a/movement/kinematics.py +++ b/movement/kinematics.py @@ -742,8 +742,7 @@ def compute_pairwise_distances( paired_elements = [ (elem1, elem2) for elem1, elem2_list in pairs.items() - for elem2 in - ( + for elem2 in ( # Ensure elem2_list is a list [elem2_list] if isinstance(elem2_list, str) else elem2_list ) diff --git a/movement/validators/files.py b/movement/validators/files.py index bfca9116..3d179efe 100644 --- a/movement/validators/files.py +++ b/movement/validators/files.py @@ -156,7 +156,7 @@ def _file_is_h5(self, attribute, value): except Exception as e: raise log_error( ValueError, - f"File {value} does not seem to be in valid" "HDF5 format.", + f"File {value} does not seem to be in validHDF5 format.", ) from e @path.validator diff --git a/tests/test_unit/test_kinematics.py b/tests/test_unit/test_kinematics.py index b8a2c9c3..57fd2479 100644 --- a/tests/test_unit/test_kinematics.py +++ b/tests/test_unit/test_kinematics.py @@ -479,9 +479,9 @@ def test_nan_behavior_forward_vector( # Should have NaN values in the forward vector at time 1 and left_ear nan_values = forward_vector.sel(time=nan_time) assert nan_values.shape == (1, 2) - assert np.isnan( - nan_values - ).all(), "NaN values not returned where expected!" + assert np.isnan(nan_values).all(), ( + "NaN values not returned where expected!" + ) # Should have no NaN values in the forward vector in other positions assert not np.isnan( forward_vector.sel( diff --git a/tests/test_unit/test_sample_data.py b/tests/test_unit/test_sample_data.py index ad408126..7f548490 100644 --- a/tests/test_unit/test_sample_data.py +++ b/tests/test_unit/test_sample_data.py @@ -55,15 +55,15 @@ def validate_metadata(metadata: dict[str, dict]) -> None: "note", ] check_yaml_msg = "Check the format of the metadata .yaml file." - assert isinstance( - metadata, dict - ), f"Expected metadata to be a dictionary. {check_yaml_msg}" - assert all( - isinstance(ds, str) for ds in metadata - ), f"Expected metadata keys to be strings. {check_yaml_msg}" - assert all( - isinstance(val, dict) for val in metadata.values() - ), f"Expected metadata values to be dicts. {check_yaml_msg}" + assert isinstance(metadata, dict), ( + f"Expected metadata to be a dictionary. {check_yaml_msg}" + ) + assert all(isinstance(ds, str) for ds in metadata), ( + f"Expected metadata keys to be strings. {check_yaml_msg}" + ) + assert all(isinstance(val, dict) for val in metadata.values()), ( + f"Expected metadata values to be dicts. {check_yaml_msg}" + ) assert all( set(val.keys()) == set(metadata_fields) for val in metadata.values() ), f"Found issues with the names of metadata fields. {check_yaml_msg}"