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

Class CustomRouter

python/python3/tornado/test/routing_test.py:116–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114
115
116class CustomRouter(ReversibleRouter):
117 def __init__(self):
118 super().__init__()
119 self.routes = {} # type: typing.Dict[str, typing.Any]
120
121 def add_routes(self, routes):
122 self.routes.update(routes)
123
124 def find_handler(self, request, **kwargs):
125 if request.path in self.routes:
126 app, handler = self.routes[request.path]
127 return app.get_handler_delegate(request, handler)
128
129 def reverse_url(self, name, *args):
130 handler_path = "/" + name
131 return handler_path if handler_path in self.routes else None
132
133
134class CustomRouterTestCase(AsyncHTTPTestCase):

Callers 2

get_appMethod · 0.85
get_appMethod · 0.85

Calls

no outgoing calls

Tested by 2

get_appMethod · 0.68
get_appMethod · 0.68