Skip to content

Commit 6982fb1

Browse files
committed
Update pre-commit hooks + mypy fixes
1 parent 6798466 commit 6982fb1

File tree

7 files changed

+15
-11
lines changed

7 files changed

+15
-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/dtype/npy/bytes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ def _check_native_dtype(
176176
Bool
177177
True if the dtype matches, False otherwise.
178178
"""
179-
return cls.dtype_cls is type(dtype) and dtype.fields is None # type: ignore[has-type]
179+
return cls.dtype_cls is type(dtype) and dtype.fields is None
180180

181181
@classmethod
182182
def from_native_dtype(cls, dtype: TBaseDType) -> Self:
183183
if cls._check_native_dtype(dtype):
184184
return cls(length=dtype.itemsize)
185185
raise DataTypeValidationError(
186-
f"Invalid data type: {dtype}. Expected an instance of {cls.dtype_cls}" # type: ignore[has-type]
186+
f"Invalid data type: {dtype}. Expected an instance of {cls.dtype_cls}"
187187
)
188188

189189
def to_native_dtype(self) -> np.dtypes.VoidDType[int]:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _check_native_dtype(cls, dtype: TBaseDType) -> TypeGuard[np.dtypes.VoidDType
5252
TypeGuard[np.dtypes.VoidDType]
5353
True if the dtype matches, False otherwise.
5454
"""
55-
return isinstance(dtype, cls.dtype_cls) and dtype.fields is not None # type: ignore[has-type]
55+
return isinstance(dtype, cls.dtype_cls) and dtype.fields is not None
5656

5757
@classmethod
5858
def from_native_dtype(cls, dtype: TBaseDType) -> Self:
@@ -68,7 +68,7 @@ def from_native_dtype(cls, dtype: TBaseDType) -> Self:
6868

6969
return cls(fields=tuple(fields))
7070
raise DataTypeValidationError(
71-
f"Invalid data type: {dtype}. Expected an instance of {cls.dtype_cls}" # type: ignore[has-type]
71+
f"Invalid data type: {dtype}. Expected an instance of {cls.dtype_cls}"
7272
)
7373

7474
def to_native_dtype(self) -> np.dtypes.VoidDType[int]:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def _from_json_v2(cls, data: DTypeJSON) -> Self:
230230
return cls.from_native_dtype(np.dtype(name))
231231
msg = (
232232
f"Invalid JSON representation of {cls.__name__}. Got {data!r}, expected a string "
233-
f"representation of an instance of {cls.dtype_cls}" # type: ignore[has-type]
233+
f"representation of an instance of {cls.dtype_cls}"
234234
)
235235
raise DataTypeValidationError(msg)
236236

@@ -318,7 +318,7 @@ def _from_json_v2(cls, data: DTypeJSON) -> Self:
318318
return cls.from_native_dtype(np.dtype(name))
319319
msg = (
320320
f"Invalid JSON representation of {cls.__name__}. Got {data!r}, expected a string "
321-
f"representation of an instance of {cls.dtype_cls}" # type: ignore[has-type]
321+
f"representation of an instance of {cls.dtype_cls}"
322322
)
323323
raise DataTypeValidationError(msg)
324324

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)