diff --git a/src/zarr/abc/codec.py b/src/zarr/abc/codec.py index 2098d989e9..5d68df5673 100644 --- a/src/zarr/abc/codec.py +++ b/src/zarr/abc/codec.py @@ -276,15 +276,17 @@ def from_codecs(cls, codecs: Iterable[Codec]) -> Self: ------- Self """ - ... + raise NotImplementedError @property @abstractmethod - def supports_partial_decode(self) -> bool: ... + def supports_partial_decode(self) -> bool: + raise NotImplementedError @property @abstractmethod - def supports_partial_encode(self) -> bool: ... + def supports_partial_encode(self) -> bool: + raise NotImplementedError @abstractmethod def validate(self, *, shape: ChunkCoords, dtype: np.dtype[Any], chunk_grid: ChunkGrid) -> None: @@ -300,7 +302,7 @@ def validate(self, *, shape: ChunkCoords, dtype: np.dtype[Any], chunk_grid: Chun chunk_grid: ChunkGrid The array chunk grid """ - ... + raise NotImplementedError @abstractmethod def compute_encoded_size(self, byte_length: int, array_spec: ArraySpec) -> int: @@ -316,7 +318,7 @@ def compute_encoded_size(self, byte_length: int, array_spec: ArraySpec) -> int: ------- int """ - ... + raise NotImplementedError @abstractmethod async def decode( @@ -335,7 +337,7 @@ async def decode( ------- Iterable[NDBuffer | None] """ - ... + raise NotImplementedError @abstractmethod async def encode( @@ -354,7 +356,7 @@ async def encode( ------- Iterable[Buffer | None] """ - ... + raise NotImplementedError @abstractmethod async def read( @@ -376,7 +378,7 @@ async def read( The chunk spec contains information about the construction of an array from the bytes. out : NDBuffer """ - ... + raise NotImplementedError @abstractmethod async def write( @@ -399,7 +401,7 @@ async def write( The chunk spec contains information about the chunk. value : NDBuffer """ - ... + raise NotImplementedError async def _batching_helper( diff --git a/src/zarr/core/buffer/core.py b/src/zarr/core/buffer/core.py index 95c4e00e99..08a337dd74 100644 --- a/src/zarr/core/buffer/core.py +++ b/src/zarr/core/buffer/core.py @@ -419,7 +419,7 @@ def as_numpy_array(self) -> npt.NDArray[Any]: ------- NumPy array of this buffer (might be a data copy) """ - ... + raise NotImplementedError @property def dtype(self) -> np.dtype[Any]: @@ -451,10 +451,12 @@ def astype(self, dtype: npt.DTypeLike, order: Literal["K", "A", "C", "F"] = "K") return self.__class__(self._data.astype(dtype=dtype, order=order)) @abstractmethod - def __getitem__(self, key: Any) -> Self: ... + def __getitem__(self, key: Any) -> Self: + raise NotImplementedError @abstractmethod - def __setitem__(self, key: Any, value: Any) -> None: ... + def __setitem__(self, key: Any, value: Any) -> None: + raise NotImplementedError def __len__(self) -> int: return self._data.__len__() diff --git a/src/zarr/core/chunk_grids.py b/src/zarr/core/chunk_grids.py index 61723215c6..4f9d00d66d 100644 --- a/src/zarr/core/chunk_grids.py +++ b/src/zarr/core/chunk_grids.py @@ -112,11 +112,11 @@ def from_dict(cls, data: dict[str, JSON] | ChunkGrid) -> ChunkGrid: @abstractmethod def all_chunk_coords(self, array_shape: ChunkCoords) -> Iterator[ChunkCoords]: - pass + raise NotImplementedError @abstractmethod def get_nchunks(self, array_shape: ChunkCoords) -> int: - pass + raise NotImplementedError @dataclass(frozen=True) diff --git a/src/zarr/core/chunk_key_encodings.py b/src/zarr/core/chunk_key_encodings.py index ed12ee3065..e23ab52652 100644 --- a/src/zarr/core/chunk_key_encodings.py +++ b/src/zarr/core/chunk_key_encodings.py @@ -55,11 +55,11 @@ def to_dict(self) -> dict[str, JSON]: @abstractmethod def decode_chunk_key(self, chunk_key: str) -> ChunkCoords: - pass + raise NotImplementedError @abstractmethod def encode_chunk_key(self, chunk_coords: ChunkCoords) -> str: - pass + raise NotImplementedError @dataclass(frozen=True)