Skip to content
Closed
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
20 changes: 11 additions & 9 deletions src/zarr/abc/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -316,7 +318,7 @@ def compute_encoded_size(self, byte_length: int, array_spec: ArraySpec) -> int:
-------
int
"""
...
raise NotImplementedError

@abstractmethod
async def decode(
Expand All @@ -335,7 +337,7 @@ async def decode(
-------
Iterable[NDBuffer | None]
"""
...
raise NotImplementedError

@abstractmethod
async def encode(
Expand All @@ -354,7 +356,7 @@ async def encode(
-------
Iterable[Buffer | None]
"""
...
raise NotImplementedError

@abstractmethod
async def read(
Expand All @@ -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(
Expand All @@ -399,7 +401,7 @@ async def write(
The chunk spec contains information about the chunk.
value : NDBuffer
"""
...
raise NotImplementedError


async def _batching_helper(
Expand Down
8 changes: 5 additions & 3 deletions src/zarr/core/buffer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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__()
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/core/chunk_grids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/zarr/core/chunk_key_encodings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down