[Python-checkins] [3.7] bpo-22062: Updated docstring and documentation for pathlib (GH-8519) (GH-11817)

Miss Islington (bot) webhook-mailer at python.org
Mon Feb 11 07:03:06 EST 2019


https://github.com/python/cpython/commit/2259b5af3c711b40d2b81eacc1b5d75cda1ae3e2
commit: 2259b5af3c711b40d2b81eacc1b5d75cda1ae3e2
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-02-11T04:02:57-08:00
summary:

[3.7] bpo-22062: Updated docstring and documentation for pathlib (GH-8519) (GH-11817)



Original patch by Mike Short


https://bugs.python.org/issue22062
(cherry picked from commit 537b6caa565ec2fc304ba6f4400cd347ce2af64b)


Co-authored-by: Eivind Teig <eivind.teig at gmail.com>


https://bugs.python.org/issue22062

files:
A Misc/NEWS.d/next/Documentation/2018-07-28-12-41-01.bpo-22062.TaN2hn.rst
M Doc/library/pathlib.rst
M Lib/pathlib.py

diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index b4ae293d14b8..7d4b41b1dd12 100644
--- a/Doc/library/pathlib.rst
+++ b/Doc/library/pathlib.rst
@@ -718,7 +718,7 @@ call fails (for example because the path doesn't exist):
 
 .. method:: Path.glob(pattern)
 
-   Glob the given *pattern* in the directory represented by this path,
+   Glob the given relative *pattern* in the directory represented by this path,
    yielding all matching files (of any kind)::
 
       >>> sorted(Path('.').glob('*.py'))
@@ -970,8 +970,8 @@ call fails (for example because the path doesn't exist):
 
 .. method:: Path.rglob(pattern)
 
-   This is like calling :meth:`Path.glob` with "``**``" added in front of the
-   given *pattern*::
+   This is like calling :func:`Path.glob` with "``**/``" added in front of the
+   given relative *pattern*::
 
       >>> sorted(Path().rglob("*.py"))
       [PosixPath('build/lib/pathlib.py'),
diff --git a/Lib/pathlib.py b/Lib/pathlib.py
index 067edf1221e9..dd6a83f715f8 100644
--- a/Lib/pathlib.py
+++ b/Lib/pathlib.py
@@ -1090,7 +1090,7 @@ def iterdir(self):
 
     def glob(self, pattern):
         """Iterate over this subtree and yield all existing files (of any
-        kind, including directories) matching the given pattern.
+        kind, including directories) matching the given relative pattern.
         """
         if not pattern:
             raise ValueError("Unacceptable pattern: {!r}".format(pattern))
@@ -1104,7 +1104,8 @@ def glob(self, pattern):
 
     def rglob(self, pattern):
         """Recursively yield all existing files (of any kind, including
-        directories) matching the given pattern, anywhere in this subtree.
+        directories) matching the given relative pattern, anywhere in
+        this subtree.
         """
         pattern = self._flavour.casefold(pattern)
         drv, root, pattern_parts = self._flavour.parse_parts((pattern,))
diff --git a/Misc/NEWS.d/next/Documentation/2018-07-28-12-41-01.bpo-22062.TaN2hn.rst b/Misc/NEWS.d/next/Documentation/2018-07-28-12-41-01.bpo-22062.TaN2hn.rst
new file mode 100644
index 000000000000..cb47fe136e6b
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2018-07-28-12-41-01.bpo-22062.TaN2hn.rst
@@ -0,0 +1 @@
+Update documentation and docstrings for pathlib. Original patch by Mike Short.



More information about the Python-checkins mailing list