MCPcopy Create free account
hub / github.com/EasyIME/PIME / match

Method match

python/python3/tornado/routing.py:570–591  ·  view source on GitHub ↗
(self, request: httputil.HTTPServerRequest)

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls 4

_unquote_or_noneFunction · 0.85
itemsMethod · 0.80
groupsMethod · 0.80
matchMethod · 0.45

Tested by

no test coverage detected