def __call__(self, environ, start_response):
<EOL>path_info = environ['<STR_LIT>']<EOL>request_method = environ['<STR_LIT>'].upper()<EOL>is_head = (request_method == '<STR_LIT>')<EOL>if is_head:<EOL><INDENT>request_method = environ['<STR_LIT>'] = '<STR_LIT:GET>'<EOL><DEDENT>request, url_args = self.__request_urls.get((request_method, path_info)), None<EOL>if request is None:<EOL><INDENT>request, url_args = next(<EOL>(<EOL>(request, {unquote(url_arg): unquote(url_value) for url_arg, url_value in request_match.groupdict().items()})<EOL>for request, request_match in<EOL>(<EOL>(request, regex.match(path_info)) for method, regex, request in self.__request_regex<EOL>if method is not None and method == request_method<EOL>)<EOL>if request_match<EOL>),<EOL>(None, None)<EOL>)<EOL>if request is None:<EOL><INDENT>request, url_args = self.__request_urls.get((None, path_info)), None<EOL>if request is None:<EOL><INDENT>request, url_args = next(<EOL>(<EOL>(request, {unquote(url_arg): unquote(url_value) for url_arg, url_value in request_match.groupdict().items()})<EOL>for request, request_match in<EOL>(<EOL>(request, regex.match(path_info)) for method, regex, request in self.__request_regex<EOL>if method is None<EOL>)<EOL>if request_match<EOL>),<EOL>(None, None)<EOL>)<EOL><DEDENT><DEDENT><DEDENT>ctx = environ[Environ.CTX] = Context(self, environ, start_response, url_args)<EOL>if request is None:<EOL><INDENT>if any(path == path_info for _, path in self.__request_urls) orany(regex.match(path_info) for _, regex, _ in self.__request_regex):<EOL><INDENT>response = ctx.response_text(HTTPStatus.METHOD_NOT_ALLOWED)<EOL><DEDENT>else:<EOL><INDENT>response = ctx.response_text(HTTPStatus.NOT_FOUND)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>response = request(ctx.environ, ctx.start_response)<EOL><DEDENT>except: <EOL><INDENT>ctx.log.exception('<STR_LIT>', request.name)<EOL>response = ctx.response_text(HTTPStatus.INTERNAL_SERVER_ERROR)<EOL><DEDENT><DEDENT>if is_head:<EOL><INDENT>return []<EOL><DEDENT>return response<EOL>
Chisel application WSGI entry point