Skip to content

Commit 73c835f

Browse files
committed
fix mypy in asynchronous.py
1 parent 9284246 commit 73c835f

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/zarr/api/asynchronous.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from collections.abc import Iterable
3434

3535
from zarr.abc.codec import Codec
36+
from zarr.core.buffer.core import NDArrayLike
3637
from zarr.core.chunk_key_encodings import ChunkKeyEncoding
3738
from zarr.storage import StoreLike
3839

@@ -348,7 +349,7 @@ async def open_consolidated(
348349

349350
async def save(
350351
store: StoreLike,
351-
*args: NDArrayOrScalarLike,
352+
*args: NDArrayLike,
352353
zarr_version: ZarrFormat | None = None, # deprecated
353354
zarr_format: ZarrFormat | None = None,
354355
path: str | None = None,
@@ -381,7 +382,7 @@ async def save(
381382

382383
async def save_array(
383384
store: StoreLike,
384-
arr: NDArrayOrScalarLike,
385+
arr: NDArrayLike,
385386
*,
386387
zarr_version: ZarrFormat | None = None, # deprecated
387388
zarr_format: ZarrFormat | None = None,
@@ -412,8 +413,8 @@ async def save_array(
412413
_handle_zarr_version_or_format(zarr_version=zarr_version, zarr_format=zarr_format)
413414
or _default_zarr_format()
414415
)
415-
if not isinstance(arr, NDArrayOrScalarLike):
416-
raise TypeError("arr argument must be numpy or other NDArrayOrScalarLike array")
416+
if not isinstance(arr, NDArrayLike):
417+
raise TypeError("arr argument must be numpy or other NDArrayLike array")
417418

418419
mode = kwargs.pop("mode", "a")
419420
store_path = await make_store_path(store, path=path, mode=mode, storage_options=storage_options)
@@ -436,12 +437,12 @@ async def save_array(
436437

437438
async def save_group(
438439
store: StoreLike,
439-
*args: NDArrayOrScalarLike,
440+
*args: NDArrayLike,
440441
zarr_version: ZarrFormat | None = None, # deprecated
441442
zarr_format: ZarrFormat | None = None,
442443
path: str | None = None,
443444
storage_options: dict[str, Any] | None = None,
444-
**kwargs: NDArrayOrScalarLike,
445+
**kwargs: NDArrayLike,
445446
) -> None:
446447
"""Convenience function to save several NumPy arrays to the local file system, following a
447448
similar API to the NumPy savez()/savez_compressed() functions.
@@ -474,14 +475,14 @@ async def save_group(
474475
)
475476

476477
for arg in args:
477-
if not isinstance(arg, NDArrayOrScalarLike):
478+
if not isinstance(arg, NDArrayLike):
478479
raise TypeError(
479-
"All arguments must be numpy or other NDArrayOrScalarLike arrays (except store, path, storage_options, and zarr_format)"
480+
"All arguments must be numpy or other NDArrayLike arrays (except store, path, storage_options, and zarr_format)"
480481
)
481482
for k, v in kwargs.items():
482-
if not isinstance(v, NDArrayOrScalarLike):
483+
if not isinstance(v, NDArrayLike):
483484
raise TypeError(
484-
f"Keyword argument '{k}' must be a numpy or other NDArrayOrScalarLike array"
485+
f"Keyword argument '{k}' must be a numpy or other NDArrayLike array"
485486
)
486487

487488
if len(args) == 0 and len(kwargs) == 0:

0 commit comments

Comments
 (0)