Skip to content

Commit e7cbaef

Browse files
committed
satisfied mypy by adding get_mask_selection to AsyncArray
1 parent b6d5b6d commit e7cbaef

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/zarr/core/array.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,21 @@ async def get_orthogonal_selection(
14421442
indexer=indexer, out=out, fields=fields, prototype=prototype
14431443
)
14441444

1445+
async def get_mask_selection(
1446+
self,
1447+
mask: MaskSelection,
1448+
*,
1449+
out: NDBuffer | None = None,
1450+
fields: Fields | None = None,
1451+
prototype: BufferPrototype | None = None,
1452+
) -> NDArrayLikeOrScalar:
1453+
if prototype is None:
1454+
prototype = default_buffer_prototype()
1455+
indexer = MaskIndexer(mask, self.shape, self.metadata.chunk_grid)
1456+
return await self._get_selection(
1457+
indexer=indexer, out=out, fields=fields, prototype=prototype
1458+
)
1459+
14451460
async def get_coordinate_selection(
14461461
self,
14471462
selection: CoordinateSelection,

src/zarr/core/indexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ async def getitem(
13091309
if is_coordinate_selection(new_selection, self.array.shape):
13101310
return await self.array.get_coordinate_selection(new_selection, fields=fields)
13111311
elif is_mask_selection(new_selection, self.array.shape):
1312-
return self.array.get_mask_selection(new_selection, fields=fields)
1312+
return await self.array.get_mask_selection(new_selection, fields=fields)
13131313
else:
13141314
raise VindexInvalidSelectionError(new_selection)
13151315

0 commit comments

Comments
 (0)