MCPcopy
hub / github.com/cool-RR/PySnooper / match

Method match

tests/mini_toolbox/pathlib.py:1141–1164  ·  view source on GitHub ↗

Return True if this path matches the given pattern.

(self, path_pattern)

Source from the content-addressed store, hash-verified

1139 return self._flavour.is_reserved(self._parts)
1140
1141 def match(self, path_pattern):
1142 """
1143 Return True if this path matches the given pattern.
1144 """
1145 cf = self._flavour.casefold
1146 path_pattern = cf(path_pattern)
1147 drv, root, pat_parts = self._flavour.parse_parts((path_pattern,))
1148 if not pat_parts:
1149 raise ValueError("empty pattern")
1150 if drv and drv != cf(self._drv):
1151 return False
1152 if root and root != cf(self._root):
1153 return False
1154 parts = self._cparts
1155 if drv or root:
1156 if len(pat_parts) != len(parts):
1157 return False
1158 pat_parts = pat_parts[1:]
1159 elif len(pat_parts) > len(parts):
1160 return False
1161 for part, pat in zip(reversed(parts), reversed(pat_parts)):
1162 if not fnmatch.fnmatchcase(part, pat):
1163 return False
1164 return True
1165
1166
1167# Can't subclass os.PathLike from PurePath and keep the constructor

Callers 15

checkMethod · 0.80
checkMethod · 0.80
checkMethod · 0.80
_check_preambleMethod · 0.80
_check_contentMethod · 0.80
_check_nameMethod · 0.80
_check_valueMethod · 0.80
_check_preambleMethod · 0.80
_check_valueMethod · 0.80
_check_preambleMethod · 0.80
_check_contentMethod · 0.80

Calls 1

parse_partsMethod · 0.80

Tested by 1