Skip to content

Commit f21f1c2

Browse files
committed
Suppress allowed exceptions instead of try-except-pass
1 parent 9812aec commit f21f1c2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/zarr/storage/_fsspec.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import warnings
44
import inspect
5+
from contextlib import suppress
56
from typing import TYPE_CHECKING, Any
67

78
from zarr.abc.store import ByteRangeRequest, Store
@@ -273,10 +274,8 @@ async def delete_dir(self, prefix: str) -> None:
273274
path_to_delete = _dereference_path(self.path, prefix)
274275

275276
if hasattr(self.fs, "_rm") and inspect.iscoroutinefunction(self.fs._rm):
276-
try:
277+
with suppress(self.allowed_exceptions):
277278
await self.fs._rm(path_to_delete, recursive=True)
278-
except self.allowed_exceptions:
279-
pass
280279
else:
281280
raise NotImplementedError("The store does not support async deletes")
282281

0 commit comments

Comments
 (0)