From 11499f6286209266813eac53123c264221c88b82 Mon Sep 17 00:00:00 2001 From: ozgun karagil Date: Tue, 12 Sep 2023 20:43:50 +0000 Subject: [PATCH 1/3] kwargs widget should be initialized with parameter --- fsspec/gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsspec/gui.py b/fsspec/gui.py index 2e47fdab7..1c937771b 100644 --- a/fsspec/gui.py +++ b/fsspec/gui.py @@ -262,7 +262,7 @@ def _setup(self): name="protocol", align="center", ) - self.kwargs = pn.widgets.TextInput(name="kwargs", value="{}", align="center") + self.kwargs = pn.widgets.TextInput(name="kwargs", value=self.init_kwargs, align="center") self.go = pn.widgets.Button(name="⇨", align="end", width=45) self.main = SingleSelect(size=10) self.home = pn.widgets.Button(name="🏠", width=40, height=30, align="end") From 4ca45159dcd52199821f8fa4f6f50ff4a43b4194 Mon Sep 17 00:00:00 2001 From: ozgun karagil Date: Tue, 12 Sep 2023 21:28:22 +0000 Subject: [PATCH 2/3] added test to confirm gui kwargs are passed to fs --- fsspec/tests/test_gui.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fsspec/tests/test_gui.py b/fsspec/tests/test_gui.py index f94433331..4992bfc2c 100644 --- a/fsspec/tests/test_gui.py +++ b/fsspec/tests/test_gui.py @@ -8,3 +8,13 @@ def test_basic(): gui = fsspec.gui.FileSelector() assert "url" in str(gui.panel) + + +def test_kwargs(tmpdir): + """ confirm kwargs are passed to the filesystem instance""" + import fsspec.gui + + gui = fsspec.gui.FileSelector(f"file://{tmpdir}", + kwargs="{'auto_mkdir': True}") + + assert gui.fs.auto_mkdir From 0c8e7ac9a2af4f7347f3432f76c229f5ffcd3f35 Mon Sep 17 00:00:00 2001 From: ozgun karagil Date: Wed, 13 Sep 2023 07:26:17 +0000 Subject: [PATCH 3/3] accepting black whitespace adjustments --- fsspec/gui.py | 4 +++- fsspec/tests/test_gui.py | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fsspec/gui.py b/fsspec/gui.py index 1c937771b..bbc450c77 100644 --- a/fsspec/gui.py +++ b/fsspec/gui.py @@ -262,7 +262,9 @@ def _setup(self): name="protocol", align="center", ) - self.kwargs = pn.widgets.TextInput(name="kwargs", value=self.init_kwargs, align="center") + self.kwargs = pn.widgets.TextInput( + name="kwargs", value=self.init_kwargs, align="center" + ) self.go = pn.widgets.Button(name="⇨", align="end", width=45) self.main = SingleSelect(size=10) self.home = pn.widgets.Button(name="🏠", width=40, height=30, align="end") diff --git a/fsspec/tests/test_gui.py b/fsspec/tests/test_gui.py index 4992bfc2c..00586389f 100644 --- a/fsspec/tests/test_gui.py +++ b/fsspec/tests/test_gui.py @@ -11,10 +11,9 @@ def test_basic(): def test_kwargs(tmpdir): - """ confirm kwargs are passed to the filesystem instance""" + """confirm kwargs are passed to the filesystem instance""" import fsspec.gui - gui = fsspec.gui.FileSelector(f"file://{tmpdir}", - kwargs="{'auto_mkdir': True}") - + gui = fsspec.gui.FileSelector(f"file://{tmpdir}", kwargs="{'auto_mkdir': True}") + assert gui.fs.auto_mkdir