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

Implement Required Methods in Async Manner #721

Merged
Merged
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
18 changes: 18 additions & 0 deletions jupyter_server/services/contents/filemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,3 +906,21 @@ async def rename_file(self, old_path, new_path):
raise
except Exception as e:
raise web.HTTPError(500, "Unknown error renaming file: %s %s" % (old_path, e)) from e

async def dir_exists(self, path):
"""Does a directory exist at the given path"""
path = path.strip("/")
os_path = self._get_os_path(path=path)
return os.path.isdir(os_path)

async def file_exists(self, path):
"""Does a file exist at the given path"""
path = path.strip("/")
os_path = self._get_os_path(path)
return os.path.isfile(os_path)

async def is_hidden(self, path):
"""Is path a hidden directory or file"""
path = path.strip("/")
os_path = self._get_os_path(path=path)
return is_hidden(os_path, self.root_dir)