40
40
)
41
41
from zarr .core .dtype import ZDTypeLike
42
42
from zarr .storage import StoreLike
43
+ from zarr .types import AnyArray
43
44
44
45
__all__ = [
45
46
"array" ,
@@ -168,7 +169,7 @@ def open(
168
169
path : str | None = None ,
169
170
storage_options : dict [str , Any ] | None = None ,
170
171
** kwargs : Any , # TODO: type kwargs as valid args to async_api.open
171
- ) -> Array | Group :
172
+ ) -> AnyArray | Group :
172
173
"""Open a group or array using file-mode-like semantics.
173
174
174
175
Parameters
@@ -365,7 +366,7 @@ def tree(grp: Group, expand: bool | None = None, level: int | None = None) -> An
365
366
366
367
367
368
# TODO: add type annotations for kwargs
368
- def array (data : npt .ArrayLike | Array , ** kwargs : Any ) -> Array :
369
+ def array (data : npt .ArrayLike | AnyArray , ** kwargs : Any ) -> AnyArray :
369
370
"""Create an array filled with `data`.
370
371
371
372
Parameters
@@ -633,7 +634,7 @@ def create(
633
634
storage_options : dict [str , Any ] | None = None ,
634
635
config : ArrayConfigLike | None = None ,
635
636
** kwargs : Any ,
636
- ) -> Array :
637
+ ) -> AnyArray :
637
638
"""Create an array.
638
639
639
640
Parameters
@@ -769,7 +770,7 @@ def create_array(
769
770
overwrite : bool = False ,
770
771
config : ArrayConfigLike | None = None ,
771
772
write_data : bool = True ,
772
- ) -> Array :
773
+ ) -> AnyArray :
773
774
"""Create an array.
774
775
775
776
This function wraps :func:`zarr.core.array.create_array`.
@@ -917,7 +918,7 @@ def create_array(
917
918
def from_array (
918
919
store : str | StoreLike ,
919
920
* ,
920
- data : Array | npt .ArrayLike ,
921
+ data : AnyArray | npt .ArrayLike ,
921
922
write_data : bool = True ,
922
923
name : str | None = None ,
923
924
chunks : Literal ["auto" , "keep" ] | ChunkCoords = "keep" ,
@@ -934,7 +935,7 @@ def from_array(
934
935
storage_options : dict [str , Any ] | None = None ,
935
936
overwrite : bool = False ,
936
937
config : ArrayConfigLike | None = None ,
937
- ) -> Array :
938
+ ) -> AnyArray :
938
939
"""Create an array from an existing array or array-like.
939
940
940
941
Parameters
@@ -1128,7 +1129,7 @@ def from_array(
1128
1129
1129
1130
1130
1131
# TODO: add type annotations for kwargs
1131
- def empty (shape : ChunkCoords , ** kwargs : Any ) -> Array :
1132
+ def empty (shape : ChunkCoords , ** kwargs : Any ) -> AnyArray :
1132
1133
"""Create an empty array with the specified shape. The contents will be filled with the
1133
1134
array's fill value or zeros if no fill value is provided.
1134
1135
@@ -1155,7 +1156,7 @@ def empty(shape: ChunkCoords, **kwargs: Any) -> Array:
1155
1156
1156
1157
# TODO: move ArrayLike to common module
1157
1158
# TODO: add type annotations for kwargs
1158
- def empty_like (a : ArrayLike , ** kwargs : Any ) -> Array :
1159
+ def empty_like (a : ArrayLike , ** kwargs : Any ) -> AnyArray :
1159
1160
"""Create an empty array like another array. The contents will be filled with the
1160
1161
array's fill value or zeros if no fill value is provided.
1161
1162
@@ -1181,7 +1182,7 @@ def empty_like(a: ArrayLike, **kwargs: Any) -> Array:
1181
1182
1182
1183
1183
1184
# TODO: add type annotations for kwargs and fill_value
1184
- def full (shape : ChunkCoords , fill_value : Any , ** kwargs : Any ) -> Array :
1185
+ def full (shape : ChunkCoords , fill_value : Any , ** kwargs : Any ) -> AnyArray :
1185
1186
"""Create an array with a default fill value.
1186
1187
1187
1188
Parameters
@@ -1203,7 +1204,7 @@ def full(shape: ChunkCoords, fill_value: Any, **kwargs: Any) -> Array:
1203
1204
1204
1205
# TODO: move ArrayLike to common module
1205
1206
# TODO: add type annotations for kwargs
1206
- def full_like (a : ArrayLike , ** kwargs : Any ) -> Array :
1207
+ def full_like (a : ArrayLike , ** kwargs : Any ) -> AnyArray :
1207
1208
"""Create a filled array like another array.
1208
1209
1209
1210
Parameters
@@ -1222,7 +1223,7 @@ def full_like(a: ArrayLike, **kwargs: Any) -> Array:
1222
1223
1223
1224
1224
1225
# TODO: add type annotations for kwargs
1225
- def ones (shape : ChunkCoords , ** kwargs : Any ) -> Array :
1226
+ def ones (shape : ChunkCoords , ** kwargs : Any ) -> AnyArray :
1226
1227
"""Create an array with a fill value of one.
1227
1228
1228
1229
Parameters
@@ -1241,7 +1242,7 @@ def ones(shape: ChunkCoords, **kwargs: Any) -> Array:
1241
1242
1242
1243
1243
1244
# TODO: add type annotations for kwargs
1244
- def ones_like (a : ArrayLike , ** kwargs : Any ) -> Array :
1245
+ def ones_like (a : ArrayLike , ** kwargs : Any ) -> AnyArray :
1245
1246
"""Create an array of ones like another array.
1246
1247
1247
1248
Parameters
@@ -1267,7 +1268,7 @@ def open_array(
1267
1268
path : PathLike = "" ,
1268
1269
storage_options : dict [str , Any ] | None = None ,
1269
1270
** kwargs : Any ,
1270
- ) -> Array :
1271
+ ) -> AnyArray :
1271
1272
"""Open an array using file-mode-like semantics.
1272
1273
1273
1274
Parameters
@@ -1303,7 +1304,7 @@ def open_array(
1303
1304
1304
1305
1305
1306
# TODO: add type annotations for kwargs
1306
- def open_like (a : ArrayLike , path : str , ** kwargs : Any ) -> Array :
1307
+ def open_like (a : ArrayLike , path : str , ** kwargs : Any ) -> AnyArray :
1307
1308
"""Open a persistent array like another array.
1308
1309
1309
1310
Parameters
@@ -1324,7 +1325,7 @@ def open_like(a: ArrayLike, path: str, **kwargs: Any) -> Array:
1324
1325
1325
1326
1326
1327
# TODO: add type annotations for kwargs
1327
- def zeros (shape : ChunkCoords , ** kwargs : Any ) -> Array :
1328
+ def zeros (shape : ChunkCoords , ** kwargs : Any ) -> AnyArray :
1328
1329
"""Create an array with a fill value of zero.
1329
1330
1330
1331
Parameters
@@ -1343,7 +1344,7 @@ def zeros(shape: ChunkCoords, **kwargs: Any) -> Array:
1343
1344
1344
1345
1345
1346
# TODO: add type annotations for kwargs
1346
- def zeros_like (a : ArrayLike , ** kwargs : Any ) -> Array :
1347
+ def zeros_like (a : ArrayLike , ** kwargs : Any ) -> AnyArray :
1347
1348
"""Create an array of zeros like another array.
1348
1349
1349
1350
Parameters
0 commit comments