Skip to content

Commit

Permalink
Remove mv_file(): not in the specs, while mv() is (fsspec#1585)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilshamerlinck authored Apr 25, 2024
1 parent 69f4fe8 commit 05e8858
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 0 additions & 2 deletions fsspec/implementations/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ def mv(self, path1, path2, **kwargs):
path2 = self._strip_protocol(path2).rstrip("/")
self.fs.move(path1, path2)

mv_file = mv

@wrap_exceptions
def rm_file(self, path):
path = self._strip_protocol(path)
Expand Down
4 changes: 2 additions & 2 deletions fsspec/implementations/dirfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ def makedirs(self, path, *args, **kwargs):
def rmdir(self, path):
return self.fs.rmdir(self._join(path))

def mv_file(self, path1, path2, **kwargs):
return self.fs.mv_file(
def mv(self, path1, path2, **kwargs):
return self.fs.mv(
self._join(path1),
self._join(path2),
**kwargs,
Expand Down
2 changes: 1 addition & 1 deletion fsspec/implementations/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def get_file(self, path1, path2, callback=None, **kwargs):
def put_file(self, path1, path2, callback=None, **kwargs):
return self.cp_file(path1, path2, **kwargs)

def mv_file(self, path1, path2, **kwargs):
def mv(self, path1, path2, **kwargs):
path1 = self._strip_protocol(path1, remove_trailing_slash=True)
path2 = self._strip_protocol(path2, remove_trailing_slash=True)
shutil.move(path1, path2)
Expand Down
8 changes: 4 additions & 4 deletions fsspec/implementations/tests/test_dirfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,10 @@ def test_rmdir(mocker, dirfs):
dirfs.fs.rmdir.assert_called_once_with(f"{PATH}/dir")


def test_mv_file(mocker, dirfs):
dirfs.fs.mv_file = mocker.Mock()
dirfs.mv_file("one", "two", **KWARGS)
dirfs.fs.mv_file.assert_called_once_with(f"{PATH}/one", f"{PATH}/two", **KWARGS)
def test_mv(mocker, dirfs):
dirfs.fs.mv = mocker.Mock()
dirfs.mv("one", "two", **KWARGS)
dirfs.fs.mv.assert_called_once_with(f"{PATH}/one", f"{PATH}/two", **KWARGS)


def test_touch(mocker, dirfs):
Expand Down

0 comments on commit 05e8858

Please sign in to comment.