diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 26408286..bb551a39 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-added-large-files args: @@ -44,22 +44,22 @@ repos: args: - --strict - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.12 + rev: v0.13.3 hooks: - id: ruff - id: ruff-format - repo: https://github.com/adamchainz/blacken-docs - rev: 1.19.1 + rev: 1.20.0 hooks: - id: blacken-docs additional_dependencies: - black - repo: https://github.com/pappasam/toml-sort - rev: v0.24.2 + rev: v0.24.3 hooks: - id: toml-sort-fix - repo: https://github.com/rbubley/mirrors-prettier - rev: v3.5.3 + rev: v3.6.2 hooks: - id: prettier - repo: https://github.com/igorshubovych/markdownlint-cli @@ -77,7 +77,7 @@ repos: hooks: - id: actionlint - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.16.0 + rev: v1.18.2 hooks: - id: mypy files: ^glass/ diff --git a/examples/1-basic/density.ipynb b/examples/1-basic/density.ipynb index 689c057e..9d5b70d1 100644 --- a/examples/1-basic/density.ipynb +++ b/examples/1-basic/density.ipynb @@ -161,7 +161,7 @@ " axis=1,\n", " return_counts=True,\n", " )\n", - " cube[*indices] += count" + " cube[tuple(indices)] += count" ] }, { diff --git a/glass/_array_api_utils.py b/glass/_array_api_utils.py index 66d8a1da..ddacdb4b 100644 --- a/glass/_array_api_utils.py +++ b/glass/_array_api_utils.py @@ -58,7 +58,8 @@ class Generator: __slots__ = ("rng",) def __init__( - self, seed: int | bool | NDArray[np.int_ | np.bool] | None = None + self, + seed: int | bool | NDArray[np.int_ | np.bool] | None = None, # noqa: FBT001 ) -> None: self.rng = numpy.random.default_rng(seed=seed) # type: ignore[arg-type] diff --git a/glass/fields.py b/glass/fields.py index 2fbc722c..70e087a5 100644 --- a/glass/fields.py +++ b/glass/fields.py @@ -42,8 +42,8 @@ def deprecated(msg: str, /) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: # type: ignore[no-redef] """Backport of Python's warnings.deprecated().""" - from functools import wraps - from warnings import warn + from functools import wraps # noqa: PLC0415 + from warnings import warn # noqa: PLC0415 def decorator(func: Callable[_P, _R], /) -> Callable[_P, _R]: @wraps(func) @@ -1102,9 +1102,9 @@ def regularized_spectra( # regularise the cov matrix using the chosen method cov_method: Callable[..., NDArray[Any]] if method == "clip": - from glass.algorithm import cov_clip as cov_method + from glass.algorithm import cov_clip as cov_method # noqa: PLC0415 elif method == "nearest": - from glass.algorithm import cov_nearest as cov_method + from glass.algorithm import cov_nearest as cov_method # noqa: PLC0415 else: msg = f"unknown method '{method}'" # type: ignore[unreachable] raise ValueError(msg) diff --git a/glass/grf/_core.py b/glass/grf/_core.py index e9e8243c..0b97367d 100644 --- a/glass/grf/_core.py +++ b/glass/grf/_core.py @@ -59,8 +59,8 @@ def dispatch( def add( impl: Callable[[TransformationT, TransformationT, NDArray[Any]], NDArray[Any]], ) -> Callable[[TransformationT, TransformationT, NDArray[Any]], NDArray[Any]]: - from inspect import signature - from typing import get_type_hints + from inspect import signature # noqa: PLC0415 + from typing import get_type_hints # noqa: PLC0415 sig = signature(impl) if len(sig.parameters) != 3: diff --git a/glass/shells.py b/glass/shells.py index 89025e22..3f85a998 100644 --- a/glass/shells.py +++ b/glass/shells.py @@ -757,7 +757,7 @@ def partition_restrict( The partition. """ - part = np.empty((len(shells),) + np.shape(fz)[:-1]) + part = np.empty((len(shells), *np.shape(fz)[:-1])) for i, w in enumerate(shells): zr, fr = restrict(z, fz, w) part[i] = np.trapezoid(fr, zr, axis=-1) diff --git a/glass/user.py b/glass/user.py index d6a14751..9fb3fdb2 100644 --- a/glass/user.py +++ b/glass/user.py @@ -193,7 +193,7 @@ def write_catalog( The writer object. """ - import fitsio + import fitsio # noqa: PLC0415 with fitsio.FITS(filename, "rw", clobber=True) as fits: fits.write(None)