We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5b29464 commit 34b52b2Copy full SHA for 34b52b2
sshfs/file.py
@@ -18,8 +18,7 @@ def __init__(
18
self.fs = fs
19
self.loop = fs.loop
20
21
- # TODO: support r+ / w+ / a+
22
- if mode not in {"rb", "wb", "ab"}:
+ if "t" in mode or "b" not in mode:
23
raise ValueError(f"Unsupported file mode: {mode}")
24
25
self.path = path
@@ -79,13 +78,16 @@ async def _open_file(self):
79
78
_close = _mirror_method("close")
80
81
def readable(self):
82
- return "r" in self.mode
+ return "r" in self.mode or "+" in self.mode
+
83
+ def seekable(self):
84
+ return "r" in self.mode or "w" in self.mode
85
86
def seekable(self):
87
return True
88
89
def writable(self):
- return not self.readable()
90
+ return any(x in self.mode for x in ["a", "w", "+"])
91
92
def close(self):
93
if self._closed:
0 commit comments