Skip to content
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

Minor fixes after fsspec PR #242

Merged
merged 2 commits into from
Feb 21, 2025
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 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
Loading