Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ default_language_version:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.4
rev: v0.15.12
hooks:
- id: ruff-check
args: ["--fix", "--show-fixes"]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
rev: v2.4.2
hooks:
- id: codespell
args: ["-L", "fo,ihs,kake,te", "-S", "fixture"]
Expand All @@ -28,7 +28,7 @@ repos:
exclude: mkdocs.yml
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
rev: v1.20.2
hooks:
- id: mypy
files: ^(src|tests)/
Expand All @@ -47,7 +47,7 @@ repos:
- hypothesis
- s3fs
- repo: https://github.com/scientific-python/cookie
rev: 2026.03.02
rev: 2026.04.04
hooks:
- id: sp-repo-review
- repo: https://github.com/numpy/numpydoc
Expand All @@ -64,7 +64,7 @@ repos:
types: [python]
files: ^(src|tests)/
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.23.1
rev: v1.24.1
hooks:
- id: zizmor
- repo: https://github.com/twisted/towncrier
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/core/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -4816,7 +4816,7 @@ def _parse_keep_array_attr(
if serializer == "keep":
serializer = "auto"
# After resolving "keep" above, chunks is never "keep" at this point.
chunks_out: ChunksLike | Literal["auto"] = chunks # type: ignore[assignment]
chunks_out: ChunksLike | Literal["auto"] = chunks
return (
chunks_out,
shards,
Expand Down
5 changes: 3 additions & 2 deletions src/zarr/core/dtype/npy/structured.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,16 @@ def _from_json_v2(cls, data: DTypeJSON) -> Self:
# structured dtypes are constructed directly from a list of lists
# note that we do not handle the object codec here! this will prevent structured
# dtypes from containing object dtypes.
name = data["name"]
return cls(
fields=tuple( # type: ignore[misc]
fields=tuple( # type: ignore[str-unpack]
( # type: ignore[misc]
f_name,
get_data_type_from_json(
{"name": f_dtype, "object_codec_id": None}, zarr_format=2
),
)
for f_name, f_dtype in data["name"]
for f_name, f_dtype in name
)
)
msg = f"Invalid JSON representation of {cls.__name__}. Got {data!r}, expected a JSON array of arrays"
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/storage/_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def __repr__(self) -> str:

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

async def get(
self,
Expand Down
2 changes: 1 addition & 1 deletion src/zarr/storage/_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _check_writable(self) -> None:
return self._store._check_writable()

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

def __str__(self) -> str:
return f"wrapping-{self._store}"
Expand Down
8 changes: 4 additions & 4 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ async def test_array_like_creation(
kwargs["fill_value"] = out_fill
expect_fill = out_fill
elif func is zarr.api.asynchronous.open_like: # type: ignore[comparison-overlap]
if out_fill == "keep":
if out_fill == "keep": # type: ignore[unreachable]
expect_fill = ref_fill
else:
kwargs["fill_value"] = out_fill
Expand All @@ -161,7 +161,7 @@ async def test_array_like_creation(
else:
expect_dtype = ref_arr.dtype # type: ignore[assignment]

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


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


async def test_open_group(memory_store: MemoryStore) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,7 @@ async def test_from_array(
assert result.fill_value == new_fill_value
assert result.dtype == src_dtype
assert result.attrs == new_attributes
assert result.chunks == new_chunks
assert result.chunks == new_chunks # type: ignore[unreachable]


@pytest.mark.parametrize("store", ["local"], indirect=True)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_codecs/test_numcodecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_is_numcodec_cls() -> None:

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


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

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

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

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

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

expected = codec

Expand Down
Loading