Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 537b6ca

Browse files
eivlmiss-islington
authored andcommitted
bpo-22062: Updated docstring and documentation for pathlib (GH-8519)
Original patch by Mike Short https://bugs.python.org/issue22062
1 parent 9db56fb commit 537b6ca

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

Doc/library/pathlib.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ call fails (for example because the path doesn't exist).
728728

729729
.. method:: Path.glob(pattern)
730730

731-
Glob the given *pattern* in the directory represented by this path,
731+
Glob the given relative *pattern* in the directory represented by this path,
732732
yielding all matching files (of any kind)::
733733

734734
>>> sorted(Path('.').glob('*.py'))
@@ -980,8 +980,8 @@ call fails (for example because the path doesn't exist).
980980

981981
.. method:: Path.rglob(pattern)
982982

983-
This is like calling :meth:`Path.glob` with "``**``" added in front of the
984-
given *pattern*::
983+
This is like calling :func:`Path.glob` with "``**/``" added in front of the
984+
given relative *pattern*::
985985

986986
>>> sorted(Path().rglob("*.py"))
987987
[PosixPath('build/lib/pathlib.py'),

Lib/pathlib.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ def iterdir(self):
10901090

10911091
def glob(self, pattern):
10921092
"""Iterate over this subtree and yield all existing files (of any
1093-
kind, including directories) matching the given pattern.
1093+
kind, including directories) matching the given relative pattern.
10941094
"""
10951095
if not pattern:
10961096
raise ValueError("Unacceptable pattern: {!r}".format(pattern))
@@ -1104,7 +1104,8 @@ def glob(self, pattern):
11041104

11051105
def rglob(self, pattern):
11061106
"""Recursively yield all existing files (of any kind, including
1107-
directories) matching the given pattern, anywhere in this subtree.
1107+
directories) matching the given relative pattern, anywhere in
1108+
this subtree.
11081109
"""
11091110
pattern = self._flavour.casefold(pattern)
11101111
drv, root, pattern_parts = self._flavour.parse_parts((pattern,))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update documentation and docstrings for pathlib. Original patch by Mike Short.

0 commit comments

Comments
 (0)