@@ -250,7 +250,6 @@ async def _set_many(self, values: Iterable[tuple[str, Buffer]]) -> None:
250250 Insert multiple (key, value) pairs into storage.
251251 """
252252 await gather (* starmap (self .set , values ))
253- return
254253
255254 @property
256255 @abstractmethod
@@ -296,20 +295,19 @@ def supports_listing(self) -> bool:
296295 ...
297296
298297 @abstractmethod
299- def list (self ) -> AsyncGenerator [str , None ]:
298+ def list (self ) -> AsyncGenerator [str ]:
300299 """Retrieve all keys in the store.
301300
302301 Returns
303302 -------
304303 AsyncGenerator[str, None]
305304 """
306- ...
307305
308306 @abstractmethod
309- def list_prefix (self , prefix : str ) -> AsyncGenerator [str , None ]:
307+ def list_prefix (self , prefix : str ) -> AsyncGenerator [str ]:
310308 """
311- Retrieve all keys in the store that begin with a given prefix. Keys are returned as
312- absolute paths (i.e. including the prefix) .
309+ Retrieve all keys in the store that begin with a given prefix. Keys are returned relative
310+ to the root of the store .
313311
314312 Parameters
315313 ----------
@@ -319,10 +317,9 @@ def list_prefix(self, prefix: str) -> AsyncGenerator[str, None]:
319317 -------
320318 AsyncGenerator[str, None]
321319 """
322- ...
323320
324321 @abstractmethod
325- def list_dir (self , prefix : str ) -> AsyncGenerator [str , None ]:
322+ def list_dir (self , prefix : str ) -> AsyncGenerator [str ]:
326323 """
327324 Retrieve all keys and prefixes with a given prefix and which do not contain the character
328325 “/” after the given prefix.
@@ -335,7 +332,20 @@ def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
335332 -------
336333 AsyncGenerator[str, None]
337334 """
338- ...
335+
336+ async def delete_dir (self , prefix : str ) -> None :
337+ """
338+ Remove all keys and prefixes in the store that begin with a given prefix.
339+ """
340+ if not self .supports_deletes :
341+ raise NotImplementedError
342+ if not self .supports_listing :
343+ raise NotImplementedError
344+ self ._check_writable ()
345+ if not prefix .endswith ("/" ):
346+ prefix += "/"
347+ async for key in self .list_prefix (prefix ):
348+ await self .delete (key )
339349
340350 async def delete_dir (self , prefix : str ) -> None :
341351 """
0 commit comments