66from typing import TYPE_CHECKING , NamedTuple , Protocol , runtime_checkable
77
88if TYPE_CHECKING :
9- from collections .abc import AsyncGenerator , Iterable
9+ from collections .abc import AsyncGenerator , AsyncIterator , Iterable
1010 from types import TracebackType
1111 from typing import Any , Self , TypeAlias
1212
@@ -284,7 +284,6 @@ async def _set_many(self, values: Iterable[tuple[str, Buffer]]) -> None:
284284 Insert multiple (key, value) pairs into storage.
285285 """
286286 await gather (* starmap (self .set , values ))
287- return
288287
289288 @property
290289 @abstractmethod
@@ -330,17 +329,19 @@ def supports_listing(self) -> bool:
330329 ...
331330
332331 @abstractmethod
333- def list (self ) -> AsyncGenerator [str , None ]:
332+ def list (self ) -> AsyncIterator [str ]:
334333 """Retrieve all keys in the store.
335334
336335 Returns
337336 -------
338- AsyncGenerator [str, None ]
337+ AsyncIterator [str]
339338 """
340- ...
339+ # This method should be async, like overridden methods in child classes.
340+ # However, that's not straightforward:
341+ # https://stackoverflow.com/questions/68905848
341342
342343 @abstractmethod
343- def list_prefix (self , prefix : str ) -> AsyncGenerator [str , None ]:
344+ def list_prefix (self , prefix : str ) -> AsyncIterator [str ]:
344345 """
345346 Retrieve all keys in the store that begin with a given prefix. Keys are returned relative
346347 to the root of the store.
@@ -351,12 +352,14 @@ def list_prefix(self, prefix: str) -> AsyncGenerator[str, None]:
351352
352353 Returns
353354 -------
354- AsyncGenerator [str, None ]
355+ AsyncIterator [str]
355356 """
356- ...
357+ # This method should be async, like overridden methods in child classes.
358+ # However, that's not straightforward:
359+ # https://stackoverflow.com/questions/68905848
357360
358361 @abstractmethod
359- def list_dir (self , prefix : str ) -> AsyncGenerator [str , None ]:
362+ def list_dir (self , prefix : str ) -> AsyncIterator [str ]:
360363 """
361364 Retrieve all keys and prefixes with a given prefix and which do not contain the character
362365 “/” after the given prefix.
@@ -367,9 +370,11 @@ def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
367370
368371 Returns
369372 -------
370- AsyncGenerator [str, None ]
373+ AsyncIterator [str]
371374 """
372- ...
375+ # This method should be async, like overridden methods in child classes.
376+ # However, that's not straightforward:
377+ # https://stackoverflow.com/questions/68905848
373378
374379 async def delete_dir (self , prefix : str ) -> None :
375380 """
0 commit comments