Skip to content

Commit 8b9fe85

Browse files
benrutterefiop
andauthored
modified method functionality added (#44)
Co-authored-by: Ruslan Kuprieiev <[email protected]>
1 parent 807e00b commit 8b9fe85

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

sshfs/spec.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ async def _info(self, path, **kwargs):
148148
info["name"] = path
149149
return info
150150

151+
@wrap_exceptions
152+
async def _modified(self, path: str, **kwargs) -> datetime:
153+
path_info = await self._info(path)
154+
return path_info["mtime"]
155+
156+
modified = sync_wrapper(_modified)
157+
151158
@wrap_exceptions
152159
async def _mv(self, lpath, rpath, **kwargs):
153160
async with self._pool.get() as channel:

tests/test_sshfs.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import tempfile
55
import warnings
66
from concurrent import futures
7+
from datetime import datetime
78
from pathlib import Path
89

910
import fsspec
@@ -339,6 +340,11 @@ def test_concurrency_for_raw_commands(fs, remote_dir):
339340
future.result()
340341

341342

343+
def test_modified(fs, remote_dir):
344+
modified = fs.modified(remote_dir)
345+
assert isinstance(modified, datetime)
346+
347+
342348
def test_cat_file_sync(fs, remote_dir):
343349
# Define the content to write to the test file
344350
test_content = b"Test content for cat_file"

0 commit comments

Comments
 (0)