Skip to content

Commit 216dee3

Browse files
authored
Merge pull request #9 from 1kbgz/tkp/chain
Small hotfixes for chained filesystems
2 parents baf842f + 4cac321 commit 216dee3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

fsspec_python/fs.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def __init__(self, target_protocol=None, target_options=None, fs=None, install:
2222
fs: filesystem instance The target filesystem to run against. Provide this or ``protocol``.
2323
"""
2424
super().__init__(**kwargs)
25+
2526
if fs is None and target_protocol is None:
2627
raise ValueError("Please provide filesystem instance(fs) or target_protocol")
2728
if not (fs is None) ^ (target_protocol is None):
@@ -33,7 +34,11 @@ def __init__(self, target_protocol=None, target_options=None, fs=None, install:
3334
)
3435

3536
self.fs = fs if fs is not None else filesystem(target_protocol, **target_options)
36-
self.root = kwargs.get("fo", "") or "/"
37+
if isinstance(self.fs, ChainedFileSystem):
38+
self.root = "/"
39+
kwargs.pop("fo", None)
40+
else:
41+
self.root = kwargs.get("fo", "") or "/"
3742

3843
if install:
3944
from .importer import install_importer
@@ -56,8 +61,7 @@ def __getattribute__(self, item):
5661
"exit",
5762
"fs",
5863
"protocol",
59-
"registered_name",
60-
"target_protocol",
64+
"root",
6165
}:
6266
return object.__getattribute__(self, item)
6367

0 commit comments

Comments
 (0)