Skip to content

Commit 140d52e

Browse files
jhamet93Josh Hamet
andauthored
Implement Required Methods in Async Manner (#721)
Co-authored-by: Josh Hamet <[email protected]>
1 parent fb25932 commit 140d52e

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

jupyter_server/services/contents/filemanager.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,3 +907,21 @@ async def rename_file(self, old_path, new_path):
907907
raise
908908
except Exception as e:
909909
raise web.HTTPError(500, "Unknown error renaming file: %s %s" % (old_path, e)) from e
910+
911+
async def dir_exists(self, path):
912+
"""Does a directory exist at the given path"""
913+
path = path.strip("/")
914+
os_path = self._get_os_path(path=path)
915+
return os.path.isdir(os_path)
916+
917+
async def file_exists(self, path):
918+
"""Does a file exist at the given path"""
919+
path = path.strip("/")
920+
os_path = self._get_os_path(path)
921+
return os.path.isfile(os_path)
922+
923+
async def is_hidden(self, path):
924+
"""Is path a hidden directory or file"""
925+
path = path.strip("/")
926+
os_path = self._get_os_path(path=path)
927+
return is_hidden(os_path, self.root_dir)

0 commit comments

Comments
 (0)