Skip to content

Commit

Permalink
Merge branch 'v3' into array-hexdigest-zlibng
Browse files Browse the repository at this point in the history
  • Loading branch information
d-v-b authored Jun 23, 2024
2 parents e25f93d + 8aadd15 commit 14bccc3
Show file tree
Hide file tree
Showing 19 changed files with 1,529 additions and 330 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
with:
name: releases
path: dist
- uses: pypa/gh-action-pypi-publish@v1.8.14
- uses: pypa/gh-action-pypi-publish@v1.9.0
with:
user: __token__
password: ${{ secrets.pypi_password }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.4.8'
rev: 'v0.4.9'
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
26 changes: 19 additions & 7 deletions src/zarr/abc/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@

from abc import abstractmethod
from collections.abc import Awaitable, Callable, Iterable
from typing import TYPE_CHECKING, Generic, TypeVar
from typing import TYPE_CHECKING, Any, Generic, TypeVar

import numpy as np

from zarr.abc.metadata import Metadata
from zarr.abc.store import ByteGetter, ByteSetter
from zarr.buffer import Buffer, NDBuffer
from zarr.common import concurrent_map
from zarr.chunk_grids import ChunkGrid
from zarr.common import ChunkCoords, concurrent_map
from zarr.config import config

if TYPE_CHECKING:
from typing_extensions import Self

from zarr.array_spec import ArraySpec
from zarr.indexing import SelectorTuple
from zarr.metadata import ArrayMetadata

CodecInput = TypeVar("CodecInput", bound=NDBuffer | Buffer)
CodecOutput = TypeVar("CodecOutput", bound=NDBuffer | Buffer)
Expand Down Expand Up @@ -75,13 +77,18 @@ def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self:
"""
return self

def validate(self, array_metadata: ArrayMetadata) -> None:
def validate(self, *, shape: ChunkCoords, dtype: np.dtype[Any], chunk_grid: ChunkGrid) -> None:
"""Validates that the codec configuration is compatible with the array metadata.
Raises errors when the codec configuration is not compatible.
Parameters
----------
array_metadata : ArrayMetadata
shape: ChunkCoords
The array shape
dtype: np.dtype[Any]
The array data type
chunk_grid: ChunkGrid
The array chunk grid
"""
...

Expand Down Expand Up @@ -275,13 +282,18 @@ def supports_partial_decode(self) -> bool: ...
def supports_partial_encode(self) -> bool: ...

@abstractmethod
def validate(self, array_metadata: ArrayMetadata) -> None:
def validate(self, *, shape: ChunkCoords, dtype: np.dtype[Any], chunk_grid: ChunkGrid) -> None:
"""Validates that all codec configurations are compatible with the array metadata.
Raises errors when a codec configuration is not compatible.
Parameters
----------
array_metadata : ArrayMetadata
shape: ChunkCoords
The array shape
dtype: np.dtype[Any]
The array data type
chunk_grid: ChunkGrid
The array chunk grid
"""
...

Expand Down
2 changes: 1 addition & 1 deletion src/zarr/api/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ async def tree(*args: Any, **kwargs: Any) -> None:
raise NotImplementedError


async def array(data: NDArrayLike, **kwargs: Any) -> AsyncArray:
async def array(data: npt.ArrayLike, **kwargs: Any) -> AsyncArray:
"""Create an array filled with `data`.
Parameters
Expand Down
Loading

0 comments on commit 14bccc3

Please sign in to comment.