Skip to content

Commit cea611b

Browse files
authored
fix obstore type hints (#3242)
* liberally add type:ignores to appease mypy * ok remove the type:ignore statements
1 parent 2331b99 commit cea611b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/zarr/storage/_obstore.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from zarr.core.config import config
1717

1818
if TYPE_CHECKING:
19-
from collections.abc import AsyncGenerator, Coroutine, Iterable
19+
from collections.abc import AsyncGenerator, Coroutine, Iterable, Sequence
2020
from typing import Any
2121

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

219-
objects: ListStream[list[ObjectMeta]] = obs.list(self.store)
219+
objects: ListStream[Sequence[ObjectMeta]] = obs.list(self.store)
220220
return _transform_list(objects)
221221

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

226-
objects: ListStream[list[ObjectMeta]] = obs.list(self.store, prefix=prefix)
226+
objects: ListStream[Sequence[ObjectMeta]] = obs.list(self.store, prefix=prefix)
227227
return _transform_list(objects)
228228

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

236236

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

247247

248248
async def _transform_list_dir(
249-
list_result_coroutine: Coroutine[Any, Any, ListResult[list[ObjectMeta]]], prefix: str
249+
list_result_coroutine: Coroutine[Any, Any, ListResult[Sequence[ObjectMeta]]],
250+
prefix: str,
250251
) -> AsyncGenerator[str, None]:
251252
"""
252253
Transform the result of list_with_delimiter into an async generator of paths.

0 commit comments

Comments
 (0)