[ez] Fsspec Filesystem ls details should be false (#152693)

Summary: The default action for ls for the local filesystem is with details=False, but this isn't the case for all filesystems (eg. huggingface), so setting details=False explicitly so that the return type of ls is a list of strings, and not a list of dictionaries, which is what it would be with details=True.

Test Plan: tested in notebook

Differential Revision: D74080572

Pull Request resolved: https://github.com/pytorch/pytorch/pull/152693
Approved by: https://github.com/joecummings
This commit is contained in:
Ankita George
2025-05-06 01:02:09 +00:00
committed by PyTorch MergeBot
parent 4979ca5ffa
commit 721fdfa32d

View File

@ -92,7 +92,9 @@ class FileSystem(FileSystemBase):
self.fs.rm(path)
def ls(self, path: Union[str, os.PathLike]) -> list[str]:
return self.fs.ls(path)
# setting detail to False explictly to keep the list[str] return type,
# instead of the list[Dict] return type when detail=True
return self.fs.ls(path, detail=False)
# TODO: add the dcp.async_save mixin