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

Method __init__

python/python3/tornado/web.py:2044–2098  ·  view source on GitHub ↗
(
        self,
        handlers: Optional[_RuleList] = None,
        default_host: Optional[str] = None,
        transforms: Optional[List[Type["OutputTransform"]]] = None,
        **settings: Any
    )

Source from the content-addressed store, hash-verified

2042 """
2043
2044 def __init__(
2045 self,
2046 handlers: Optional[_RuleList] = None,
2047 default_host: Optional[str] = None,
2048 transforms: Optional[List[Type["OutputTransform"]]] = None,
2049 **settings: Any
2050 ) -> None:
2051 if transforms is None:
2052 self.transforms = [] # type: List[Type[OutputTransform]]
2053 if settings.get("compress_response") or settings.get("gzip"):
2054 self.transforms.append(GZipContentEncoding)
2055 else:
2056 self.transforms = transforms
2057 self.default_host = default_host
2058 self.settings = settings
2059 self.ui_modules = {
2060 "linkify": _linkify,
2061 "xsrf_form_html": _xsrf_form_html,
2062 "Template": TemplateModule,
2063 }
2064 self.ui_methods = {} # type: Dict[str, Callable[..., str]]
2065 self._load_ui_modules(settings.get("ui_modules", {}))
2066 self._load_ui_methods(settings.get("ui_methods", {}))
2067 if self.settings.get("static_path"):
2068 path = self.settings["static_path"]
2069 handlers = list(handlers or [])
2070 static_url_prefix = settings.get("static_url_prefix", "/static/")
2071 static_handler_class = settings.get(
2072 "static_handler_class", StaticFileHandler
2073 )
2074 static_handler_args = settings.get("static_handler_args", {})
2075 static_handler_args["path"] = path
2076 for pattern in [
2077 re.escape(static_url_prefix) + r"(.*)",
2078 r"/(favicon\.ico)",
2079 r"/(robots\.txt)",
2080 ]:
2081 handlers.insert(0, (pattern, static_handler_class, static_handler_args))
2082
2083 if self.settings.get("debug"):
2084 self.settings.setdefault("autoreload", True)
2085 self.settings.setdefault("compiled_template_cache", False)
2086 self.settings.setdefault("static_hash_cache", False)
2087 self.settings.setdefault("serve_traceback", True)
2088
2089 self.wildcard_router = _ApplicationRouter(self, handlers)
2090 self.default_router = _ApplicationRouter(
2091 self, [Rule(AnyMatches(), self.wildcard_router)]
2092 )
2093
2094 # Automatically reload modified modules
2095 if self.settings.get("autoreload"):
2096 from tornado import autoreload
2097
2098 autoreload.start()
2099
2100 def listen(
2101 self,

Callers

nothing calls this directly

Calls 9

_load_ui_modulesMethod · 0.95
_load_ui_methodsMethod · 0.95
RuleClass · 0.90
AnyMatchesClass · 0.90
listFunction · 0.85
_ApplicationRouterClass · 0.85
getMethod · 0.45
appendMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected