From 69939e56c326a1a145b6d9cde48741d14539783c Mon Sep 17 00:00:00 2001 From: Davis Vann Bennett Date: Mon, 14 Jul 2025 20:49:21 +0200 Subject: [PATCH 1/2] liberally add type:ignores to appease mypy --- src/zarr/storage/_obstore.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/zarr/storage/_obstore.py b/src/zarr/storage/_obstore.py index 1b822a919e..fbd0a4f020 100644 --- a/src/zarr/storage/_obstore.py +++ b/src/zarr/storage/_obstore.py @@ -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 @@ -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) # type: ignore[type-var, assignment] 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) # type: ignore[assignment, type-var] return _transform_list(objects) def list_dir(self, prefix: str) -> AsyncGenerator[str, None]: @@ -231,11 +231,11 @@ def list_dir(self, prefix: str) -> AsyncGenerator[str, None]: import obstore as obs coroutine = obs.list_with_delimiter_async(self.store, prefix=prefix) - return _transform_list_dir(coroutine, prefix) + return _transform_list_dir(coroutine, prefix) # type: ignore[arg-type] async def _transform_list( - list_stream: ListStream[list[ObjectMeta]], + list_stream: ListStream[Sequence[ObjectMeta]], # type: ignore[type-var] ) -> AsyncGenerator[str, None]: """ Transform the result of list into an async generator of paths. @@ -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]]], # type: ignore[type-var] + prefix: str, ) -> AsyncGenerator[str, None]: """ Transform the result of list_with_delimiter into an async generator of paths. From bc46c696696a387c02989fc78c3c6517aedefdb5 Mon Sep 17 00:00:00 2001 From: Davis Vann Bennett Date: Mon, 14 Jul 2025 20:53:35 +0200 Subject: [PATCH 2/2] ok remove the type:ignore statements --- src/zarr/storage/_obstore.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/zarr/storage/_obstore.py b/src/zarr/storage/_obstore.py index fbd0a4f020..cbe037d86b 100644 --- a/src/zarr/storage/_obstore.py +++ b/src/zarr/storage/_obstore.py @@ -216,14 +216,14 @@ def list(self) -> AsyncGenerator[str, None]: # docstring inherited import obstore as obs - objects: ListStream[Sequence[ObjectMeta]] = obs.list(self.store) # type: ignore[type-var, assignment] + 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[Sequence[ObjectMeta]] = obs.list(self.store, prefix=prefix) # type: ignore[assignment, type-var] + objects: ListStream[Sequence[ObjectMeta]] = obs.list(self.store, prefix=prefix) return _transform_list(objects) def list_dir(self, prefix: str) -> AsyncGenerator[str, None]: @@ -231,11 +231,11 @@ def list_dir(self, prefix: str) -> AsyncGenerator[str, None]: import obstore as obs coroutine = obs.list_with_delimiter_async(self.store, prefix=prefix) - return _transform_list_dir(coroutine, prefix) # type: ignore[arg-type] + return _transform_list_dir(coroutine, prefix) async def _transform_list( - list_stream: ListStream[Sequence[ObjectMeta]], # type: ignore[type-var] + list_stream: ListStream[Sequence[ObjectMeta]], ) -> AsyncGenerator[str, None]: """ Transform the result of list into an async generator of paths. @@ -246,7 +246,7 @@ async def _transform_list( async def _transform_list_dir( - list_result_coroutine: Coroutine[Any, Any, ListResult[Sequence[ObjectMeta]]], # type: ignore[type-var] + list_result_coroutine: Coroutine[Any, Any, ListResult[Sequence[ObjectMeta]]], prefix: str, ) -> AsyncGenerator[str, None]: """