Skip to content

Commit

Permalink
Address some review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
barneygale committed Aug 7, 2024
1 parent 3b6405b commit 03f9b7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Doc/library/pathlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1552,15 +1552,15 @@ Copying, renaming and deleting

If the source is a directory and *dirs_exist_ok* is false (the default), a
:exc:`FileExistsError` is raised if the target is an existing directory.
If *dirs_exists_ok* is true, the copying operation will continue if it
encounters existing directories, and files within the destination tree will
be overwritten by corresponding files from the source tree.
If *dirs_exists_ok* is true, the copying operation will overwrite
existing files within the destination tree with corresponding files
from the source tree.

If *preserve_metadata* is false (the default), only directory structures
and file data are guaranteed to be copied. Set *preserve_metadata* to true
to ensure that file and directory permissions, flags, last access and
modification times, and extended attributes are copied where supported.
This argument has no effect when copying files on Windows (where
This argument has no effect when copying files on Windows (where
metadata is always preserved).

If *ignore* is given, it should be a callable accepting one argument: a
Expand Down
4 changes: 2 additions & 2 deletions Lib/pathlib/_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def _copy_metadata(self, target, *, follow_symlinks=True):
metadata = self._read_metadata(keys, follow_symlinks=follow_symlinks)
target._write_metadata(metadata, follow_symlinks=follow_symlinks)

def _copy_data(self, target):
def _copy_file(self, target):
"""
Copy the contents of this file to the given target.
"""
Expand Down Expand Up @@ -867,7 +867,7 @@ def on_error(err):
if preserve_metadata:
src._copy_metadata(dst)
else:
src._copy_data(dst)
src._copy_file(dst)
if preserve_metadata:
src._copy_metadata(dst)
except OSError as err:
Expand Down
4 changes: 2 additions & 2 deletions Lib/pathlib/_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ def mkdir(self, mode=0o777, parents=False, exist_ok=False):
_write_metadata = write_file_metadata

if copyfile:
def _copy_data(self, target):
def _copy_file(self, target):
"""
Copy the contents of this file to the given target.
"""
Expand All @@ -797,7 +797,7 @@ def _copy_data(self, target):
except TypeError:
if not isinstance(target, PathBase):
raise
PathBase._copy_data(self, target)
PathBase._copy_file(self, target)
else:
copyfile(os.fspath(self), target)

Expand Down

0 comments on commit 03f9b7f

Please sign in to comment.