Skip to content

Commit 4bedb7d

Browse files
authored
datasets.filesystems: fix is_remote_filesystems (#6334)
Close #6330 `fsspec.implementations.LocalFilesystem.protocol` was changed from `str` "file" to `tuple[str,...]` ("file", "local") in `fsspec>=2023.10.0` This commit supports both styles.
1 parent 87ed467 commit 4bedb7d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/datasets/filesystems/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ def is_remote_filesystem(fs: fsspec.AbstractFileSystem) -> bool:
5151
fs (`fsspec.spec.AbstractFileSystem`):
5252
An abstract super-class for pythonic file-systems, e.g. `fsspec.filesystem(\'file\')` or [`datasets.filesystems.S3FileSystem`].
5353
"""
54-
if fs is not None and fs.protocol != "file":
55-
return True
56-
else:
57-
return False
54+
if fs is not None:
55+
protocols = (p,) if isinstance(p := fs.protocol, str) else p
56+
if "file" not in protocols:
57+
return True
58+
return False
5859

5960

6061
def rename(fs: fsspec.AbstractFileSystem, src: str, dst: str):

0 commit comments

Comments
 (0)