- Path.copying(lock=True, timeout=1, method: ~typing.Callable[[~mutapath.immutapath.Path, ~mutapath.immutapath.Path], ~mutapath.immutapath.Path] = <function copy>)
Create a copying context for this immutable path. The external value is only changed if the copying succeeds.
timeout – the timeout in seconds how long the lock file should be acquired
lock – if the source file should be locked as long as this context is open
method – an alternative method that copies the path and returns the new path (e.g., shutil.copy2)
>>> with Path('/home/doe/folder/a.txt').copying() as mut: ... mut.stem = "b" Path('/home/doe/folder/b.txt')