Skip to content

Commit 370c394

Browse files
committed
Update pre-commit hooks + mypy fixes
1 parent c972f7f commit 370c394

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ci:
66
default_stages: [pre-commit, pre-push]
77
repos:
88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.11.9
9+
rev: v0.11.13
1010
hooks:
1111
- id: ruff
1212
args: ["--fix", "--show-fixes"]
@@ -22,7 +22,7 @@ repos:
2222
- id: check-yaml
2323
- id: trailing-whitespace
2424
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.15.0
25+
rev: v1.16.0
2626
hooks:
2727
- id: mypy
2828
files: src|tests

src/zarr/core/buffer/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def ravel(self, order: Literal["K", "A", "C", "F"] = ...) -> Self: ...
9393

9494
def all(self) -> bool: ...
9595

96-
def __eq__(self, other: object) -> Self: # type: ignore[explicit-override, override]
96+
def __eq__(self, other: object) -> Self: # type: ignore[override]
9797
"""Element-wise equal
9898
9999
Notes

src/zarr/core/metadata/v3.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,7 @@ def __init__(
272272
if fill_value is None:
273273
fill_value = default_fill_value(data_type_parsed)
274274
# we pass a string here rather than an enum to make mypy happy
275-
fill_value_parsed = parse_fill_value(
276-
fill_value, dtype=cast("ALL_DTYPES", data_type_parsed.value)
277-
)
275+
fill_value_parsed = parse_fill_value(fill_value, data_type_parsed.value)
278276
attributes_parsed = parse_attributes(attributes)
279277
codecs_parsed_partial = parse_codecs(codecs)
280278
storage_transformers_parsed = parse_storage_transformers(storage_transformers)
@@ -529,11 +527,12 @@ def parse_fill_value(
529527
if isinstance(fill_value, Sequence) and not isinstance(fill_value, str):
530528
if data_type in (DataType.complex64, DataType.complex128):
531529
if len(fill_value) == 2:
532-
decoded_fill_value = tuple(
533-
SPECIAL_FLOATS_ENCODED.get(value, value) for value in fill_value
530+
decoded_fill_value = (
531+
SPECIAL_FLOATS_ENCODED.get(fill_value[0], fill_value[0]),
532+
SPECIAL_FLOATS_ENCODED.get(fill_value[1], fill_value[1]),
534533
)
535534
# complex datatypes serialize to JSON arrays with two elements
536-
return np_dtype.type(complex(*decoded_fill_value))
535+
return np_dtype.type(complex(*decoded_fill_value)) # type: ignore[arg-type]
537536
else:
538537
msg = (
539538
f"Got an invalid fill value for complex data type {data_type.value}."

src/zarr/storage/_memory.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ async def delete(self, key: str) -> None:
136136
except KeyError:
137137
logger.debug("Key %s does not exist.", key)
138138

139-
async def set_partial_values(self, key_start_values: Iterable[tuple[str, int, bytes]]) -> None:
139+
async def set_partial_values(
140+
self, key_start_values: Iterable[tuple[str, int, bytes | bytearray | memoryview[int]]]
141+
) -> None:
140142
# docstring inherited
141143
raise NotImplementedError
142144

src/zarr/storage/_zip.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ async def set(self, key: str, value: Buffer) -> None:
222222
with self._lock:
223223
self._set(key, value)
224224

225-
async def set_partial_values(self, key_start_values: Iterable[tuple[str, int, bytes]]) -> None:
225+
async def set_partial_values(
226+
self, key_start_values: Iterable[tuple[str, int, bytes | bytearray | memoryview[int]]]
227+
) -> None:
226228
raise NotImplementedError
227229

228230
async def set_if_not_exists(self, key: str, value: Buffer) -> None:

0 commit comments

Comments
 (0)