MCPcopy Index your code
hub / github.com/python/cpython / copy

Function copy

Lib/shutil.py:475–491  ·  view source on GitHub ↗

Copy data and mode bits ("cp src dst"). Return the file's destination. The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P src dst". If source and destination are the same file, a SameFileError will be raised

(src, dst, *, follow_symlinks=True)

Source from the content-addressed store, hash-verified

473 raise
474
475def copy(src, dst, *, follow_symlinks=True):
476 """Copy data and mode bits ("cp src dst"). Return the file's destination.
477
478 The destination may be a directory.
479
480 If follow_symlinks is false, symlinks won't be followed. This
481 resembles GNU's "cp -P src dst".
482
483 If source and destination are the same file, a SameFileError will be
484 raised.
485
486 """
487 if os.path.isdir(dst):
488 dst = os.path.join(dst, os.path.basename(src))
489 copyfile(src, dst, follow_symlinks=follow_symlinks)
490 copymode(src, dst, follow_symlinks=follow_symlinks)
491 return dst
492
493def copy2(src, dst, *, follow_symlinks=True):
494 """Copy data and metadata. Return the file's destination.

Callers 1

copy_includesFunction · 0.90

Calls 5

copyfileFunction · 0.85
copymodeFunction · 0.85
isdirMethod · 0.45
joinMethod · 0.45
basenameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…