Skip to content

Commit

Permalink
nit: annotate a function and rename an argument
Browse files Browse the repository at this point in the history
  • Loading branch information
d-v-b committed Mar 19, 2024
1 parent c8521c4 commit 6467bf8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/pydantic_zarr/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
TItem = TypeVar("TItem", bound=Union["GroupSpec", "ArraySpec"])


def stringify_dtype(value: npt.DTypeLike):
def stringify_dtype(value: npt.DTypeLike) -> str:
"""
Convert a `numpy.dtype` object into a `str`.
Expand Down Expand Up @@ -286,13 +286,13 @@ def from_array(
)

@classmethod
def from_zarr(cls, zarray: zarr.Array):
def from_zarr(cls, array: zarr.Array):
"""
Create an `ArraySpec` from an instance of `zarr.Array`.
Parameters
----------
zarray : zarr.Array
array : zarr.Array
Returns
-------
Expand All @@ -309,17 +309,17 @@ def from_zarr(cls, zarray: zarr.Array):
"""
return cls(
shape=zarray.shape,
chunks=zarray.chunks,
dtype=str(zarray.dtype),
shape=array.shape,
chunks=array.chunks,
dtype=str(array.dtype),
# explicitly cast to numpy type and back to python
# so that int 0 isn't serialized as 0.0
fill_value=zarray.dtype.type(zarray.fill_value).tolist(),
order=zarray.order,
filters=zarray.filters,
dimension_separator=zarray._dimension_separator,
compressor=zarray.compressor,
attributes=zarray.attrs.asdict(),
fill_value=array.dtype.type(array.fill_value).tolist(),
order=array.order,
filters=array.filters,
dimension_separator=array._dimension_separator,
compressor=array.compressor,
attributes=array.attrs.asdict(),
)

def to_zarr(
Expand Down

0 comments on commit 6467bf8

Please sign in to comment.