Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Suppress only builtins.FileNotFoundError in obstore.delete adapter
  • Loading branch information
lukasbindreiter committed Jun 24, 2025
commit 76a04977e541308e0973b464e522dacc9264bf69
10 changes: 4 additions & 6 deletions src/zarr/storage/_obstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,15 @@
async def delete(self, key: str) -> None:
# docstring inherited
import obstore as obs
from obstore.exceptions import NotFoundError

self._check_writable()

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

Check warning on line 197 in src/zarr/storage/_obstore.py

View check run for this annotation

Codecov / codecov/patch

src/zarr/storage/_obstore.py#L196-L197

Added lines #L196 - L197 were not covered by tests

@property
def supports_partial_writes(self) -> bool:
Expand Down
Loading