GH-127381: pathlib ABCs: remove ReadablePath.rglob() (#130207)

Remove `ReadablePath.rglob()` from the private pathlib ABCs. This method is
a trivial wrapper around `glob()` and easily replaced.
This commit is contained in:
Barney Gale 2025-02-17 19:15:59 +00:00 committed by GitHub
parent 7fcace99bb
commit 6f07016bf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 58 additions and 68 deletions

View file

@ -302,16 +302,6 @@ def glob(self, pattern, *, case_sensitive=None, recurse_symlinks=True):
select = globber.selector(parts)
return select(self.joinpath(''))
def rglob(self, pattern, *, case_sensitive=None, recurse_symlinks=True):
"""Recursively yield all existing files (of any kind, including
directories) matching the given relative pattern, anywhere in
this subtree.
"""
if not isinstance(pattern, JoinablePath):
pattern = self.with_segments(pattern)
pattern = '**' / pattern
return self.glob(pattern, case_sensitive=case_sensitive, recurse_symlinks=recurse_symlinks)
def walk(self, top_down=True, on_error=None, follow_symlinks=False):
"""Walk the directory tree from this directory, similar to os.walk()."""
paths = [self]