MCPcopy Index your code
hub / github.com/RustPython/RustPython / move

Method move

Lib/pathlib/__init__.py:1171–1192  ·  view source on GitHub ↗

Recursively move this file or directory tree to the given destination.

(self, target)

Source from the content-addressed store, hash-verified

1169 copy_info(source.info, self, follow_symlinks=False)
1170
1171 def move(self, target):
1172 """
1173 Recursively move this file or directory tree to the given destination.
1174 """
1175 # Use os.replace() if the target is os.PathLike and on the same FS.
1176 try:
1177 target = self.with_segments(target)
1178 except TypeError:
1179 pass
1180 else:
1181 ensure_different_files(self, target)
1182 try:
1183 os.replace(self, target)
1184 except OSError as err:
1185 if err.errno != EXDEV:
1186 raise
1187 else:
1188 return target.joinpath() # Empty join to ensure fresh metadata.
1189 # Fall back to copy+delete.
1190 target = self.copy(target, follow_symlinks=False, preserve_metadata=True)
1191 self._delete()
1192 return target
1193
1194 def move_into(self, target_dir):
1195 """

Callers 1

move_intoMethod · 0.95

Calls 6

copyMethod · 0.95
_deleteMethod · 0.95
ensure_different_filesFunction · 0.90
with_segmentsMethod · 0.45
replaceMethod · 0.45
joinpathMethod · 0.45

Tested by

no test coverage detected