Skip to content

Allow non-str kwargs to FileSelector #1437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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