Skip to content

Commit

Permalink
Allow non-str kwargs to FileSelector (#1437)
Browse files Browse the repository at this point in the history
  • Loading branch information
martindurant authored Nov 24, 2023
1 parent f7b454e commit 3c247f5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fsspec/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def __init__(self, url=None, filters=None, ignore=None, kwargs=None):
else:
self.init_protocol, url = "file", os.getcwd()
self.init_url = url
self.init_kwargs = kwargs or "{}"
self.init_kwargs = (kwargs if isinstance(kwargs, str) else str(kwargs)) or "{}"
self.filters = filters
self.ignore = [re.compile(i) for i in ignore or []]
self._fs = None
Expand Down
1 change: 1 addition & 0 deletions fsspec/implementations/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,7 @@ def cat(self, path, recursive=False, on_error="raise", **kwargs):
raise NotImplementedError
if isinstance(path, list) and (recursive or any("*" in p for p in path)):
raise NotImplementedError
# TODO: if references is lazy, pre-fetch all paths in batch before access
proto_dict = _protocol_groups(path, self.references)
out = {}
for proto, paths in proto_dict.items():
Expand Down
4 changes: 4 additions & 0 deletions fsspec/tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ def test_kwargs(tmpdir):
gui = fsspec.gui.FileSelector(f"file://{tmpdir}", kwargs="{'auto_mkdir': True}")

assert gui.fs.auto_mkdir

gui = fsspec.gui.FileSelector(f"file://{tmpdir}", kwargs={"auto_mkdir": True})

assert gui.fs.auto_mkdir

0 comments on commit 3c247f5

Please sign in to comment.