Add back tornado stubs for Python 2 only (#4412)

Tornado ships with inline annotations, but it no longer is Python 2
compatible. I think that it makes sense to keep the legacy stubs for
Python 2 compatibility, at least for a while longer.

This restores stubs removed in #4321, but moves them to
`third_party/2`.
This commit is contained in:
Jukka Lehtosalo
2020-08-07 16:54:57 +01:00
committed by GitHub
parent 4233008b4a
commit 29c71ff52a
14 changed files with 1028 additions and 0 deletions

0
third_party/2/tornado/__init__.pyi vendored Normal file
View File

43
third_party/2/tornado/concurrent.pyi vendored Normal file
View File

@@ -0,0 +1,43 @@
from typing import Any
futures: Any
class ReturnValueIgnoredError(Exception): ...
class _TracebackLogger:
exc_info: Any
formatted_tb: Any
def __init__(self, exc_info) -> None: ...
def activate(self): ...
def clear(self): ...
def __del__(self): ...
class Future:
def __init__(self) -> None: ...
def cancel(self): ...
def cancelled(self): ...
def running(self): ...
def done(self): ...
def result(self, timeout=...): ...
def exception(self, timeout=...): ...
def add_done_callback(self, fn): ...
def set_result(self, result): ...
def set_exception(self, exception): ...
def exc_info(self): ...
def set_exc_info(self, exc_info): ...
def __del__(self): ...
TracebackFuture: Any
FUTURES: Any
def is_future(x): ...
class DummyExecutor:
def submit(self, fn, *args, **kwargs): ...
def shutdown(self, wait=...): ...
dummy_executor: Any
def run_on_executor(*args, **kwargs): ...
def return_future(f): ...
def chain_future(a, b): ...

110
third_party/2/tornado/gen.pyi vendored Normal file
View File

@@ -0,0 +1,110 @@
from typing import Any, Dict, NamedTuple, Tuple
singledispatch: Any
class KeyReuseError(Exception): ...
class UnknownKeyError(Exception): ...
class LeakedCallbackError(Exception): ...
class BadYieldError(Exception): ...
class ReturnValueIgnoredError(Exception): ...
class TimeoutError(Exception): ...
def engine(func): ...
def coroutine(func, replace_callback=...): ...
class Return(Exception):
value: Any
def __init__(self, value=...) -> None: ...
class WaitIterator:
current_index: Any
def __init__(self, *args, **kwargs) -> None: ...
def done(self): ...
def next(self): ...
class YieldPoint:
def start(self, runner): ...
def is_ready(self): ...
def get_result(self): ...
class Callback(YieldPoint):
key: Any
def __init__(self, key) -> None: ...
runner: Any
def start(self, runner): ...
def is_ready(self): ...
def get_result(self): ...
class Wait(YieldPoint):
key: Any
def __init__(self, key) -> None: ...
runner: Any
def start(self, runner): ...
def is_ready(self): ...
def get_result(self): ...
class WaitAll(YieldPoint):
keys: Any
def __init__(self, keys) -> None: ...
runner: Any
def start(self, runner): ...
def is_ready(self): ...
def get_result(self): ...
def Task(func, *args, **kwargs): ...
class YieldFuture(YieldPoint):
future: Any
io_loop: Any
def __init__(self, future, io_loop=...) -> None: ...
runner: Any
key: Any
result_fn: Any
def start(self, runner): ...
def is_ready(self): ...
def get_result(self): ...
class Multi(YieldPoint):
keys: Any
children: Any
unfinished_children: Any
quiet_exceptions: Any
def __init__(self, children, quiet_exceptions=...) -> None: ...
def start(self, runner): ...
def is_ready(self): ...
def get_result(self): ...
def multi_future(children, quiet_exceptions=...): ...
def maybe_future(x): ...
def with_timeout(timeout, future, io_loop=..., quiet_exceptions=...): ...
def sleep(duration): ...
moment: Any
class Runner:
gen: Any
result_future: Any
future: Any
yield_point: Any
pending_callbacks: Any
results: Any
running: Any
finished: Any
had_exception: Any
io_loop: Any
stack_context_deactivate: Any
def __init__(self, gen, result_future, first_yielded) -> None: ...
def register_callback(self, key): ...
def is_ready(self, key): ...
def set_result(self, key, result): ...
def pop_result(self, key): ...
def run(self): ...
def handle_yield(self, yielded): ...
def result_callback(self, key): ...
def handle_exception(self, typ, value, tb): ...
class Arguments(NamedTuple):
args: Tuple[str, ...]
kwargs: Dict[str, Any]
def convert_yielded(yielded): ...

127
third_party/2/tornado/httpclient.pyi vendored Normal file
View File

@@ -0,0 +1,127 @@
from typing import Any
from tornado.util import Configurable
class HTTPClient:
def __init__(self, async_client_class=..., **kwargs) -> None: ...
def __del__(self): ...
def close(self): ...
def fetch(self, request, **kwargs): ...
class AsyncHTTPClient(Configurable):
@classmethod
def configurable_base(cls): ...
@classmethod
def configurable_default(cls): ...
def __new__(cls, io_loop=..., force_instance=..., **kwargs): ...
io_loop: Any
defaults: Any
def initialize(self, io_loop, defaults=...): ...
def close(self): ...
def fetch(self, request, callback=..., raise_error=..., **kwargs): ...
def fetch_impl(self, request, callback): ...
@classmethod
def configure(cls, impl, **kwargs): ...
class HTTPRequest:
proxy_host: Any
proxy_port: Any
proxy_username: Any
proxy_password: Any
url: Any
method: Any
body_producer: Any
auth_username: Any
auth_password: Any
auth_mode: Any
connect_timeout: Any
request_timeout: Any
follow_redirects: Any
max_redirects: Any
user_agent: Any
decompress_response: Any
network_interface: Any
streaming_callback: Any
header_callback: Any
prepare_curl_callback: Any
allow_nonstandard_methods: Any
validate_cert: Any
ca_certs: Any
allow_ipv6: Any
client_key: Any
client_cert: Any
ssl_options: Any
expect_100_continue: Any
start_time: Any
def __init__(
self,
url,
method=...,
headers=...,
body=...,
auth_username=...,
auth_password=...,
auth_mode=...,
connect_timeout=...,
request_timeout=...,
if_modified_since=...,
follow_redirects=...,
max_redirects=...,
user_agent=...,
use_gzip=...,
network_interface=...,
streaming_callback=...,
header_callback=...,
prepare_curl_callback=...,
proxy_host=...,
proxy_port=...,
proxy_username=...,
proxy_password=...,
allow_nonstandard_methods=...,
validate_cert=...,
ca_certs=...,
allow_ipv6=...,
client_key=...,
client_cert=...,
body_producer=...,
expect_100_continue=...,
decompress_response=...,
ssl_options=...,
) -> None: ...
@property
def headers(self): ...
@headers.setter
def headers(self, value): ...
@property
def body(self): ...
@body.setter
def body(self, value): ...
class HTTPResponse:
request: Any
code: Any
reason: Any
headers: Any
buffer: Any
effective_url: Any
error: Any
request_time: Any
time_info: Any
def __init__(
self, request, code, headers=..., buffer=..., effective_url=..., error=..., request_time=..., time_info=..., reason=...
) -> None: ...
body: bytes
def rethrow(self): ...
class HTTPError(Exception):
code: Any
response: Any
def __init__(self, code, message=..., response=...) -> None: ...
class _RequestProxy:
request: Any
defaults: Any
def __init__(self, request, defaults) -> None: ...
def __getattr__(self, name): ...
def main(): ...

57
third_party/2/tornado/httpserver.pyi vendored Normal file
View File

@@ -0,0 +1,57 @@
from typing import Any
from tornado import httputil
from tornado.tcpserver import TCPServer
from tornado.util import Configurable
class HTTPServer(TCPServer, Configurable, httputil.HTTPServerConnectionDelegate):
def __init__(self, *args, **kwargs) -> None: ...
request_callback: Any
no_keep_alive: Any
xheaders: Any
protocol: Any
conn_params: Any
def initialize(
self,
request_callback,
no_keep_alive=...,
io_loop=...,
xheaders=...,
ssl_options=...,
protocol=...,
decompress_request=...,
chunk_size=...,
max_header_size=...,
idle_connection_timeout=...,
body_timeout=...,
max_body_size=...,
max_buffer_size=...,
): ...
@classmethod
def configurable_base(cls): ...
@classmethod
def configurable_default(cls): ...
def close_all_connections(self): ...
def handle_stream(self, stream, address): ...
def start_request(self, server_conn, request_conn): ...
def on_close(self, server_conn): ...
class _HTTPRequestContext:
address: Any
protocol: Any
address_family: Any
remote_ip: Any
def __init__(self, stream, address, protocol) -> None: ...
class _ServerRequestAdapter(httputil.HTTPMessageDelegate):
server: Any
connection: Any
request: Any
delegate: Any
def __init__(self, server, server_conn, request_conn) -> None: ...
def headers_received(self, start_line, headers): ...
def data_received(self, chunk): ...
def finish(self): ...
def on_connection_close(self): ...
HTTPRequest: Any

99
third_party/2/tornado/httputil.pyi vendored Normal file
View File

@@ -0,0 +1,99 @@
from typing import Any, Dict, List, NamedTuple, Optional
from tornado.util import ObjectDict
class SSLError(Exception): ...
class _NormalizedHeaderCache(Dict[Any, Any]):
size: Any
queue: Any
def __init__(self, size) -> None: ...
def __missing__(self, key): ...
class HTTPHeaders(Dict[Any, Any]):
def __init__(self, *args, **kwargs) -> None: ...
def add(self, name, value): ...
def get_list(self, name): ...
def get_all(self): ...
def parse_line(self, line): ...
@classmethod
def parse(cls, headers): ...
def __setitem__(self, name, value): ...
def __getitem__(self, name): ...
def __delitem__(self, name): ...
def __contains__(self, name): ...
def get(self, name, default=...): ...
def update(self, *args, **kwargs): ...
def copy(self): ...
__copy__: Any
def __deepcopy__(self, memo_dict): ...
class HTTPServerRequest:
path: str
query: str
method: Optional[str]
uri: Optional[str]
version: str
headers: HTTPHeaders
body: bytes
remote_ip: Any
protocol: Any
host: str
files: Dict[str, List[HTTPFile]]
connection: Optional[HTTPConnection]
arguments: Dict[str, List[bytes]]
query_arguments: Dict[str, List[bytes]]
body_arguments: Dict[str, List[bytes]]
def __init__(
self, method=..., uri=..., version=..., headers=..., body=..., host=..., files=..., connection=..., start_line=...
) -> None: ...
def supports_http_1_1(self): ...
@property
def cookies(self): ...
def write(self, chunk, callback=...): ...
def finish(self): ...
def full_url(self): ...
def request_time(self): ...
def get_ssl_certificate(self, binary_form=...): ...
class HTTPInputError(Exception): ...
class HTTPOutputError(Exception): ...
class HTTPServerConnectionDelegate:
def start_request(self, server_conn, request_conn): ...
def on_close(self, server_conn): ...
class HTTPMessageDelegate:
def headers_received(self, start_line, headers): ...
def data_received(self, chunk): ...
def finish(self): ...
def on_connection_close(self): ...
class HTTPConnection:
def write_headers(self, start_line, headers, chunk=..., callback=...): ...
def write(self, chunk, callback=...): ...
def finish(self): ...
def url_concat(url, args): ...
class HTTPFile(ObjectDict): ...
def parse_body_arguments(content_type, body, arguments, files, headers=...): ...
def parse_multipart_form_data(boundary, data, arguments, files): ...
def format_timestamp(ts): ...
class RequestStartLine(NamedTuple):
method: str
path: str
version: str
def parse_request_start_line(line): ...
class ResponseStartLine(NamedTuple):
version: str
code: str
reason: str
def parse_response_start_line(line): ...
def doctests(): ...
def split_host_and_port(netloc): ...

85
third_party/2/tornado/ioloop.pyi vendored Normal file
View File

@@ -0,0 +1,85 @@
from typing import Any
from tornado.util import Configurable
signal: Any
class TimeoutError(Exception): ...
class IOLoop(Configurable):
NONE: Any
READ: Any
WRITE: Any
ERROR: Any
@staticmethod
def instance(): ...
@staticmethod
def initialized(): ...
def install(self): ...
@staticmethod
def clear_instance(): ...
@staticmethod
def current(instance=...): ...
def make_current(self): ...
@staticmethod
def clear_current(): ...
@classmethod
def configurable_base(cls): ...
@classmethod
def configurable_default(cls): ...
def initialize(self, make_current=...): ...
def close(self, all_fds=...): ...
def add_handler(self, fd, handler, events): ...
def update_handler(self, fd, events): ...
def remove_handler(self, fd): ...
def set_blocking_signal_threshold(self, seconds, action): ...
def set_blocking_log_threshold(self, seconds): ...
def log_stack(self, signal, frame): ...
def start(self): ...
def stop(self): ...
def run_sync(self, func, timeout=...): ...
def time(self): ...
def add_timeout(self, deadline, callback, *args, **kwargs): ...
def call_later(self, delay, callback, *args, **kwargs): ...
def call_at(self, when, callback, *args, **kwargs): ...
def remove_timeout(self, timeout): ...
def add_callback(self, callback, *args, **kwargs): ...
def add_callback_from_signal(self, callback, *args, **kwargs): ...
def spawn_callback(self, callback, *args, **kwargs): ...
def add_future(self, future, callback): ...
def handle_callback_exception(self, callback): ...
def split_fd(self, fd): ...
def close_fd(self, fd): ...
class PollIOLoop(IOLoop):
time_func: Any
def initialize(self, impl, time_func=..., **kwargs): ...
def close(self, all_fds=...): ...
def add_handler(self, fd, handler, events): ...
def update_handler(self, fd, events): ...
def remove_handler(self, fd): ...
def set_blocking_signal_threshold(self, seconds, action): ...
def start(self): ...
def stop(self): ...
def time(self): ...
def call_at(self, deadline, callback, *args, **kwargs): ...
def remove_timeout(self, timeout): ...
def add_callback(self, callback, *args, **kwargs): ...
def add_callback_from_signal(self, callback, *args, **kwargs): ...
class _Timeout:
deadline: Any
callback: Any
tiebreaker: Any
def __init__(self, deadline, callback, io_loop) -> None: ...
def __lt__(self, other): ...
def __le__(self, other): ...
class PeriodicCallback:
callback: Any
callback_time: Any
io_loop: Any
def __init__(self, callback, callback_time, io_loop=...) -> None: ...
def start(self): ...
def stop(self): ...
def is_running(self): ...

45
third_party/2/tornado/locks.pyi vendored Normal file
View File

@@ -0,0 +1,45 @@
from typing import Any, Optional
class _TimeoutGarbageCollector:
def __init__(self): ...
class Condition(_TimeoutGarbageCollector):
io_loop: Any
def __init__(self): ...
def wait(self, timeout: Optional[Any] = ...): ...
def notify(self, n: int = ...): ...
def notify_all(self): ...
class Event:
def __init__(self): ...
def is_set(self): ...
def set(self): ...
def clear(self): ...
def wait(self, timeout: Optional[Any] = ...): ...
class _ReleasingContextManager:
def __init__(self, obj): ...
def __enter__(self): ...
def __exit__(self, exc_type, exc_val, exc_tb): ...
class Semaphore(_TimeoutGarbageCollector):
def __init__(self, value: int = ...): ...
def release(self): ...
def acquire(self, timeout: Optional[Any] = ...): ...
def __enter__(self): ...
__exit__: Any
def __aenter__(self): ...
def __aexit__(self, typ, value, tb): ...
class BoundedSemaphore(Semaphore):
def __init__(self, value: int = ...): ...
def release(self): ...
class Lock:
def __init__(self): ...
def acquire(self, timeout: Optional[Any] = ...): ...
def release(self): ...
def __enter__(self): ...
__exit__: Any
def __aenter__(self): ...
def __aexit__(self, typ, value, tb): ...

46
third_party/2/tornado/netutil.pyi vendored Normal file
View File

@@ -0,0 +1,46 @@
from typing import Any
from tornado.util import Configurable
ssl: Any
certifi: Any
xrange: Any
ssl_match_hostname: Any
SSLCertificateError: Any
def bind_sockets(port, address=..., family=..., backlog=..., flags=...): ...
def bind_unix_socket(file, mode=..., backlog=...): ...
def add_accept_handler(sock, callback, io_loop=...): ...
def is_valid_ip(ip): ...
class Resolver(Configurable):
@classmethod
def configurable_base(cls): ...
@classmethod
def configurable_default(cls): ...
def resolve(self, host, port, family=..., callback=...): ...
def close(self): ...
class ExecutorResolver(Resolver):
io_loop: Any
executor: Any
close_executor: Any
def initialize(self, io_loop=..., executor=..., close_executor=...): ...
def close(self): ...
def resolve(self, host, port, family=...): ...
class BlockingResolver(ExecutorResolver):
def initialize(self, io_loop=...): ...
class ThreadedResolver(ExecutorResolver):
def initialize(self, io_loop=..., num_threads=...): ...
class OverrideResolver(Resolver):
resolver: Any
mapping: Any
def initialize(self, resolver, mapping): ...
def close(self): ...
def resolve(self, host, port, *args, **kwargs): ...
def ssl_options_to_context(ssl_options): ...
def ssl_wrap_socket(socket, ssl_options, server_hostname=..., **kwargs): ...

24
third_party/2/tornado/process.pyi vendored Normal file
View File

@@ -0,0 +1,24 @@
from typing import Any, Optional
long = int
CalledProcessError: Any
def cpu_count() -> int: ...
def fork_processes(num_processes, max_restarts: int = ...) -> Optional[int]: ...
def task_id() -> int: ...
class Subprocess:
STREAM: Any = ...
io_loop: Any = ...
stdin: Any = ...
stdout: Any = ...
stderr: Any = ...
proc: Any = ...
returncode: Any = ...
def __init__(self, *args, **kwargs) -> None: ...
def set_exit_callback(self, callback): ...
def wait_for_exit(self, raise_error: bool = ...): ...
@classmethod
def initialize(cls, io_loop: Optional[Any] = ...): ...
@classmethod
def uninitialize(cls): ...

17
third_party/2/tornado/tcpserver.pyi vendored Normal file
View File

@@ -0,0 +1,17 @@
from typing import Any
ssl: Any
class TCPServer:
io_loop: Any
ssl_options: Any
max_buffer_size: Any
read_chunk_size: Any
def __init__(self, io_loop=..., ssl_options=..., max_buffer_size=..., read_chunk_size=...) -> None: ...
def listen(self, port, address=...): ...
def add_sockets(self, sockets): ...
def add_socket(self, socket): ...
def bind(self, port, address=..., family=..., backlog=...): ...
def start(self, num_processes=...): ...
def stop(self): ...
def handle_stream(self, stream, address): ...

63
third_party/2/tornado/testing.pyi vendored Normal file
View File

@@ -0,0 +1,63 @@
import logging
import unittest
from typing import Any, Callable, Generator, Optional, overload
AsyncHTTPClient: Any
gen: Any
HTTPServer: Any
IOLoop: Any
netutil: Any
SimpleAsyncHTTPClient: Any
def get_unused_port(): ...
def bind_unused_port(): ...
class AsyncTestCase(unittest.TestCase):
def __init__(self, *args, **kwargs): ...
io_loop: Any
def setUp(self): ...
def tearDown(self): ...
def get_new_ioloop(self): ...
def run(self, result: Optional[Any] = ...): ...
def stop(self, _arg: Optional[Any] = ..., **kwargs): ...
def wait(self, condition: Optional[Any] = ..., timeout: float = ...): ...
class AsyncHTTPTestCase(AsyncTestCase):
http_client: Any
http_server: Any
def setUp(self): ...
def get_http_client(self): ...
def get_http_server(self): ...
def get_app(self): ...
def fetch(self, path, **kwargs): ...
def get_httpserver_options(self): ...
def get_http_port(self): ...
def get_protocol(self): ...
def get_url(self, path): ...
def tearDown(self): ...
class AsyncHTTPSTestCase(AsyncHTTPTestCase):
def get_http_client(self): ...
def get_httpserver_options(self): ...
def get_ssl_options(self): ...
def get_protocol(self): ...
@overload
def gen_test(*, timeout: Optional[float] = ...) -> Callable[[Callable[..., Generator[Any, Any, Any]]], Callable[..., None]]: ...
@overload
def gen_test(func: Callable[..., Generator[Any, Any, Any]]) -> Callable[..., None]: ...
class LogTrapTestCase(unittest.TestCase):
def run(self, result: Optional[Any] = ...): ...
class ExpectLog(logging.Filter):
logger: Any
regex: Any
required: Any
matched: Any
def __init__(self, logger, regex, required: bool = ...): ...
def filter(self, record): ...
def __enter__(self): ...
def __exit__(self, typ, value, tb): ...
def main(**kwargs): ...

46
third_party/2/tornado/util.pyi vendored Normal file
View File

@@ -0,0 +1,46 @@
from typing import Any, Dict
xrange: Any
class ObjectDict(Dict[Any, Any]):
def __getattr__(self, name): ...
def __setattr__(self, name, value): ...
class GzipDecompressor:
decompressobj: Any
def __init__(self) -> None: ...
def decompress(self, value, max_length=...): ...
@property
def unconsumed_tail(self): ...
def flush(self): ...
unicode_type: Any
basestring_type: Any
def import_object(name): ...
bytes_type: Any
def errno_from_exception(e): ...
class Configurable:
def __new__(cls, *args, **kwargs): ...
@classmethod
def configurable_base(cls): ...
@classmethod
def configurable_default(cls): ...
def initialize(self): ...
@classmethod
def configure(cls, impl, **kwargs): ...
@classmethod
def configured_class(cls): ...
class ArgReplacer:
name: Any
arg_pos: Any
def __init__(self, func, name) -> None: ...
def get_old_value(self, args, kwargs, default=...): ...
def replace(self, new_value, args, kwargs): ...
def timedelta_to_seconds(td): ...
def doctests(): ...

266
third_party/2/tornado/web.pyi vendored Normal file
View File

@@ -0,0 +1,266 @@
import sys
from typing import Any, Callable, Dict, List, Optional
from tornado import httputil
MIN_SUPPORTED_SIGNED_VALUE_VERSION: Any
MAX_SUPPORTED_SIGNED_VALUE_VERSION: Any
DEFAULT_SIGNED_VALUE_VERSION: Any
DEFAULT_SIGNED_VALUE_MIN_VERSION: Any
if sys.version_info[:2] >= (3, 5):
from typing import Awaitable
_MethodType = Callable[..., Optional[Awaitable[None]]]
else:
_MethodType = Callable[..., Any]
class RequestHandler:
SUPPORTED_METHODS: Any
application: Application
request: httputil.HTTPServerRequest
path_args: List[str]
path_kwargs: Dict[str, str]
ui: Any
def __init__(self, application, request, **kwargs) -> None: ...
initialize: Callable[..., None] = ...
@property
def settings(self): ...
head: _MethodType
get: _MethodType
post: _MethodType
delete: _MethodType
patch: _MethodType
put: _MethodType
options: _MethodType
def prepare(self): ...
def on_finish(self): ...
def on_connection_close(self): ...
def clear(self): ...
def set_default_headers(self): ...
def set_status(self, status_code, reason=...): ...
def get_status(self): ...
def set_header(self, name, value): ...
def add_header(self, name, value): ...
def clear_header(self, name): ...
def get_argument(self, name, default=..., strip=...): ...
def get_arguments(self, name, strip=...): ...
def get_body_argument(self, name, default=..., strip=...): ...
def get_body_arguments(self, name, strip=...): ...
def get_query_argument(self, name, default=..., strip=...): ...
def get_query_arguments(self, name, strip=...): ...
def decode_argument(self, value, name=...): ...
@property
def cookies(self): ...
def get_cookie(self, name, default=...): ...
def set_cookie(self, name, value, domain=..., expires=..., path=..., expires_days=..., **kwargs): ...
def clear_cookie(self, name, path=..., domain=...): ...
def clear_all_cookies(self, path=..., domain=...): ...
def set_secure_cookie(self, name, value, expires_days=..., version=..., **kwargs): ...
def create_signed_value(self, name, value, version=...): ...
def get_secure_cookie(self, name, value=..., max_age_days=..., min_version=...): ...
def get_secure_cookie_key_version(self, name, value=...): ...
def redirect(self, url, permanent=..., status=...): ...
def write(self, chunk): ...
def render(self, template_name, **kwargs): ...
def render_string(self, template_name, **kwargs): ...
def get_template_namespace(self): ...
def create_template_loader(self, template_path): ...
def flush(self, include_footers=..., callback=...): ...
def finish(self, chunk=...): ...
def send_error(self, status_code=..., **kwargs): ...
def write_error(self, status_code, **kwargs): ...
@property
def locale(self): ...
@locale.setter
def locale(self, value): ...
def get_user_locale(self): ...
def get_browser_locale(self, default=...): ...
@property
def current_user(self): ...
@current_user.setter
def current_user(self, value): ...
def get_current_user(self): ...
def get_login_url(self): ...
def get_template_path(self): ...
@property
def xsrf_token(self): ...
def check_xsrf_cookie(self): ...
def xsrf_form_html(self): ...
def static_url(self, path, include_host=..., **kwargs): ...
def require_setting(self, name, feature=...): ...
def reverse_url(self, name, *args): ...
def compute_etag(self): ...
def set_etag_header(self): ...
def check_etag_header(self): ...
def data_received(self, chunk): ...
def log_exception(self, typ, value, tb): ...
def asynchronous(method): ...
def stream_request_body(cls): ...
def removeslash(method): ...
def addslash(method): ...
class Application(httputil.HTTPServerConnectionDelegate):
transforms: Any
handlers: Any
named_handlers: Any
default_host: Any
settings: Any
ui_modules: Any
ui_methods: Any
def __init__(self, handlers=..., default_host=..., transforms=..., **settings) -> None: ...
def listen(self, port, address=..., **kwargs): ...
def add_handlers(self, host_pattern, host_handlers): ...
def add_transform(self, transform_class): ...
def start_request(self, server_conn, request_conn): ...
def __call__(self, request): ...
def reverse_url(self, name, *args): ...
def log_request(self, handler): ...
class _RequestDispatcher(httputil.HTTPMessageDelegate):
application: Any
connection: Any
request: Any
chunks: Any
handler_class: Any
handler_kwargs: Any
path_args: Any
path_kwargs: Any
def __init__(self, application, connection) -> None: ...
def headers_received(self, start_line, headers): ...
stream_request_body: Any
def set_request(self, request): ...
def data_received(self, data): ...
def finish(self): ...
def on_connection_close(self): ...
handler: Any
def execute(self): ...
class HTTPError(Exception):
status_code: Any
log_message: Any
args: Any
reason: Any
def __init__(self, status_code, log_message=..., *args, **kwargs) -> None: ...
class Finish(Exception): ...
class MissingArgumentError(HTTPError):
arg_name: Any
def __init__(self, arg_name) -> None: ...
class ErrorHandler(RequestHandler):
def initialize(self, status_code): ...
def prepare(self): ...
def check_xsrf_cookie(self): ...
class RedirectHandler(RequestHandler):
def initialize(self, url, permanent=...): ...
def get(self): ...
class StaticFileHandler(RequestHandler):
CACHE_MAX_AGE: Any
root: Any
default_filename: Any
def initialize(self, path, default_filename=...): ...
@classmethod
def reset(cls): ...
def head(self, path): ...
path: Any
absolute_path: Any
modified: Any
def get(self, path, include_body=...): ...
def compute_etag(self): ...
def set_headers(self): ...
def should_return_304(self): ...
@classmethod
def get_absolute_path(cls, root, path): ...
def validate_absolute_path(self, root, absolute_path): ...
@classmethod
def get_content(cls, abspath, start=..., end=...): ...
@classmethod
def get_content_version(cls, abspath): ...
def get_content_size(self): ...
def get_modified_time(self): ...
def get_content_type(self): ...
def set_extra_headers(self, path): ...
def get_cache_time(self, path, modified, mime_type): ...
@classmethod
def make_static_url(cls, settings, path, include_version=...): ...
def parse_url_path(self, url_path): ...
@classmethod
def get_version(cls, settings, path): ...
class FallbackHandler(RequestHandler):
fallback: Any
def initialize(self, fallback): ...
def prepare(self): ...
class OutputTransform:
def __init__(self, request) -> None: ...
def transform_first_chunk(self, status_code, headers, chunk, finishing): ...
def transform_chunk(self, chunk, finishing): ...
class GZipContentEncoding(OutputTransform):
CONTENT_TYPES: Any
MIN_LENGTH: Any
def __init__(self, request) -> None: ...
def transform_first_chunk(self, status_code, headers, chunk, finishing): ...
def transform_chunk(self, chunk, finishing): ...
def authenticated(method): ...
class UIModule:
handler: Any
request: Any
ui: Any
locale: Any
def __init__(self, handler) -> None: ...
@property
def current_user(self): ...
def render(self, *args, **kwargs): ...
def embedded_javascript(self): ...
def javascript_files(self): ...
def embedded_css(self): ...
def css_files(self): ...
def html_head(self): ...
def html_body(self): ...
def render_string(self, path, **kwargs): ...
class _linkify(UIModule):
def render(self, text, **kwargs): ...
class _xsrf_form_html(UIModule):
def render(self): ...
class TemplateModule(UIModule):
def __init__(self, handler) -> None: ...
def render(self, path, **kwargs): ...
def embedded_javascript(self): ...
def javascript_files(self): ...
def embedded_css(self): ...
def css_files(self): ...
def html_head(self): ...
def html_body(self): ...
class _UIModuleNamespace:
handler: Any
ui_modules: Any
def __init__(self, handler, ui_modules) -> None: ...
def __getitem__(self, key): ...
def __getattr__(self, key): ...
class URLSpec:
regex: Any
handler_class: Any
kwargs: Any
name: Any
def __init__(self, pattern, handler, kwargs=..., name=...) -> None: ...
def reverse(self, *args): ...
url: Any
def create_signed_value(secret, name, value, version=..., clock=..., key_version=...): ...
def decode_signed_value(secret, name, value, max_age_days=..., clock=..., min_version=...): ...
def get_signature_key_version(value): ...