Skip to content

Commit cddd95c

Browse files
committed
Fix mypy errors due to Zarr 3.1.0 changes
1 parent bcdcb1a commit cddd95c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cubed/storage/backends/zarr_python_v3.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pathlib import Path
2-
from typing import Optional
2+
from typing import Literal, Optional
33

44
import zarr
55

@@ -32,7 +32,7 @@ def set_basic_selection(self, selection, value, fields=None):
3232

3333
def open_zarr_v3_array(
3434
store: T_Store,
35-
mode: str,
35+
mode: Optional[Literal["r", "r+", "a", "w", "w-"]],
3636
*,
3737
shape: Optional[T_Shape] = None,
3838
dtype: Optional[T_DType] = None,
@@ -69,6 +69,7 @@ def open_zarr_v3_array(
6969
path=path,
7070
)
7171

72+
assert mode is not None
7273
group = zarr.open_group(store=store, mode=mode, path=path)
7374

7475
# create/open all the arrays in the group
@@ -78,6 +79,7 @@ def open_zarr_v3_array(
7879
if mode in ("r", "r+"):
7980
ret[field] = group[field]
8081
else:
82+
assert chunks is not None
8183
ret[field] = group.create_array(
8284
field,
8385
shape=shape,

0 commit comments

Comments
 (0)