@@ -342,8 +342,8 @@ def list(self) -> AsyncGenerator[str, None]:
342342 @abstractmethod
343343 def list_prefix (self , prefix : str ) -> AsyncGenerator [str , None ]:
344344 """
345- Retrieve all keys in the store that begin with a given prefix. Keys are returned with the
346- common leading prefix removed .
345+ Retrieve all keys in the store that begin with a given prefix. Keys are returned as
346+ absolute paths (i.e. including the prefix) .
347347
348348 Parameters
349349 ----------
@@ -371,7 +371,7 @@ def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
371371 """
372372 ...
373373
374- async def delete_dir (self , prefix : str , recursive : bool = True ) -> None :
374+ async def delete_dir (self , prefix : str ) -> None :
375375 """
376376 Remove all keys and prefixes in the store that begin with a given prefix.
377377 """
@@ -380,24 +380,8 @@ async def delete_dir(self, prefix: str, recursive: bool = True) -> None:
380380 if not self .supports_listing :
381381 raise NotImplementedError
382382 self ._check_writable ()
383- if recursive :
384- if not prefix .endswith ("/" ):
385- prefix += "/"
386- async for key in self .list_prefix (prefix ):
387- await self .delete (key )
388- else :
389- async for key in self .list_dir (prefix ):
390- await self .delete (f"{ prefix } /{ key } " )
391-
392- async def delete_prefix (self , prefix : str ) -> None :
393- """
394- Remove all keys in the store that begin with a given prefix.
395- """
396- if not self .supports_deletes :
397- raise NotImplementedError
398- if not self .supports_listing :
399- raise NotImplementedError
400- self ._check_writable ()
383+ if not prefix .endswith ("/" ):
384+ prefix += "/"
401385 async for key in self .list_prefix (prefix ):
402386 await self .delete (key )
403387
0 commit comments