]> granicus.if.org Git - python/commitdiff
bpo-22062: Updated docstring and documentation for pathlib (GH-8519)
authorEivind Teig <eivind.teig@gmail.com>
Mon, 11 Feb 2019 10:47:09 +0000 (11:47 +0100)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 11 Feb 2019 10:47:09 +0000 (02:47 -0800)
Original patch by Mike Short

https://bugs.python.org/issue22062

Doc/library/pathlib.rst
Lib/pathlib.py
Misc/NEWS.d/next/Documentation/2018-07-28-12-41-01.bpo-22062.TaN2hn.rst [new file with mode: 0644]

index 6aebe970194abc0e6a5c4554f0a50e1d31ffb3a7..450e8ff378a3a5b28176831c45e61890d4088b0e 100644 (file)
@@ -728,7 +728,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'))
@@ -980,8 +980,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'),
index da32f90a80b6208bc3c6e375ec6d719bb15b0335..911b774b5649846c27c2995ce4a55a0727d5c0c9 100644 (file)
@@ -1090,7 +1090,7 @@ class Path(PurePath):
 
     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 @@ class Path(PurePath):
 
     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 (file)
index 0000000..cb47fe1
--- /dev/null
@@ -0,0 +1 @@
+Update documentation and docstrings for pathlib. Original patch by Mike Short.