Skip to content

Commit ef508c2

Browse files
committed
Cleanup redundant code in FS.move and MemoryFS.move
1 parent 54f643d commit ef508c2

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

fs/base.py

-2
Original file line numberDiff line numberDiff line change
@@ -1100,8 +1100,6 @@ def movedir(self, src_path, dst_path, create=False, preserve_time=False):
11001100
with self._lock:
11011101
_src_path = self.validatepath(src_path)
11021102
_dst_path = self.validatepath(dst_path)
1103-
if _src_path == _dst_path:
1104-
raise errors.IllegalDestination(dst_path)
11051103
if isbase(_src_path, _dst_path):
11061104
raise errors.IllegalDestination(dst_path)
11071105
if not create and not self.exists(dst_path):

fs/memoryfs.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def movedir(self, src_path, dst_path, create=False, preserve_time=False):
485485
src_dir, src_name = split(_src_path)
486486

487487
# move a dir onto or into itself
488-
if _src_path == _dst_path or isbase(_src_path, _dst_path):
488+
if isbase(_src_path, _dst_path):
489489
raise errors.IllegalDestination(dst_path)
490490

491491
with self._lock:

0 commit comments

Comments
 (0)