huggingface / dataset-viewer

Backend that powers the dataset viewer on Hugging Face dataset pages through a public API.
https://huggingface.co/docs/dataset-viewer
Apache License 2.0
688 stars 76 forks source link

Make StorageClient not warn when deleting a non-existing directory #2891

Closed albertvillanova closed 3 months ago

albertvillanova commented 3 months ago

Make StorageClient not warn when trying to delete a non-existing directory.

I think we should only log a warning if the directory exists and could not be deleted.

albertvillanova commented 3 months ago

@severo I have checked that both LocalFileSystem and S3FileSystem raise FileNotFoundError if the directory does not exist.

FAILED s3fs/tests/test_s3fs.py::test_rm - FileNotFoundError: ['test/nested/nonexistent']

Much better catching the specific exception, following the EAFP common Python coding style. Thanks for the hint! :hugs: