Skip to content

Commit

Permalink
fix mypy and readthedocs
Browse files Browse the repository at this point in the history
  • Loading branch information
brokkoli71 committed Jan 15, 2025
1 parent addb785 commit a2373ad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/zarr/api/synchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ def from_array(
- dict[str, JSON]: A dict representation of an ``ArrayBytesCodec``.
- ArrayBytesCodec: An instance of ``ArrayBytesCodec``.
- "auto": a default serializer will be used. These defaults can be changed by modifying the value of
``array.v3_default_serializer`` in :mod:`zarr.core.config`.
`array.v3_default_serializer` in :mod:`zarr.core.config`.
- "keep": Retain the serializer of the input array if it is a zarr Array.
fill_value : Any, optional
Fill value for the array.
Expand Down
6 changes: 2 additions & 4 deletions src/zarr/core/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -3834,7 +3834,7 @@ async def from_array(
- dict[str, JSON]: A dict representation of an ``ArrayBytesCodec``.
- ArrayBytesCodec: An instance of ``ArrayBytesCodec``.
- "auto": a default serializer will be used. These defaults can be changed by modifying the value of
``array.v3_default_serializer`` in :mod:`zarr.core.config`.
`array.v3_default_serializer`` in :mod:`zarr.core.config`.
- "keep": Retain the serializer of the input array if it is a zarr Array.
fill_value : Any, optional
Expand Down Expand Up @@ -3998,9 +3998,7 @@ async def _copy_array_region(chunk_coords: ChunkCoords | slice, _data: Array) ->
)
else:

async def _copy_arraylike_region(
chunk_coords: ChunkCoords | slice, _data: NDArrayLike
) -> None:
async def _copy_arraylike_region(chunk_coords: slice, _data: NDArrayLike) -> None:
await new_array.setitem(chunk_coords, _data[chunk_coords])

# Stream data from the source array to the new array
Expand Down
15 changes: 10 additions & 5 deletions tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1276,14 +1276,19 @@ async def test_creation_from_other_zarr_format(
src_format: ZarrFormat,
new_format: ZarrFormat,
) -> None:
kwargs: dict[str, tuple[Literal["default"], Literal[".", "/"]] | Literal[".", "/"]] = {}
# set dimension_separator to non default
if src_format == 2:
kwargs["dimension_separator"] = "/"
src = zarr.create(
(50, 50), chunks=(10, 10), store=store, zarr_format=src_format, dimension_separator="/"
)
else:
kwargs["chunk_key_encoding"] = ("default", ".")
src = zarr.create(
(50, 50),
chunks=(10, 10),
store=store,
zarr_format=src_format,
chunk_key_encoding=("default", "."),
)

src = zarr.create((50, 50), chunks=(10, 10), store=store, zarr_format=src_format, **kwargs)
src[:] = np.arange(50 * 50).reshape((50, 50))
result = zarr.from_array(
src,
Expand Down

0 comments on commit a2373ad

Please sign in to comment.