2323import numcodecs
2424import numcodecs .abc
2525import numpy as np
26- import numpy .typing as npt
2726from typing_extensions import deprecated
2827
2928from zarr ._compat import _deprecate_positional_args
6766from zarr .core .config import config as zarr_config
6867from zarr .core .dtype import (
6968 ZDType ,
69+ ZDTypeLike ,
7070 parse_data_type ,
7171)
7272from zarr .core .indexing import (
122122 from collections .abc import Iterator , Sequence
123123 from typing import Self
124124
125+ import numpy .typing as npt
126+
125127 from zarr .abc .codec import CodecPipeline
126128 from zarr .codecs .sharding import ShardingCodecIndexLocation
127129 from zarr .core .dtype .wrapper import _BaseDType , _BaseScalar
@@ -295,7 +297,7 @@ async def create(
295297 * ,
296298 # v2 and v3
297299 shape : ShapeLike ,
298- dtype : npt . DTypeLike ,
300+ dtype : ZDTypeLike ,
299301 zarr_format : Literal [2 ],
300302 fill_value : Any | None = None ,
301303 attributes : dict [str , JSON ] | None = None ,
@@ -319,7 +321,7 @@ async def create(
319321 * ,
320322 # v2 and v3
321323 shape : ShapeLike ,
322- dtype : npt . DTypeLike ,
324+ dtype : ZDTypeLike ,
323325 zarr_format : Literal [3 ],
324326 fill_value : Any | None = None ,
325327 attributes : dict [str , JSON ] | None = None ,
@@ -347,7 +349,7 @@ async def create(
347349 * ,
348350 # v2 and v3
349351 shape : ShapeLike ,
350- dtype : npt . DTypeLike ,
352+ dtype : ZDTypeLike ,
351353 zarr_format : Literal [3 ] = 3 ,
352354 fill_value : Any | None = None ,
353355 attributes : dict [str , JSON ] | None = None ,
@@ -375,7 +377,7 @@ async def create(
375377 * ,
376378 # v2 and v3
377379 shape : ShapeLike ,
378- dtype : npt . DTypeLike ,
380+ dtype : ZDTypeLike ,
379381 zarr_format : ZarrFormat ,
380382 fill_value : Any | None = None ,
381383 attributes : dict [str , JSON ] | None = None ,
@@ -410,7 +412,7 @@ async def create(
410412 * ,
411413 # v2 and v3
412414 shape : ShapeLike ,
413- dtype : npt . DTypeLike ,
415+ dtype : ZDTypeLike ,
414416 zarr_format : ZarrFormat = 3 ,
415417 fill_value : Any | None = None ,
416418 attributes : dict [str , JSON ] | None = None ,
@@ -446,7 +448,7 @@ async def create(
446448 The store where the array will be created.
447449 shape : ShapeLike
448450 The shape of the array.
449- dtype : npt.DTypeLike
451+ dtype : ZDTypeLike
450452 The data type of the array.
451453 zarr_format : ZarrFormat, optional
452454 The Zarr format version (default is 3).
@@ -551,7 +553,7 @@ async def _create(
551553 * ,
552554 # v2 and v3
553555 shape : ShapeLike ,
554- dtype : npt . DTypeLike | ZDType [_BaseDType , _BaseScalar ],
556+ dtype : ZDTypeLike | ZDType [_BaseDType , _BaseScalar ],
555557 zarr_format : ZarrFormat = 3 ,
556558 fill_value : Any | None = None ,
557559 attributes : dict [str , JSON ] | None = None ,
@@ -1746,7 +1748,7 @@ def create(
17461748 * ,
17471749 # v2 and v3
17481750 shape : ChunkCoords ,
1749- dtype : npt . DTypeLike ,
1751+ dtype : ZDTypeLike ,
17501752 zarr_format : ZarrFormat = 3 ,
17511753 fill_value : Any | None = None ,
17521754 attributes : dict [str , JSON ] | None = None ,
@@ -1781,7 +1783,7 @@ def create(
17811783 The array store that has already been initialized.
17821784 shape : ChunkCoords
17831785 The shape of the array.
1784- dtype : npt.DTypeLike
1786+ dtype : ZDTypeLike
17851787 The data type of the array.
17861788 chunk_shape : ChunkCoords, optional
17871789 The shape of the Array's chunks.
@@ -1875,7 +1877,7 @@ def _create(
18751877 * ,
18761878 # v2 and v3
18771879 shape : ChunkCoords ,
1878- dtype : npt . DTypeLike ,
1880+ dtype : ZDTypeLike ,
18791881 zarr_format : ZarrFormat = 3 ,
18801882 fill_value : Any | None = None ,
18811883 attributes : dict [str , JSON ] | None = None ,
@@ -3817,7 +3819,7 @@ async def init_array(
38173819 * ,
38183820 store_path : StorePath ,
38193821 shape : ShapeLike ,
3820- dtype : npt . DTypeLike ,
3822+ dtype : ZDTypeLike ,
38213823 chunks : ChunkCoords | Literal ["auto" ] = "auto" ,
38223824 shards : ShardsLike | None = None ,
38233825 filters : FiltersLike = "auto" ,
@@ -3840,7 +3842,7 @@ async def init_array(
38403842 StorePath instance. The path attribute is the name of the array to initialize.
38413843 shape : ChunkCoords
38423844 Shape of the array.
3843- dtype : npt.DTypeLike
3845+ dtype : ZDTypeLike
38443846 Data type of the array.
38453847 chunks : ChunkCoords, optional
38463848 Chunk shape of the array.
@@ -4028,7 +4030,7 @@ async def create_array(
40284030 * ,
40294031 name : str | None = None ,
40304032 shape : ShapeLike | None = None ,
4031- dtype : npt . DTypeLike | None = None ,
4033+ dtype : ZDTypeLike | None = None ,
40324034 data : np .ndarray [Any , np .dtype [Any ]] | None = None ,
40334035 chunks : ChunkCoords | Literal ["auto" ] = "auto" ,
40344036 shards : ShardsLike | None = None ,
@@ -4057,7 +4059,7 @@ async def create_array(
40574059 at the root of the store.
40584060 shape : ChunkCoords, optional
40594061 Shape of the array. Can be ``None`` if ``data`` is provided.
4060- dtype : npt.DTypeLike | None
4062+ dtype : ZDTypeLike | None
40614063 Data type of the array. Can be ``None`` if ``data`` is provided.
40624064 data : Array-like data to use for initializing the array. If this parameter is provided, the
40634065 ``shape`` and ``dtype`` parameters must be identical to ``data.shape`` and ``data.dtype``,
@@ -4401,8 +4403,8 @@ def _parse_data_params(
44014403 * ,
44024404 data : np .ndarray [Any , np .dtype [Any ]] | None ,
44034405 shape : ShapeLike | None ,
4404- dtype : npt . DTypeLike | None ,
4405- ) -> tuple [np .ndarray [Any , np .dtype [Any ]] | None , ShapeLike , npt . DTypeLike ]:
4406+ dtype : ZDTypeLike | None ,
4407+ ) -> tuple [np .ndarray [Any , np .dtype [Any ]] | None , ShapeLike , ZDTypeLike ]:
44064408 """
44074409 Ensure an array-like ``data`` parameter is consistent with the ``dtype`` and ``shape``
44084410 parameters.
0 commit comments