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

Function ensure_different_files

Lib/pathlib/_os.py:233–252  ·  view source on GitHub ↗

Raise OSError(EINVAL) if both paths refer to the same file.

(source, target)

Source from the content-addressed store, hash-verified

231
232
233def ensure_different_files(source, target):
234 """
235 Raise OSError(EINVAL) if both paths refer to the same file.
236 """
237 try:
238 source_file_id = source.info._file_id
239 target_file_id = target.info._file_id
240 except AttributeError:
241 if source != target:
242 return
243 else:
244 try:
245 if source_file_id() != target_file_id():
246 return
247 except (OSError, ValueError):
248 return
249 err = OSError(EINVAL, "Source and target are the same file")
250 err.filename = str(source)
251 err.filename2 = str(target)
252 raise err
253
254
255def copy_info(info, target, follow_symlinks=True):

Callers 3

_copy_from_fileMethod · 0.90
moveMethod · 0.90
_copy_fromMethod · 0.90

Calls 1

strFunction · 0.85

Tested by

no test coverage detected