|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | from abc import abstractmethod |
4 | | -from typing import TYPE_CHECKING, Any, Generic, TypeVar |
| 4 | +from typing import TYPE_CHECKING, Generic, TypeVar |
5 | 5 |
|
6 | 6 | from zarr.abc.metadata import Metadata |
7 | 7 | from zarr.core.buffer import Buffer, NDBuffer |
|
12 | 12 | from collections.abc import Awaitable, Callable, Iterable |
13 | 13 | from typing import Self |
14 | 14 |
|
15 | | - import numpy as np |
16 | | - |
17 | 15 | from zarr.abc.store import ByteGetter, ByteSetter |
18 | 16 | from zarr.core.array_spec import ArraySpec |
19 | 17 | from zarr.core.chunk_grids import ChunkGrid |
| 18 | + from zarr.core.dtype.wrapper import ZDType, _BaseDType, _BaseScalar |
20 | 19 | from zarr.core.indexing import SelectorTuple |
21 | 20 |
|
22 | 21 | __all__ = [ |
@@ -93,7 +92,13 @@ def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self: |
93 | 92 | """ |
94 | 93 | return self |
95 | 94 |
|
96 | | - def validate(self, *, shape: ChunkCoords, dtype: np.dtype[Any], chunk_grid: ChunkGrid) -> None: |
| 95 | + def validate( |
| 96 | + self, |
| 97 | + *, |
| 98 | + shape: ChunkCoords, |
| 99 | + dtype: ZDType[_BaseDType, _BaseScalar], |
| 100 | + chunk_grid: ChunkGrid, |
| 101 | + ) -> None: |
97 | 102 | """Validates that the codec configuration is compatible with the array metadata. |
98 | 103 | Raises errors when the codec configuration is not compatible. |
99 | 104 |
|
@@ -285,7 +290,9 @@ def supports_partial_decode(self) -> bool: ... |
285 | 290 | def supports_partial_encode(self) -> bool: ... |
286 | 291 |
|
287 | 292 | @abstractmethod |
288 | | - def validate(self, *, shape: ChunkCoords, dtype: np.dtype[Any], chunk_grid: ChunkGrid) -> None: |
| 293 | + def validate( |
| 294 | + self, *, shape: ChunkCoords, dtype: ZDType[_BaseDType, _BaseScalar], chunk_grid: ChunkGrid |
| 295 | + ) -> None: |
289 | 296 | """Validates that all codec configurations are compatible with the array metadata. |
290 | 297 | Raises errors when a codec configuration is not compatible. |
291 | 298 |
|
|
0 commit comments