Skip to content

Commit

Permalink
Rename _make_child back to _make_child_relpath
Browse files Browse the repository at this point in the history
  • Loading branch information
barneygale committed Apr 7, 2023
1 parent d2a578d commit de4df7a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def __init__(self, name, child_parts, flavour):

def _select_from(self, parent_path, is_dir, exists, scandir, normcase):
try:
path = parent_path._make_child(self.name)
path = parent_path._make_child_relpath(self.name)
if (is_dir if self.dironly else exists)(path):
for p in self.successor._select_from(path, is_dir, exists, scandir, normcase):
yield p
Expand Down Expand Up @@ -154,7 +154,7 @@ def _select_from(self, parent_path, is_dir, exists, scandir, normcase):
continue
name = entry.name
if self.match(normcase(name)):
path = parent_path._make_child(name)
path = parent_path._make_child_relpath(name)
for p in self.successor._select_from(path, is_dir, exists, scandir, normcase):
yield p
except PermissionError:
Expand All @@ -181,7 +181,7 @@ def _iterate_directories(self, parent_path, is_dir, scandir):
if not _ignore_error(e):
raise
if entry_is_dir and not entry.is_symlink():
path = parent_path._make_child(entry.name)
path = parent_path._make_child_relpath(entry.name)
for p in self._iterate_directories(path, is_dir, scandir):
yield p
except PermissionError:
Expand Down Expand Up @@ -707,7 +707,7 @@ def __new__(cls, *args, **kwargs):
cls = WindowsPath if os.name == 'nt' else PosixPath
return object.__new__(cls)

def _make_child(self, name):
def _make_child_relpath(self, name):
path_str = str(self)
tail = self._tail
if tail:
Expand Down Expand Up @@ -776,7 +776,7 @@ def iterdir(self):
special entries '.' and '..' are not included.
"""
for name in os.listdir(self):
yield self._make_child(name)
yield self._make_child_relpath(name)

def _scandir(self):
# bpo-24132: a future version of pathlib will support subclassing of
Expand Down Expand Up @@ -1258,7 +1258,7 @@ def walk(self, top_down=True, on_error=None, follow_symlinks=False):
else:
paths.append((path, dirnames, filenames))

paths += [path._make_child(d) for d in reversed(dirnames)]
paths += [path._make_child_relpath(d) for d in reversed(dirnames)]


class PosixPath(Path, PurePosixPath):
Expand Down

0 comments on commit de4df7a

Please sign in to comment.