Skip to content

Commit fc69b67

Browse files
committed
fix mypy and readthedocs
1 parent a4b4456 commit fc69b67

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/zarr/api/synchronous.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -933,9 +933,11 @@ def from_array(
933933
chunks : ChunkCoords or "auto" or "keep", optional
934934
Chunk shape of the array.
935935
Following values are supported:
936-
- "auto": Automatically determine the chunk shape based on the array's shape and dtype.
937-
- "keep": Retain the chunk shape of the data array if it is a zarr Array.
938-
- ChunkCoords: A tuple of integers representing the chunk shape.
936+
937+
- "auto": Automatically determine the chunk shape based on the array's shape and dtype.
938+
- "keep": Retain the chunk shape of the data array if it is a zarr Array.
939+
- ChunkCoords: A tuple of integers representing the chunk shape.
940+
939941
If not specified, defaults to "keep" if data is a zarr Array, otherwise "auto".
940942
shards : ChunkCoords, optional
941943
Shard shape of the array. The default value of ``None`` results in no sharding at all.
@@ -951,9 +953,11 @@ def from_array(
951953
the order if your filters is consistent with the behavior of each filter.
952954
953955
Following values are supported:
956+
954957
- Iterable[Codec]: List of filters to apply to the array.
955958
- "auto": Automatically determine the filters based on the array's dtype.
956959
- "keep": Retain the filters of the data array if it is a zarr Array.
960+
957961
If no ``filters`` are provided, defaults to "keep" if data is a zarr Array, otherwise "auto".
958962
compressors : Iterable[Codec] or "auto" or "keep", optional
959963
List of compressors to apply to the array. Compressors are applied in order, and after any
@@ -966,15 +970,18 @@ def from_array(
966970
be provided for Zarr format 2.
967971
968972
Following values are supported:
973+
969974
- Iterable[Codec]: List of compressors to apply to the array.
970975
- "auto": Automatically determine the compressors based on the array's dtype.
971976
- "keep": Retain the compressors of the input array if it is a zarr Array.
977+
972978
If no ``compressors`` are provided, defaults to "keep" if data is a zarr Array, otherwise "auto".
973979
serializer : dict[str, JSON] | ArrayBytesCodec or "auto" or "keep", optional
974980
Array-to-bytes codec to use for encoding the array data.
975981
Zarr format 3 only. Zarr format 2 arrays use implicit array-to-bytes conversion.
976982
977983
Following values are supported:
984+
978985
- dict[str, JSON]: A dict representation of an ``ArrayBytesCodec``.
979986
- ArrayBytesCodec: An instance of ``ArrayBytesCodec``.
980987
- "auto": a default serializer will be used. These defaults can be changed by modifying the value of
@@ -1062,7 +1069,6 @@ def from_array(
10621069
>>> arr5[...]
10631070
[[0 0]
10641071
[0 0]]
1065-
10661072
"""
10671073
return Array(
10681074
sync(

src/zarr/core/array.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3970,25 +3970,27 @@ async def from_array(
39703970
if write_data:
39713971
if isinstance(data, Array):
39723972

3973-
async def _copy_region(chunk_coords: ChunkCoords | slice, _data: Array) -> None:
3973+
async def _copy_array_region(chunk_coords: ChunkCoords | slice, _data: Array) -> None:
39743974
arr = await _data._async_array.getitem(chunk_coords)
39753975
await new_array.setitem(chunk_coords, arr)
39763976

39773977
# Stream data from the source array to the new array
39783978
await concurrent_map(
39793979
[(region, data) for region in new_array._iter_chunk_regions()],
3980-
_copy_region,
3980+
_copy_array_region,
39813981
zarr.core.config.config.get("async.concurrency"),
39823982
)
39833983
else:
39843984

3985-
async def _copy_region(chunk_coords: ChunkCoords | slice, _data: npt.ArrayLike) -> None:
3985+
async def _copy_arraylike_region(
3986+
chunk_coords: ChunkCoords | slice, _data: npt.ArrayLike
3987+
) -> None:
39863988
await new_array.setitem(chunk_coords, _data[chunk_coords])
39873989

39883990
# Stream data from the source array to the new array
39893991
await concurrent_map(
39903992
[(region, data) for region in new_array._iter_chunk_regions()],
3991-
_copy_region,
3993+
_copy_arraylike_region,
39923994
zarr.core.config.config.get("async.concurrency"),
39933995
)
39943996
return new_array

0 commit comments

Comments
 (0)