Skip to content

Commit

Permalink
Minor fixes after fsspec PR
Browse files Browse the repository at this point in the history
  • Loading branch information
vidartf committed Feb 20, 2025
1 parent cf9e804 commit 0aa8978
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion js/schema/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"pattern": "^.+?:\/\/([^:]*:.*@.*|[^@]*)$"
},
"type": {
"description": "Directory to be first opened (e.g., myDir/mySubdir)",
"description": "The backend type to use for the resource (PyFS or fsspec)",
"type": "string",
"enum": ["pyfs", "fsspec"],
"default": "pyfs"
Expand Down
2 changes: 1 addition & 1 deletion js/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const browser: JupyterFrontEndPlugin<ITreeFinderMain> = {

let columns = settings?.composite.display_columns as Array<keyof ContentsProxy.IJupyterContentRow> ?? ["size"];

const sharedSidebarProps: Omit<Omit<TreeFinderSidebar.ISidebarProps, "type">, "url"> = {
const sharedSidebarProps: Omit<TreeFinderSidebar.ISidebarProps, "type" | "url"> = {
app,
manager,
paths,
Expand Down
8 changes: 1 addition & 7 deletions jupyterfs/fs_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __enter__(self):

def __exit__(self, *args):
if self.type == "pyfs":
self.fs.__exit__(*args)
return self.fs.__exit__(*args)

def _wrap_path(self, path):
if self.type == "pyfs":
Expand Down Expand Up @@ -89,20 +89,14 @@ def writetext(self, path, data):

def exists(self, path):
path = self._wrap_path(path)
if self.type == "pyfs":
return self.fs.exists(path)
return self.fs.exists(path)

def isdir(self, path):
path = self._wrap_path(path)
if self.type == "pyfs":
return self.fs.isdir(path)
return self.fs.isdir(path)

def isfile(self, path):
path = self._wrap_path(path)
if self.type == "pyfs":
return self.fs.isfile(path)
return self.fs.isfile(path)

def listdir(self, path):
Expand Down
3 changes: 3 additions & 0 deletions jupyterfs/metamanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def initResource(self, *resources, options={}):
manager_type = FSManager
elif resource["type"] == "fsspec":
manager_type = FSSpecManager
else:
# Ensure we don't use manager_type from previous loop iteration
raise FileSystemLoadError(f"Unrecognized filesystem type {resource["type"]!r}")

managers[_hash] = manager_type.create(
urlSubbed,
Expand Down

0 comments on commit 0aa8978

Please sign in to comment.