Skip to content

Commit

Permalink
modified method functionality added
Browse files Browse the repository at this point in the history
  • Loading branch information
benrutter committed Apr 19, 2024
1 parent c127831 commit 05887cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sshfs/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ async def _info(self, path, **kwargs):
info["name"] = path
return info

@wrap_exceptions
async def _modified(self, path: str, **kwargs) -> datetime:
path_info = await self._info(path)
return path_info["mtime"]

modified = sync_wrapper(_modified)

@wrap_exceptions
async def _mv(self, lpath, rpath, **kwargs):
async with self._pool.get() as channel:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_sshfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import tempfile
import warnings
from concurrent import futures
from datetime import datetime
from pathlib import Path

import fsspec
Expand Down Expand Up @@ -337,3 +338,8 @@ def test_concurrency_for_raw_commands(fs, remote_dir):
]
for future in futures.as_completed(cp_futures):
future.result()


def test_modified(fs, remote_dir):
modified = fs.modified(remote_dir)
assert isinstance(modified, datetime)

0 comments on commit 05887cb

Please sign in to comment.