(self, request: httputil.HTTPServerRequest)
| 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) |
| 572 | if match is None: |
| 573 | return None |
| 574 | if not self.regex.groups: |
| 575 | return {} |
| 576 | |
| 577 | path_args = [] # type: List[bytes] |
| 578 | path_kwargs = {} # type: Dict[str, bytes] |
| 579 | |
| 580 | # Pass matched groups to the handler. Since |
| 581 | # match.groups() includes both named and |
| 582 | # unnamed groups, we want to use either groups |
| 583 | # or groupdict but not both. |
| 584 | if self.regex.groupindex: |
| 585 | path_kwargs = dict( |
| 586 | (str(k), _unquote_or_none(v)) for (k, v) in match.groupdict().items() |
| 587 | ) |
| 588 | else: |
| 589 | path_args = [_unquote_or_none(s) for s in match.groups()] |
| 590 | |
| 591 | return dict(path_args=path_args, path_kwargs=path_kwargs) |
| 592 | |
| 593 | def reverse(self, *args: Any) -> Optional[str]: |
| 594 | if self._path is None: |
nothing calls this directly
no test coverage detected