Skip to content

Commit

Permalink
More types
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiannucci committed Oct 21, 2024
1 parent c633f13 commit 308a508
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions virtualizarr/writers/icechunk.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, cast
from typing import TYPE_CHECKING, Sequence, cast

import numpy as np
from xarray import Dataset
Expand Down Expand Up @@ -149,13 +149,13 @@ def write_manifest_virtual_refs(
# but Icechunk need to expose a suitable API first
it = np.nditer(
[manifest._paths, manifest._offsets, manifest._lengths],
flags=[
flags=cast(Sequence[np._NDIterFlagsKind], [
"refs_ok",
"multi_index",
"c_index", # TODO is "c_index" correct? what's the convention for zarr chunk keys?
],
op_flags=[["readonly"]] * 3, # type: ignore
) # type: ignore
]),
op_flags=cast(Sequence[Sequence[np._NDIterOpFlagsKind]], [["readonly"]] * 3),
)
for path, offset, length in it:
index = it.multi_index
chunk_key = "/".join(str(i) for i in index)
Expand Down
3 changes: 2 additions & 1 deletion virtualizarr/zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ def _v3_codec_pipeline(self) -> Any:
```
"""
try:
# type: ignore[import-untyped]
from zarr.core.metadata.v3 import (
parse_codecs,
) # type: ignore[import-untyped]
)
except ImportError:
raise ImportError("zarr v3 is required to generate v3 codec pipelines")

Expand Down

0 comments on commit 308a508

Please sign in to comment.