Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/zarr/storage/_obstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from zarr.core.config import config

if TYPE_CHECKING:
from collections.abc import AsyncGenerator, Coroutine, Iterable
from collections.abc import AsyncGenerator, Coroutine, Iterable, Sequence
from typing import Any

from obstore import ListResult, ListStream, ObjectMeta, OffsetRange, SuffixRange
Expand Down Expand Up @@ -216,14 +216,14 @@ def list(self) -> AsyncGenerator[str, None]:
# docstring inherited
import obstore as obs

objects: ListStream[list[ObjectMeta]] = obs.list(self.store)
objects: ListStream[Sequence[ObjectMeta]] = obs.list(self.store)
return _transform_list(objects)

def list_prefix(self, prefix: str) -> AsyncGenerator[str, None]:
# docstring inherited
import obstore as obs

objects: ListStream[list[ObjectMeta]] = obs.list(self.store, prefix=prefix)
objects: ListStream[Sequence[ObjectMeta]] = obs.list(self.store, prefix=prefix)
return _transform_list(objects)

def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
Expand All @@ -235,7 +235,7 @@ def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:


async def _transform_list(
list_stream: ListStream[list[ObjectMeta]],
list_stream: ListStream[Sequence[ObjectMeta]],
) -> AsyncGenerator[str, None]:
"""
Transform the result of list into an async generator of paths.
Expand All @@ -246,7 +246,8 @@ async def _transform_list(


async def _transform_list_dir(
list_result_coroutine: Coroutine[Any, Any, ListResult[list[ObjectMeta]]], prefix: str
list_result_coroutine: Coroutine[Any, Any, ListResult[Sequence[ObjectMeta]]],
prefix: str,
) -> AsyncGenerator[str, None]:
"""
Transform the result of list_with_delimiter into an async generator of paths.
Expand Down
Loading