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

Method reverse

python/python3/tornado/routing.py:593–606  ·  view source on GitHub ↗
(self, *args: Any)

Source from the content-addressed store, hash-verified

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:
595 raise ValueError("Cannot reverse url regex " + self.regex.pattern)
596 assert len(args) == self._group_count, (
597 "required number of arguments " "not found"
598 )
599 if not len(args):
600 return self._path
601 converted_args = []
602 for a in args:
603 if not isinstance(a, (unicode_type, bytes)):
604 a = str(a)
605 converted_args.append(url_escape(utf8(a), plus=False))
606 return self._path % tuple(converted_args)
607
608 def _find_groups(self) -> Tuple[Optional[str], Optional[int]]:
609 """Returns a tuple (reverse string, group count) for a url.

Callers

nothing calls this directly

Calls 3

url_escapeFunction · 0.90
utf8Function · 0.90
appendMethod · 0.45

Tested by

no test coverage detected