Skip to content

Commit 80d45ca

Browse files
chore: update pre-commit hooks (zarr-developers#3943)
* chore: update pre-commit hooks updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.4 → v0.15.12](astral-sh/ruff-pre-commit@v0.15.4...v0.15.12) - [github.com/codespell-project/codespell: v2.4.1 → v2.4.2](codespell-project/codespell@v2.4.1...v2.4.2) - [github.com/pre-commit/mirrors-mypy: v1.19.1 → v1.20.2](pre-commit/mirrors-mypy@v1.19.1...v1.20.2) - [github.com/scientific-python/cookie: 2026.03.02 → 2026.04.04](scientific-python/cookie@2026.03.02...2026.04.04) - [github.com/zizmorcore/zizmor-pre-commit: v1.23.1 → v1.24.1](zizmorcore/zizmor-pre-commit@v1.23.1...v1.24.1) * chore: fix pre-commit failures --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Davis Bennett <davis.v.bennett@gmail.com>
1 parent 3d354a8 commit 80d45ca

8 files changed

Lines changed: 21 additions & 20 deletions

File tree

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ default_language_version:
1111

1212
repos:
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.15.4
14+
rev: v0.15.12
1515
hooks:
1616
- id: ruff-check
1717
args: ["--fix", "--show-fixes"]
1818
- id: ruff-format
1919
- repo: https://github.com/codespell-project/codespell
20-
rev: v2.4.1
20+
rev: v2.4.2
2121
hooks:
2222
- id: codespell
2323
args: ["-L", "fo,ihs,kake,te", "-S", "fixture"]
@@ -28,7 +28,7 @@ repos:
2828
exclude: mkdocs.yml
2929
- id: trailing-whitespace
3030
- repo: https://github.com/pre-commit/mirrors-mypy
31-
rev: v1.19.1
31+
rev: v1.20.2
3232
hooks:
3333
- id: mypy
3434
files: ^(src|tests)/
@@ -47,7 +47,7 @@ repos:
4747
- hypothesis
4848
- s3fs
4949
- repo: https://github.com/scientific-python/cookie
50-
rev: 2026.03.02
50+
rev: 2026.04.04
5151
hooks:
5252
- id: sp-repo-review
5353
- repo: https://github.com/numpy/numpydoc
@@ -64,7 +64,7 @@ repos:
6464
types: [python]
6565
files: ^(src|tests)/
6666
- repo: https://github.com/zizmorcore/zizmor-pre-commit
67-
rev: v1.23.1
67+
rev: v1.24.1
6868
hooks:
6969
- id: zizmor
7070
- repo: https://github.com/twisted/towncrier

