@@ -280,24 +280,25 @@ async def set_partial_values(
280280 # docstring inherited
281281 raise NotImplementedError
282282
283- async def list (self ) -> AsyncGenerator [str ]:
283+ async def list (self ) -> AsyncIterator [str ]:
284284 # docstring inherited
285285 allfiles = await self .fs ._find (self .path , detail = False , withdirs = False )
286- for onefile in (a .replace (self .path + "/" , "" ) for a in allfiles ):
287- yield onefile
286+ return (onefile for onefile in (a .replace (self .path + "/" , "" ) for a in allfiles ))
288287
289- async def list_dir (self , prefix : str ) -> AsyncGenerator [str ]:
288+ async def list_dir (self , prefix : str ) -> AsyncIterator [str ]:
290289 # docstring inherited
291290 prefix = f"{ self .path } /{ prefix .rstrip ('/' )} "
292291 try :
293292 allfiles = await self .fs ._ls (prefix , detail = False )
294293 except FileNotFoundError :
295- return
296- for onefile in (a .replace (prefix + "/" , "" ) for a in allfiles ):
297- yield onefile .removeprefix (self .path ).removeprefix ("/" )
294+ return iter ([])
295+ return (
296+ onefile .removeprefix (self .path ).removeprefix ("/" )
297+ for onefile in (a .replace (prefix + "/" , "" ) for a in allfiles )
298+ )
298299
299- async def list_prefix (self , prefix : str ) -> AsyncGenerator [str ]:
300+ async def list_prefix (self , prefix : str ) -> AsyncIterator [str ]:
300301 # docstring inherited
301302 find_str = f"{ self .path } /{ prefix } "
302- for onefile in await self .fs ._find (find_str , detail = False , maxdepth = None , withdirs = False ):
303- yield onefile .removeprefix (find_str )
303+ allfiles = await self .fs ._find (find_str , detail = False , maxdepth = None , withdirs = False )
304+ return ( onefile .removeprefix (find_str ) for onefile in allfiles )
0 commit comments