(self, path_pattern: Union[str, Pattern])
| 553 | """Matches requests with paths specified by ``path_pattern`` regex.""" |
| 554 | |
| 555 | def __init__(self, path_pattern: Union[str, Pattern]) -> None: |
| 556 | if isinstance(path_pattern, basestring_type): |
| 557 | if not path_pattern.endswith("$"): |
| 558 | path_pattern += "$" |
| 559 | self.regex = re.compile(path_pattern) |
| 560 | else: |
| 561 | self.regex = path_pattern |
| 562 | |
| 563 | assert len(self.regex.groupindex) in (0, self.regex.groups), ( |
| 564 | "groups in url regexes must either be all named or all " |
| 565 | "positional: %r" % self.regex.pattern |
| 566 | ) |
| 567 | |
| 568 | self._path, self._group_count = self._find_groups() |
| 569 | |
| 570 | def match(self, request: httputil.HTTPServerRequest) -> Optional[Dict[str, Any]]: |
| 571 | match = self.regex.match(request.path) |
nothing calls this directly
no test coverage detected