| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Add a `Path.copy()` method that copies a file to a target file or directory using `shutil.copy2()`. In the private pathlib ABCs, we add a version that supports copying from one instance of `PathBase` to another. We don't copy metadata, because doing so probably requires new APIs that haven't been designed yet.
|
Marking this PR as a draft, because I think we'll need to introduce os.copy() first. |
Sorry, something went wrong.
There was a problem hiding this comment.
Just some thoughts, nothing I'd necessarily block the PR on. I like the way it looks overall!
Sorry, something went wrong.
Co-authored-by: Eryk Sun <eryksun@gmail.com>
|
Looks fine to me, but I only quickly reskimmed it. I'll be away for the next few days, so don't wait for me if you guys think it's ready. |
Sorry, something went wrong.
Add a `Path.copy()` method that copies the content of one file to another. This method is similar to `shutil.copyfile()` but differs in the following ways: - Uses `fcntl.FICLONE` where available (see pythonGH-81338) - Uses `os.copy_file_range` where available (see pythonGH-81340) - Uses `_winapi.CopyFile2` where available, even though this copies more metadata than the other implementations. This makes `WindowsPath.copy()` more similar to `shutil.copy2()`. The method is presently _less_ specified than the `shutil` functions to allow OS-specific optimizations that might copy more or less metadata. Incorporates code from pythonGH-81338 and pythonGH-93152. Co-authored-by: Eryk Sun <eryksun@gmail.com>
Add a `Path.copy()` method that copies the content of one file to another. This method is similar to `shutil.copyfile()` but differs in the following ways: - Uses `fcntl.FICLONE` where available (see pythonGH-81338) - Uses `os.copy_file_range` where available (see pythonGH-81340) - Uses `_winapi.CopyFile2` where available, even though this copies more metadata than the other implementations. This makes `WindowsPath.copy()` more similar to `shutil.copy2()`. The method is presently _less_ specified than the `shutil` functions to allow OS-specific optimizations that might copy more or less metadata. Incorporates code from pythonGH-81338 and pythonGH-93152. Co-authored-by: Eryk Sun <eryksun@gmail.com>
Add a `Path.copy()` method that copies the content of one file to another. This method is similar to `shutil.copyfile()` but differs in the following ways: - Uses `fcntl.FICLONE` where available (see pythonGH-81338) - Uses `os.copy_file_range` where available (see pythonGH-81340) - Uses `_winapi.CopyFile2` where available, even though this copies more metadata than the other implementations. This makes `WindowsPath.copy()` more similar to `shutil.copy2()`. The method is presently _less_ specified than the `shutil` functions to allow OS-specific optimizations that might copy more or less metadata. Incorporates code from pythonGH-81338 and pythonGH-93152. Co-authored-by: Eryk Sun <eryksun@gmail.com>
| Back | FazBrowse Home | New Git URL |
Add a Path.copy() method that copies the content of one file to another.
This method is similar to shutil.copyfile() but differs in the following ways:
The method is deliberately less specified than the shutil functions to allow OS-specific optimizations that might copy more or less metadata.
Incorporates code by @illia-v and @giampaolo from #81338 and #93152 respectively.
📚 Documentation preview 📚: https://cpython-previews--119058.org.readthedocs.build/