Skip to content

Commit 7690a43

Browse files
authored
Directly move Jupyter file (#1937)
Instead of the default implementaion which does copy and delete
1 parent be8c3c1 commit 7690a43

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

fsspec/implementations/jupyter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ def mkdir(self, path, create_parents=True, **kwargs):
9898
}
9999
self.session.put(f"{self.url}/{path}", json=json)
100100

101+
def mv(self, path1, path2, recursive=False, maxdepth=None, **kwargs):
102+
if path1 == path2:
103+
return
104+
self.session.patch(f"{self.url}/{path1}", json={"path": path2})
105+
101106
def _rm(self, path):
102107
path = self._strip_protocol(path)
103108
self.session.delete(f"{self.url}/{path}")

fsspec/implementations/tests/test_jupyter.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,7 @@ def test_simple(jupyter):
6060
fs.rm("afile")
6161

6262
assert "afile" not in os.listdir(d)
63+
64+
fs.mv("bfile", "cfile")
65+
assert "cfile" in os.listdir(d)
66+
assert "bfile" not in os.listdir(d)

0 commit comments

Comments
 (0)