33
33
from zarr .core .common import (
34
34
JSON ,
35
35
AccessModeLiteral ,
36
- ChunkCoords ,
37
36
DimensionNames ,
38
37
MemoryOrder ,
39
38
ShapeLike ,
@@ -598,9 +597,9 @@ def create_group(
598
597
599
598
# TODO: add type annotations for kwargs
600
599
def create (
601
- shape : ChunkCoords | int ,
600
+ shape : tuple [ int , ...] | int ,
602
601
* , # Note: this is a change from v2
603
- chunks : ChunkCoords | int | bool | None = None ,
602
+ chunks : tuple [ int , ...] | int | bool | None = None ,
604
603
dtype : ZDTypeLike | None = None ,
605
604
compressor : CompressorLike = "auto" ,
606
605
fill_value : Any | None = DEFAULT_FILL_VALUE , # TODO: need type
@@ -622,7 +621,7 @@ def create(
622
621
meta_array : Any | None = None , # TODO: need type
623
622
attributes : dict [str , JSON ] | None = None ,
624
623
# v3 only
625
- chunk_shape : ChunkCoords | int | None = None ,
624
+ chunk_shape : tuple [ int , ...] | int | None = None ,
626
625
chunk_key_encoding : (
627
626
ChunkKeyEncoding
628
627
| tuple [Literal ["default" ], Literal ["." , "/" ]]
@@ -755,7 +754,7 @@ def create_array(
755
754
shape : ShapeLike | None = None ,
756
755
dtype : ZDTypeLike | None = None ,
757
756
data : np .ndarray [Any , np .dtype [Any ]] | None = None ,
758
- chunks : ChunkCoords | Literal ["auto" ] = "auto" ,
757
+ chunks : tuple [ int , ...] | Literal ["auto" ] = "auto" ,
759
758
shards : ShardsLike | None = None ,
760
759
filters : FiltersLike = "auto" ,
761
760
compressors : CompressorsLike = "auto" ,
@@ -782,17 +781,17 @@ def create_array(
782
781
name : str or None, optional
783
782
The name of the array within the store. If ``name`` is ``None``, the array will be located
784
783
at the root of the store.
785
- shape : ChunkCoords , optional
784
+ shape : ShapeLike , optional
786
785
Shape of the array. Must be ``None`` if ``data`` is provided.
787
786
dtype : ZDTypeLike, optional
788
787
Data type of the array. Must be ``None`` if ``data`` is provided.
789
788
data : np.ndarray, optional
790
789
Array-like data to use for initializing the array. If this parameter is provided, the
791
790
``shape`` and ``dtype`` parameters must be ``None``.
792
- chunks : ChunkCoords , optional
791
+ chunks : tuple[int, ...] , optional
793
792
Chunk shape of the array.
794
793
If not specified, default are guessed based on the shape and dtype.
795
- shards : ChunkCoords , optional
794
+ shards : tuple[int, ...] , optional
796
795
Shard shape of the array. The default value of ``None`` results in no sharding at all.
797
796
filters : Iterable[Codec], optional
798
797
Iterable of filters to apply to each chunk of the array, in order, before serializing that
@@ -920,7 +919,7 @@ def from_array(
920
919
data : Array | npt .ArrayLike ,
921
920
write_data : bool = True ,
922
921
name : str | None = None ,
923
- chunks : Literal ["auto" , "keep" ] | ChunkCoords = "keep" ,
922
+ chunks : Literal ["auto" , "keep" ] | tuple [ int , ...] = "keep" ,
924
923
shards : ShardsLike | None | Literal ["keep" ] = "keep" ,
925
924
filters : FiltersLike | Literal ["keep" ] = "keep" ,
926
925
compressors : CompressorsLike | Literal ["keep" ] = "keep" ,
@@ -950,22 +949,22 @@ def from_array(
950
949
name : str or None, optional
951
950
The name of the array within the store. If ``name`` is ``None``, the array will be located
952
951
at the root of the store.
953
- chunks : ChunkCoords or "auto" or "keep", optional
952
+ chunks : tuple[int, ...] or "auto" or "keep", optional
954
953
Chunk shape of the array.
955
954
Following values are supported:
956
955
957
956
- "auto": Automatically determine the chunk shape based on the array's shape and dtype.
958
957
- "keep": Retain the chunk shape of the data array if it is a zarr Array.
959
- - ChunkCoords : A tuple of integers representing the chunk shape.
958
+ - tuple[int, ...] : A tuple of integers representing the chunk shape.
960
959
961
960
If not specified, defaults to "keep" if data is a zarr Array, otherwise "auto".
962
- shards : ChunkCoords , optional
961
+ shards : tuple[int, ...] , optional
963
962
Shard shape of the array.
964
963
Following values are supported:
965
964
966
965
- "auto": Automatically determine the shard shape based on the array's shape and chunk shape.
967
966
- "keep": Retain the shard shape of the data array if it is a zarr Array.
968
- - ChunkCoords : A tuple of integers representing the shard shape.
967
+ - tuple[int, ...] : A tuple of integers representing the shard shape.
969
968
- None: No sharding.
970
969
971
970
If not specified, defaults to "keep" if data is a zarr Array, otherwise None.
@@ -1128,7 +1127,7 @@ def from_array(
1128
1127
1129
1128
1130
1129
# TODO: add type annotations for kwargs
1131
- def empty (shape : ChunkCoords , ** kwargs : Any ) -> Array :
1130
+ def empty (shape : tuple [ int , ...] , ** kwargs : Any ) -> Array :
1132
1131
"""Create an empty array with the specified shape. The contents will be filled with the
1133
1132
array's fill value or zeros if no fill value is provided.
1134
1133
@@ -1181,7 +1180,7 @@ def empty_like(a: ArrayLike, **kwargs: Any) -> Array:
1181
1180
1182
1181
1183
1182
# TODO: add type annotations for kwargs and fill_value
1184
- def full (shape : ChunkCoords , fill_value : Any , ** kwargs : Any ) -> Array :
1183
+ def full (shape : tuple [ int , ...] , fill_value : Any , ** kwargs : Any ) -> Array :
1185
1184
"""Create an array with a default fill value.
1186
1185
1187
1186
Parameters
@@ -1222,7 +1221,7 @@ def full_like(a: ArrayLike, **kwargs: Any) -> Array:
1222
1221
1223
1222
1224
1223
# TODO: add type annotations for kwargs
1225
- def ones (shape : ChunkCoords , ** kwargs : Any ) -> Array :
1224
+ def ones (shape : tuple [ int , ...] , ** kwargs : Any ) -> Array :
1226
1225
"""Create an array with a fill value of one.
1227
1226
1228
1227
Parameters
@@ -1324,7 +1323,7 @@ def open_like(a: ArrayLike, path: str, **kwargs: Any) -> Array:
1324
1323
1325
1324
1326
1325
# TODO: add type annotations for kwargs
1327
- def zeros (shape : ChunkCoords , ** kwargs : Any ) -> Array :
1326
+ def zeros (shape : tuple [ int , ...] , ** kwargs : Any ) -> Array :
1328
1327
"""Create an array with a fill value of zero.
1329
1328
1330
1329
Parameters
0 commit comments