Skip to content

Commit 76a0497

Browse files
Suppress only builtins.FileNotFoundError in obstore.delete adapter
1 parent e740027 commit 76a0497

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/zarr/storage/_obstore.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,14 @@ def supports_deletes(self) -> bool:
186186
async def delete(self, key: str) -> None:
187187
# docstring inherited
188188
import obstore as obs
189-
from obstore.exceptions import NotFoundError
190189

191190
self._check_writable()
192191

193-
# Some stores such as local filesystems, GCP and Azure raise an error
192+
# Some obstore stores such as local filesystems, GCP and Azure raise an error
194193
# when deleting a non-existent key, while others such as S3 and in-memory do
195-
# not. We suppress the error to make the behavior consistent across all stores
196-
# currently obstore raises FileNotFoundError, but in the future might raise
197-
# NotFoundError instead, so let's suppress that too
198-
with contextlib.suppress(FileNotFoundError, NotFoundError):
194+
# not. We suppress the error to make the behavior consistent across all obstore
195+
# stores. This is also in line with the behavior of the other Zarr store adapters.
196+
with contextlib.suppress(FileNotFoundError):
199197
await obs.delete_async(self.store, key)
200198

201199
@property

0 commit comments

Comments
 (0)