Skip to content

Commit 3631ea0

Browse files
authored
Merge pull request #27 from mathematica-org/exists-function
Add Exists function to SFTP client
2 parents c894b2d + 3fa2f49 commit 3631ea0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/dkany/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.2"
1+
__version__ = "0.1.3"

src/dkany/data_hosts/sftp.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,10 @@ def __init__(
4444
raise SystemError(
4545
f"Could not change to base_path {default_remote_path or '/'}"
4646
) from e
47+
48+
def exists(self, path: str) -> bool:
49+
try:
50+
self.connection.stat(path)
51+
return True
52+
except FileNotFoundError:
53+
return False

0 commit comments

Comments
 (0)