diff --git a/sshfs/file.py b/sshfs/file.py index 349f64d..68f7ee9 100644 --- a/sshfs/file.py +++ b/sshfs/file.py @@ -18,8 +18,7 @@ def __init__( self.fs = fs self.loop = fs.loop - # TODO: support r+ / w+ / a+ - if mode not in {"rb", "wb", "ab"}: + if "t" in mode or "b" not in mode: raise ValueError(f"Unsupported file mode: {mode}") self.path = path @@ -79,10 +78,13 @@ async def _open_file(self): _close = _mirror_method("close") def readable(self): - return "r" in self.mode + return "r" in self.mode or "+" in self.mode + + def seekable(self): + return "r" in self.mode or "w" in self.mode def writable(self): - return not self.readable() + return any(x in self.mode for x in ["a", "w", "+"]) def close(self): if self._closed: