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

Method __init__

python/python3/tornado/routing.py:555–568  ·  view source on GitHub ↗
(self, path_pattern: Union[str, Pattern])

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 1

_find_groupsMethod · 0.95

Tested by

no test coverage detected