From 2271534d50000a610b8aac3a53a9c5a7c21a16e1 Mon Sep 17 00:00:00 2001 From: Simon Biquard Date: Tue, 10 Dec 2024 17:08:32 +0100 Subject: [PATCH] Fix CI, update pre-commit hooks --- .pre-commit-config.yaml | 6 +++--- src/furax/_base/indices.py | 6 ++++-- src/furax/landscapes.py | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a8cbc8..f7828d3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,13 +7,13 @@ repos: - --all - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.1 + rev: v0.8.2 hooks: - id: ruff-format - id: ruff - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 'v4.6.0' + rev: 'v5.0.0' hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -21,7 +21,7 @@ repos: - id: check-merge-conflict - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.11.1' + rev: 'v1.13.0' hooks: - id: mypy additional_dependencies: diff --git a/src/furax/_base/indices.py b/src/furax/_base/indices.py index 88eef59..7e47c75 100644 --- a/src/furax/_base/indices.py +++ b/src/furax/_base/indices.py @@ -59,7 +59,7 @@ def __init__( self._check_indices(indices) self.indices = indices if all( - isinstance(_, (int, slice, EllipsisType)) or isinstance(_, Array) and _.dtype == bool + isinstance(_, int | slice | EllipsisType) or isinstance(_, Array) and _.dtype == bool for _ in indices ): unique_indices = True @@ -90,7 +90,9 @@ def reduce(self) -> AbstractLinearOperator: @staticmethod def _check_indices( - indices: tuple[int | slice | Bool[Array, '...'] | Integer[Array, '...'] | EllipsisType, ...] + indices: tuple[ + int | slice | Bool[Array, '...'] | Integer[Array, '...'] | EllipsisType, ... + ], ) -> None: ellipsis_count = sum(index is Ellipsis for index in indices) if ellipsis_count > 1: diff --git a/src/furax/landscapes.py b/src/furax/landscapes.py index d9c81e8..efa8da9 100644 --- a/src/furax/landscapes.py +++ b/src/furax/landscapes.py @@ -37,7 +37,7 @@ ScalarType = Union[jnp.bool_, NumberType] DTypeLike = Union[ str, # like 'float32', 'int32' - type[Union[bool, int, float, complex, ScalarType, np.bool_, np.number]], # type: ignore[type-arg] # noqa: E501 + type[Union[bool, int, float, complex, ScalarType, np.bool_, np.number]], # noqa: E501 np.dtype, # type: ignore[type-arg] ]