Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions sshfs/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ def __init__(
self.fs = fs
self.loop = fs.loop

# TODO: support r+ / w+ / a+

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isidentical @efiop - if you remember anything about this - it would be helpful

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
Expand Down Expand Up @@ -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:
Expand Down