Skip to content

Add back tornado stubs for Python 2 only #4412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
43 changes: 43 additions & 0 deletions third_party/2/tornado/concurrent.pyi
Original file line number Diff line number Diff line change
@@ -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 changes: 110 additions & 0 deletions third_party/2/tornado/gen.pyi
Original file line number Diff line number Diff line change
@@ -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 changes: 127 additions & 0 deletions third_party/2/tornado/httpclient.pyi
Original file line number Diff line number Diff line change
@@ -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 changes: 57 additions & 0 deletions third_party/2/tornado/httpserver.pyi
Original file line number Diff line number Diff line change
@@ -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
Loading