From dd6955def816d689acec1e0e4465145e0787c500 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 19:31:17 +0000 Subject: [PATCH 1/2] chore: update pre-commit hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.20 → v0.16.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.20...v0.16.1) - [github.com/codespell-project/codespell: v2.4.2 → v2.4.3](https://github.com/codespell-project/codespell/compare/v2.4.2...v2.4.3) - [github.com/DavidAnson/markdownlint-cli2: v0.22.1 → v0.23.2](https://github.com/DavidAnson/markdownlint-cli2/compare/v0.22.1...v0.23.2) - [github.com/zizmorcore/zizmor-pre-commit: v1.26.1 → v1.29.0](https://github.com/zizmorcore/zizmor-pre-commit/compare/v1.26.1...v1.29.0) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 57a1d0d4f7..4d9bc5fd87 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,13 +15,13 @@ default_language_version: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.20 + rev: v0.16.1 hooks: - id: ruff-check args: ["--fix", "--show-fixes"] - id: ruff-format - repo: https://github.com/codespell-project/codespell - rev: v2.4.2 + rev: v2.4.3 hooks: - id: codespell args: ["-L", "fo,ihs,kake,te", "-S", "fixture"] @@ -32,7 +32,7 @@ repos: exclude: mkdocs.yml - id: trailing-whitespace - repo: https://github.com/DavidAnson/markdownlint-cli2 - rev: v0.22.1 + rev: v0.23.2 hooks: # Markdown structure/hygiene. Rule selection and ignores are in # .markdownlint-cli2.jsonc; complements ci/lint_docs.py (RST residue, @@ -68,7 +68,7 @@ repos: types: [python] files: ^(src|tests)/ - repo: https://github.com/zizmorcore/zizmor-pre-commit - rev: v1.26.1 + rev: v1.29.0 hooks: - id: zizmor - repo: https://github.com/twisted/towncrier From 98ba5eb05f0f6c8065e47733e8ff31a266643f8a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 19:31:52 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/zarr/api/synchronous.py | 2 +- src/zarr/codecs/sharding.py | 2 +- src/zarr/core/array.py | 6 +++--- src/zarr/testing/strategies.py | 4 ++-- tests/test_api.py | 2 +- tests/test_codecs/test_blosc.py | 2 +- tests/test_dtype_registry.py | 2 +- tests/test_store/test_object.py | 1 - tests/test_unified_chunk_grid.py | 4 ++-- 9 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/zarr/api/synchronous.py b/src/zarr/api/synchronous.py index ebf42dca37..30ddf9ce6a 100644 --- a/src/zarr/api/synchronous.py +++ b/src/zarr/api/synchronous.py @@ -998,7 +998,7 @@ def from_array( write_data: bool = True, name: str | None = None, chunks: ChunksLike | Literal["auto", "keep"] = "keep", - shards: ShardsLike | None | Literal["keep"] = "keep", + shards: ShardsLike | Literal["keep"] | None = "keep", filters: FiltersLike | Literal["keep"] = "keep", compressors: CompressorsLike | Literal["keep"] = "keep", serializer: SerializerLike | Literal["keep"] = "keep", diff --git a/src/zarr/codecs/sharding.py b/src/zarr/codecs/sharding.py index d8ca8bdf62..41780e45b4 100644 --- a/src/zarr/codecs/sharding.py +++ b/src/zarr/codecs/sharding.py @@ -841,7 +841,7 @@ def _encode_partial_sync( # `_sentinel` distinguishes "not computed yet" from a memoized `None` # (an empty chunk). _sentinel = object() - scalar_complete_result: Buffer | None | object = _sentinel + scalar_complete_result: Buffer | object | None = _sentinel for chunk_coords, chunk_sel, out_sel, is_complete_chunk in indexer: if is_scalar and is_complete_chunk: diff --git a/src/zarr/core/array.py b/src/zarr/core/array.py index 2b31eefcd4..9cb66f339e 100644 --- a/src/zarr/core/array.py +++ b/src/zarr/core/array.py @@ -2181,7 +2181,7 @@ def filters(self) -> tuple[Numcodec, ...] | tuple[ArrayArrayCodec, ...]: return self.async_array.filters @property - def serializer(self) -> None | ArrayBytesCodec: + def serializer(self) -> ArrayBytesCodec | None: """ Array-to-bytes codec to use for serializing the chunks into bytes. """ @@ -4072,7 +4072,7 @@ async def from_array( write_data: bool = True, name: str | None = None, chunks: ChunksLike | Literal["auto", "keep"] = "keep", - shards: ShardsLike | None | Literal["keep"] = "keep", + shards: ShardsLike | Literal["keep"] | None = "keep", filters: FiltersLike | Literal["keep"] = "keep", compressors: CompressorsLike | Literal["keep"] = "keep", serializer: SerializerLike | Literal["keep"] = "keep", @@ -4763,7 +4763,7 @@ async def create_array( def _parse_keep_array_attr( data: AnyArray | npt.ArrayLike, chunks: ChunksLike | Literal["auto", "keep"], - shards: ShardsLike | None | Literal["keep"], + shards: ShardsLike | Literal["keep"] | None, filters: FiltersLike | Literal["keep"], compressors: CompressorsLike | Literal["keep"], serializer: SerializerLike | Literal["keep"], diff --git a/src/zarr/testing/strategies.py b/src/zarr/testing/strategies.py index 99e81b0389..4e90836b09 100644 --- a/src/zarr/testing/strategies.py +++ b/src/zarr/testing/strategies.py @@ -292,7 +292,7 @@ def arrays( if arrays is None: arrays = numpy_arrays(shapes=shapes) nparray = draw(arrays, label="array data") - dim_names: None | list[str | None] = None + dim_names: list[str | None] | None = None serializer: SerializerLike = "auto" compressors_unsearched: CompressorsLike = "auto" @@ -328,7 +328,7 @@ def arrays( else: chunks_param = draw(chunk_shapes(shape=nparray.shape), label="chunk shape") - if all(s > c and c > 1 for s, c in zip(nparray.shape, chunks_param, strict=True)): + if all(s > c > 1 for s, c in zip(nparray.shape, chunks_param, strict=True)): shard_shape = draw( st.none() | shard_shapes(shape=nparray.shape, chunk_shape=chunks_param), label="shard shape", diff --git a/tests/test_api.py b/tests/test_api.py index cbe8ea3b44..2b831e942d 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -419,7 +419,7 @@ async def test_open_group_unspecified_version(tmp_path: Path, zarr_format: ZarrF @pytest.mark.parametrize("n_args", [10, 1, 0]) @pytest.mark.parametrize("n_kwargs", [10, 1, 0]) @pytest.mark.parametrize("path", [None, "some_path"]) -def test_save(store: Store, n_args: int, n_kwargs: int, path: None | str) -> None: +def test_save(store: Store, n_args: int, n_kwargs: int, path: str | None) -> None: data = np.arange(10) args = [np.arange(10) for _ in range(n_args)] kwargs = {f"arg_{i}": data for i in range(n_kwargs)} diff --git a/tests/test_codecs/test_blosc.py b/tests/test_codecs/test_blosc.py index f5f13f4d05..329304b80b 100644 --- a/tests/test_codecs/test_blosc.py +++ b/tests/test_codecs/test_blosc.py @@ -83,7 +83,7 @@ def test_tunable_attrs_param( # contaminating the BloscCodec construction below with that warning. if shuffle == "legacy-enum": with pytest.warns(DeprecationWarning, match="BloscShuffle.shuffle"): - shuffle_arg: None | BloscShuffleLiteral | str = BloscShuffle.shuffle + shuffle_arg: BloscShuffleLiteral | str | None = BloscShuffle.shuffle else: shuffle_arg = shuffle diff --git a/tests/test_dtype_registry.py b/tests/test_dtype_registry.py index f0946014fc..40239c1132 100644 --- a/tests/test_dtype_registry.py +++ b/tests/test_dtype_registry.py @@ -170,7 +170,7 @@ def test_entrypoint_dtype(zarr_format: ZarrFormat) -> None: ) def test_parse_data_type( data_type: ZDType[Any, Any], - json_style: tuple[ZarrFormat, None | Literal["internal", "metadata"]], + json_style: tuple[ZarrFormat, Literal["internal", "metadata"] | None], dtype_parser_func: Any, ) -> None: """ diff --git a/tests/test_store/test_object.py b/tests/test_store/test_object.py index cd85a48eb8..1ea148b3c3 100644 --- a/tests/test_store/test_object.py +++ b/tests/test_store/test_object.py @@ -1,4 +1,3 @@ -# ruff: noqa: E402 import re from pathlib import Path from typing import TypedDict diff --git a/tests/test_unified_chunk_grid.py b/tests/test_unified_chunk_grid.py index 0df5a5d9fd..f0b54519ab 100644 --- a/tests/test_unified_chunk_grid.py +++ b/tests/test_unified_chunk_grid.py @@ -2784,8 +2784,8 @@ def test_rectilinear_roundtrip(json_input: RectilinearChunkGridMetadataJSON) -> pytest.importorskip("hypothesis") -import hypothesis.strategies as st # noqa: E402 -from hypothesis import event, given, settings # noqa: E402 +import hypothesis.strategies as st +from hypothesis import event, given, settings @st.composite