Skip to content

Commit b55c8b3

Browse files
committed
Revert "returning npt.ArrayLike instead of NDArrayLike because of scalar return values"
This reverts commit 1a290c7.
1 parent e302ae6 commit b55c8b3

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

src/zarr/api/asynchronous.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ async def load(
232232
path: str | None = None,
233233
zarr_format: ZarrFormat | None = None,
234234
zarr_version: ZarrFormat | None = None,
235-
) -> npt.ArrayLike | dict[str, npt.ArrayLike]:
235+
) -> NDArrayLike | dict[str, NDArrayLike]:
236236
"""Load data from an array or group into memory.
237237
238238
Parameters

src/zarr/core/array.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ async def _get_selection(
12031203
prototype: BufferPrototype,
12041204
out: NDBuffer | None = None,
12051205
fields: Fields | None = None,
1206-
) -> npt.ArrayLike:
1206+
) -> NDArrayLike:
12071207
# check fields are sensible
12081208
out_dtype = check_fields(fields, self.dtype)
12091209

@@ -1253,7 +1253,7 @@ async def getitem(
12531253
selection: BasicSelection,
12541254
*,
12551255
prototype: BufferPrototype | None = None,
1256-
) -> npt.ArrayLike:
1256+
) -> NDArrayLike:
12571257
"""
12581258
Asynchronous function that retrieves a subset of the array's data based on the provided selection.
12591259
@@ -1266,7 +1266,7 @@ async def getitem(
12661266
12671267
Returns
12681268
-------
1269-
npt.ArrayLike
1269+
NDArrayLike
12701270
The retrieved subset of the array's data.
12711271
12721272
Examples
@@ -2224,7 +2224,7 @@ def __array__(
22242224

22252225
return arr_np
22262226

2227-
def __getitem__(self, selection: Selection) -> npt.ArrayLike:
2227+
def __getitem__(self, selection: Selection) -> NDArrayLike:
22282228
"""Retrieve data for an item or region of the array.
22292229
22302230
Parameters
@@ -2235,7 +2235,7 @@ def __getitem__(self, selection: Selection) -> npt.ArrayLike:
22352235
22362236
Returns
22372237
-------
2238-
npt.ArrayLike
2238+
NDArrayLike
22392239
An array-like containing the data for the requested region.
22402240
22412241
Examples
@@ -2482,7 +2482,7 @@ def get_basic_selection(
24822482
out: NDBuffer | None = None,
24832483
prototype: BufferPrototype | None = None,
24842484
fields: Fields | None = None,
2485-
) -> npt.ArrayLike:
2485+
) -> NDArrayLike:
24862486
"""Retrieve data for an item or region of the array.
24872487
24882488
Parameters
@@ -2702,7 +2702,7 @@ def get_orthogonal_selection(
27022702
out: NDBuffer | None = None,
27032703
fields: Fields | None = None,
27042704
prototype: BufferPrototype | None = None,
2705-
) -> npt.ArrayLike:
2705+
) -> NDArrayLike:
27062706
"""Retrieve data by making a selection for each dimension of the array. For
27072707
example, if an array has 2 dimensions, allows selecting specific rows and/or
27082708
columns. The selection for each dimension can be either an integer (indexing a
@@ -2938,7 +2938,7 @@ def get_mask_selection(
29382938
out: NDBuffer | None = None,
29392939
fields: Fields | None = None,
29402940
prototype: BufferPrototype | None = None,
2941-
) -> npt.ArrayLike:
2941+
) -> NDArrayLike:
29422942
"""Retrieve a selection of individual items, by providing a Boolean array of the
29432943
same shape as the array against which the selection is being made, where True
29442944
values indicate a selected item.
@@ -3100,7 +3100,7 @@ def get_coordinate_selection(
31003100
out: NDBuffer | None = None,
31013101
fields: Fields | None = None,
31023102
prototype: BufferPrototype | None = None,
3103-
) -> npt.ArrayLike:
3103+
) -> NDArrayLike:
31043104
"""Retrieve a selection of individual items, by providing the indices
31053105
(coordinates) for each selected item.
31063106
@@ -3288,7 +3288,7 @@ def get_block_selection(
32883288
out: NDBuffer | None = None,
32893289
fields: Fields | None = None,
32903290
prototype: BufferPrototype | None = None,
3291-
) -> npt.ArrayLike:
3291+
) -> NDArrayLike:
32923292
"""Retrieve a selection of individual items, by providing the indices
32933293
(coordinates) for each selected item.
32943294
@@ -3306,7 +3306,7 @@ def get_block_selection(
33063306
33073307
Returns
33083308
-------
3309-
npt.ArrayLike
3309+
NDArrayLike
33103310
An array-like containing the data for the requested block selection.
33113311
33123312
Examples

src/zarr/core/indexing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ class OIndex:
928928
array: Array
929929

930930
# TODO: develop Array generic and move zarr.Array[np.intp] | zarr.Array[np.bool_] to ArrayOfIntOrBool
931-
def __getitem__(self, selection: OrthogonalSelection | Array) -> npt.ArrayLike:
931+
def __getitem__(self, selection: OrthogonalSelection | Array) -> NDArrayLike:
932932
from zarr.core.array import Array
933933

934934
# if input is a Zarr array, we materialize it now.
@@ -1037,7 +1037,7 @@ def __iter__(self) -> Iterator[ChunkProjection]:
10371037
class BlockIndex:
10381038
array: Array
10391039

1040-
def __getitem__(self, selection: BasicSelection) -> npt.ArrayLike:
1040+
def __getitem__(self, selection: BasicSelection) -> NDArrayLike:
10411041
fields, new_selection = pop_fields(selection)
10421042
new_selection = ensure_tuple(new_selection)
10431043
new_selection = replace_lists(new_selection)
@@ -1226,7 +1226,7 @@ class VIndex:
12261226
array: Array
12271227

12281228
# TODO: develop Array generic and move zarr.Array[np.intp] | zarr.Array[np.bool_] to ArrayOfIntOrBool
1229-
def __getitem__(self, selection: CoordinateSelection | MaskSelection | Array) -> npt.ArrayLike:
1229+
def __getitem__(self, selection: CoordinateSelection | MaskSelection | Array) -> NDArrayLike:
12301230
from zarr.core.array import Array
12311231

12321232
# if input is a Zarr array, we materialize it now.

0 commit comments

Comments
 (0)