src/zarr/core/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4816,7 +4816,7 @@ def _parse_keep_array_attr(
48164816
if serializer == "keep":
48174817
serializer = "auto"
48184818
# After resolving "keep" above, chunks is never "keep" at this point.
4819-
chunks_out: ChunksLike | Literal["auto"] = chunks # type: ignore[assignment]
4819+
chunks_out: ChunksLike | Literal["auto"] = chunks
48204820
return (
48214821
chunks_out,
48224822
shards,

src/zarr/core/dtype/npy/structured.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,16 @@ def _from_json_v2(cls, data: DTypeJSON) -> Self:
278278
# structured dtypes are constructed directly from a list of lists
279279
# note that we do not handle the object codec here! this will prevent structured
280280
# dtypes from containing object dtypes.
281+
name = data["name"]
281282
return cls(
282-
fields=tuple( # type: ignore[misc]
283+
fields=tuple( # type: ignore[str-unpack]
283284
( # type: ignore[misc]
284285
f_name,
285286
get_data_type_from_json(
286287
{"name": f_dtype, "object_codec_id": None}, zarr_format=2
287288
),
288289
)
289-
for f_name, f_dtype in data["name"]
290+
for f_name, f_dtype in name
290291
)
291292
)
292293
msg = f"Invalid JSON representation of {cls.__name__}. Got {data!r}, expected a JSON array of arrays"

src/zarr/storage/_logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def __repr__(self) -> str:
161161

162162
def __eq__(self, other: object) -> bool:
163163
with self.log(other):
164-
return type(self) is type(other) and self._store.__eq__(other._store) # type: ignore[attr-defined]
164+
return type(self) is type(other) and self._store.__eq__(other._store)
165165

166166
async def get(
167167
self,

src/zarr/storage/_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _check_writable(self) -> None:
8383
return self._store._check_writable()
8484

8585
def __eq__(self, value: object) -> bool:
86-
return type(self) is type(value) and self._store.__eq__(value._store) # type: ignore[attr-defined]
86+
return type(self) is type(value) and self._store.__eq__(value._store)
8787

8888
def __str__(self) -> str:
8989
return f"wrapping-{self._store}"

tests/test_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ async def test_array_like_creation(
137137
kwargs["fill_value"] = out_fill
138138
expect_fill = out_fill
139139
elif func is zarr.api.asynchronous.open_like: # type: ignore[comparison-overlap]
140-
if out_fill == "keep":
140+
if out_fill == "keep": # type: ignore[unreachable]
141141
expect_fill = ref_fill
142142
else:
143143
kwargs["fill_value"] = out_fill
@@ -161,7 +161,7 @@ async def test_array_like_creation(
161161
else:
162162
expect_dtype = ref_arr.dtype # type: ignore[assignment]
163163

164-
new_arr = await func(ref_arr, path="foo", zarr_format=zarr_format, **kwargs) # type: ignore[call-arg]
164+
new_arr = await func(ref_arr, path="foo", zarr_format=zarr_format, **kwargs)
165165
assert new_arr.shape == expect_shape
166166
assert new_arr.chunks == expect_chunks
167167
assert new_arr.dtype == expect_dtype
@@ -187,7 +187,7 @@ def test_create_array(store: Store, zarr_format: ZarrFormat) -> None:
187187
array_w[:] = data_val
188188
assert array_w.shape == shape
189189
assert array_w.attrs == attrs
190-
assert np.array_equal(array_w[:], np.zeros(shape, dtype=array_w.dtype) + data_val)
190+
assert np.array_equal(array_w[:], np.zeros(shape, dtype=array_w.dtype) + data_val) # type: ignore[unreachable]
191191

192192

193193
@pytest.mark.parametrize("write_empty_chunks", [True, False])
@@ -326,7 +326,7 @@ async def test_create_group(store: Store, zarr_format: ZarrFormat) -> None:
326326
node = create_group(store, path=path, attributes=attrs, zarr_format=zarr_format)
327327
assert isinstance(node, Group)
328328
assert node.attrs == attrs
329-
assert node.metadata.zarr_format == zarr_format
329+
assert node.metadata.zarr_format == zarr_format # type: ignore[unreachable]
330330

331331

332332
async def test_open_group(memory_store: MemoryStore) -> None:

tests/test_array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,7 @@ async def test_from_array(
17701770
assert result.fill_value == new_fill_value
17711771
assert result.dtype == src_dtype
17721772
assert result.attrs == new_attributes
1773-
assert result.chunks == new_chunks
1773+
assert result.chunks == new_chunks # type: ignore[unreachable]
17741774

17751775

17761776
@pytest.mark.parametrize("store", ["local"], indirect=True)

tests/test_codecs/test_numcodecs.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_is_numcodec_cls() -> None:
8585

8686
@pytest.mark.parametrize("codec_cls", ALL_CODECS)
8787
def test_get_codec_class(codec_cls: type[_numcodecs._NumcodecsCodec]) -> None:
88-
assert get_codec_class(codec_cls.codec_name) == codec_cls # type: ignore[comparison-overlap]
88+
assert get_codec_class(codec_cls.codec_name) == codec_cls # type: ignore[comparison-overlap,misc]
8989

9090

9191
@pytest.mark.parametrize("codec_class", ALL_CODECS)
@@ -240,7 +240,7 @@ def test_generic_checksum(codec_class: type[_numcodecs._NumcodecsBytesBytesCodec
240240
try:
241241
codec_class()._codec # noqa: B018
242242
except UnknownCodecError as e: # pragma: no cover
243-
pytest.skip(f"{codec_class.codec_name} is not available in numcodecs: {e}")
243+
pytest.skip(f"{codec_class.codec_name} is not available in numcodecs: {e}") # type: ignore[misc]
244244

245245
data = np.linspace(0, 10, 256, dtype="float32").reshape((16, 16))
246246

@@ -265,11 +265,11 @@ def test_generic_bytes_codec(codec_class: type[_numcodecs._NumcodecsArrayBytesCo
265265
codec_class()._codec # noqa: B018
266266
except ValueError as e: # pragma: no cover
267267
if "codec not available" in str(e):
268-
pytest.xfail(f"{codec_class.codec_name} is not available: {e}")
268+
pytest.xfail(f"{codec_class.codec_name} is not available: {e}") # type: ignore[misc]
269269
else:
270270
raise
271271
except ImportError as e: # pragma: no cover
272-
pytest.xfail(f"{codec_class.codec_name} is not available: {e}")
272+
pytest.xfail(f"{codec_class.codec_name} is not available: {e}") # type: ignore[misc]
273273

274274
data = np.arange(0, 256, dtype="float32").reshape((16, 16))
275275

@@ -347,7 +347,7 @@ def test_codecs_pickleable(codec_cls: type[_numcodecs._NumcodecsCodec]) -> None:
347347
try:
348348
codec = codec_cls()
349349
except UnknownCodecError as e: # pragma: no cover
350-
pytest.skip(f"{codec_cls.codec_name} is not available in numcodecs: {e}")
350+
pytest.skip(f"{codec_cls.codec_name} is not available in numcodecs: {e}") # type: ignore[misc]
351351

352352
expected = codec
353353

0 commit comments

Comments
 (0)