@@ -559,55 +559,55 @@ Pure paths provide the following methods and properties:
559559 PureWindowsPath('c:/Program Files')
560560
561561
562- .. method :: PurePath.match (pattern, *, case_sensitive=None)
562+ .. method :: PurePath.full_match (pattern, *, case_sensitive=None)
563563
564564 Match this path against the provided glob-style pattern. Return ``True ``
565- if matching is successful, ``False `` otherwise.
566-
567- If *pattern * is relative, the path can be either relative or absolute,
568- and matching is done from the right::
565+ if matching is successful, ``False `` otherwise. For example::
569566
570- >>> PurePath('a/b.py').match('*.py')
571- True
572- >>> PurePath('/a/b/c.py').match('b/*.py')
567+ >>> PurePath('a/b.py').full_match('a/*.py')
573568 True
574- >>> PurePath('/ a/b/c .py').match('a/ *.py')
569+ >>> PurePath('a/b.py').full_match(' *.py')
575570 False
571+ >>> PurePath('/a/b/c.py').full_match('/a/**')
572+ True
573+ >>> PurePath('/a/b/c.py').full_match('**/*.py')
574+ True
576575
577- If *pattern * is absolute, the path must be absolute, and the whole path
578- must match::
576+ As with other methods, case-sensitivity follows platform defaults::
579577
580- >>> PurePath('/a.py').match('/*.py')
581- True
582- >>> PurePath('a/b.py').match('/*.py')
578+ >>> PurePosixPath('b.py').full_match('*.PY')
583579 False
580+ >>> PureWindowsPath('b.py').full_match('*.PY')
581+ True
584582
585- The *pattern * may be another path object; this speeds up matching the same
586- pattern against multiple files::
583+ Set *case_sensitive * to ``True `` or ``False `` to override this behaviour.
587584
588- >>> pattern = PurePath('*.py')
589- >>> PurePath('a/b.py').match(pattern)
590- True
585+ .. versionadded :: 3.13
591586
592- .. versionchanged :: 3.12
593- Accepts an object implementing the :class: `os.PathLike ` interface.
594587
595- As with other methods, case-sensitivity follows platform defaults::
588+ .. method :: PurePath.match(pattern, *, case_sensitive=None)
596589
597- >>> PurePosixPath('b.py').match('*.PY')
598- False
599- >>> PureWindowsPath('b.py').match('*.PY')
590+ Match this path against the provided non-recursive glob-style pattern.
591+ Return ``True `` if matching is successful, ``False `` otherwise.
592+
593+ This method is similar to :meth: `~PurePath.full_match `, but empty patterns
594+ aren't allowed (:exc: `ValueError ` is raised), the recursive wildcard
595+ "``** ``" isn't supported (it acts like non-recursive "``* ``"), and if a
596+ relative pattern is provided, then matching is done from the right::
597+
598+ >>> PurePath('a/b.py').match('*.py')
599+ True
600+ >>> PurePath('/a/b/c.py').match('b/*.py')
600601 True
602+ >>> PurePath('/a/b/c.py').match('a/*.py')
603+ False
601604
602- Set *case_sensitive * to ``True `` or ``False `` to override this behaviour.
605+ .. versionchanged :: 3.12
606+ The *pattern * parameter accepts a :term: `path-like object `.
603607
604608 .. versionchanged :: 3.12
605609 The *case_sensitive * parameter was added.
606610
607- .. versionchanged :: 3.13
608- Support for the recursive wildcard "``** ``" was added. In previous
609- versions, it acted like the non-recursive wildcard "``* ``".
610-
611611
612612.. method :: PurePath.relative_to(other, walk_up=False)
613613
0 commit comments