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
@@ -329,16 +329,19 @@ def supports_listing(self) -> bool:
329329 ...
330330
331331 @abstractmethod
332- def list (self ) -> AsyncGenerator [str ]:
332+ def list (self ) -> AsyncIterator [str ]:
333333 """Retrieve all keys in the store.
334334
335335 Returns
336336 -------
337- AsyncGenerator [str, None ]
337+ AsyncIterator [str]
338338 """
339+ # This method should be async, like overridden methods in child classes.
340+ # However, that's not straightforward:
341+ # https://stackoverflow.com/questions/68905848
339342
340343 @abstractmethod
341- def list_prefix (self , prefix : str ) -> AsyncGenerator [str ]:
344+ def list_prefix (self , prefix : str ) -> AsyncIterator [str ]:
342345 """
343346 Retrieve all keys in the store that begin with a given prefix. Keys are returned relative
344347 to the root of the store.
@@ -349,11 +352,14 @@ def list_prefix(self, prefix: str) -> AsyncGenerator[str]:
349352
350353 Returns
351354 -------
352- AsyncGenerator [str, None ]
355+ AsyncIterator [str]
353356 """
357+ # This method should be async, like overridden methods in child classes.
358+ # However, that's not straightforward:
359+ # https://stackoverflow.com/questions/68905848
354360
355361 @abstractmethod
356- def list_dir (self , prefix : str ) -> AsyncGenerator [str ]:
362+ def list_dir (self , prefix : str ) -> AsyncIterator [str ]:
357363 """
358364 Retrieve all keys and prefixes with a given prefix and which do not contain the character
359365 “/” after the given prefix.
@@ -364,8 +370,11 @@ def list_dir(self, prefix: str) -> AsyncGenerator[str]:
364370
365371 Returns
366372 -------
367- AsyncGenerator [str, None ]
373+ AsyncIterator [str]
368374 """
375+ # This method should be async, like overridden methods in child classes.
376+ # However, that's not straightforward:
377+ # https://stackoverflow.com/questions/68905848
369378
370379 async def delete_dir (self , prefix : str ) -> None :
371380 """
0 commit comments