MCPcopy Index your code
hub / github.com/python/cpython / full_match

Method full_match

Lib/pathlib/__init__.py:546–561  ·  view source on GitHub ↗

Return True if this path matches the given glob-style pattern. The pattern is matched against the entire path.

(self, pattern, *, case_sensitive=None)

Source from the content-addressed store, hash-verified

544 return prefix + quote_from_bytes(os.fsencode(path))
545
546 def full_match(self, pattern, *, case_sensitive=None):
547 """
548 Return True if this path matches the given glob-style pattern. The
549 pattern is matched against the entire path.
550 """
551 if not hasattr(pattern, 'with_segments'):
552 pattern = self.with_segments(pattern)
553 if case_sensitive is None:
554 case_sensitive = self.parser is posixpath
555
556 # The string representation of an empty path is a single dot ('.'). Empty
557 # paths shouldn't match wildcards, so we change it to the empty string.
558 path = str(self) if self.parts else ''
559 pattern = str(pattern) if pattern.parts else ''
560 globber = _StringGlobber(self.parser.sep, case_sensitive, recursive=True)
561 return globber.compile(pattern)(path) is not None
562
563 def match(self, path_pattern, *, case_sensitive=None):
564 """

Callers 2

test_full_matchMethod · 0.45

Calls 4

with_segmentsMethod · 0.95
_StringGlobberClass · 0.90
strFunction · 0.85
compileMethod · 0.45

Tested by 2

test_full_matchMethod · 0.36