summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorthirumurugan <67573527+thirumurugan-git@users.noreply.github.com>2023-05-18 17:59:31 (GMT)
committerGitHub <noreply@github.com>2023-05-18 17:59:31 (GMT)
commitdcdc90d384723920e8dea0ee04eae8c219333634 (patch)
tree86ca2a14764711a0b1586358d2d7236b6643eff0 /Doc
parentcfa517d5a68bae24cbe8d9fe6b8e0d4935e507d2 (diff)
downloadcpython-dcdc90d384723920e8dea0ee04eae8c219333634.zip
cpython-dcdc90d384723920e8dea0ee04eae8c219333634.tar.gz
cpython-dcdc90d384723920e8dea0ee04eae8c219333634.tar.bz2
GH-104484: Add case_sensitive argument to `pathlib.PurePath.match()` (GH-104565)
Co-authored-by: Barney Gale <barney.gale@gmail.com>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/pathlib.rst7
-rw-r--r--Doc/whatsnew/3.12.rst3
2 files changed, 9 insertions, 1 deletions
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index 93af07a..627f2df 100644
--- a/Doc/library/pathlib.rst
+++ b/Doc/library/pathlib.rst
@@ -546,7 +546,7 @@ Pure paths provide the following methods and properties:
PureWindowsPath('c:/Program Files')
-.. method:: PurePath.match(pattern)
+.. method:: PurePath.match(pattern, *, case_sensitive=None)
Match this path against the provided glob-style pattern. Return ``True``
if matching is successful, ``False`` otherwise.
@@ -576,6 +576,11 @@ Pure paths provide the following methods and properties:
>>> PureWindowsPath('b.py').match('*.PY')
True
+ Set *case_sensitive* to ``True`` or ``False`` to override this behaviour.
+
+ .. versionadded:: 3.12
+ The *case_sensitive* argument.
+
.. method:: PurePath.relative_to(other, walk_up=False)
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst
index 3e55b3f..25f0a4c 100644
--- a/Doc/whatsnew/3.12.rst
+++ b/Doc/whatsnew/3.12.rst
@@ -395,6 +395,9 @@ pathlib
* Add :meth:`pathlib.Path.is_junction` as a proxy to :func:`os.path.isjunction`.
(Contributed by Charles Machalow in :gh:`99547`.)
+* Add *case_sensitive* optional parameter to :meth:`pathlib.Path.glob`,
+ :meth:`pathlib.Path.rglob` and :meth:`pathlib.PurePath.match` for matching
+ the path's case sensitivity, allowing for more precise control over the matching process.
dis
---