Convert namedtuples to class syntax (#3321)

This commit is contained in:
Sebastian Rittau
2019-10-20 10:37:33 +02:00
committed by GitHub
parent 2b9dc7b9c2
commit ec7960a8cb
41 changed files with 397 additions and 383 deletions

View File

@@ -1,5 +1,4 @@
from typing import Any
from collections import namedtuple
from typing import Any, Dict, NamedTuple, Tuple
singledispatch: Any
@@ -104,6 +103,8 @@ class Runner:
def result_callback(self, key): ...
def handle_exception(self, typ, value, tb): ...
Arguments = namedtuple('Arguments', ['args', 'kwargs'])
class Arguments(NamedTuple):
args: Tuple[str, ...]
kwargs: Dict[str, Any]
def convert_yielded(yielded): ...

View File

@@ -1,6 +1,6 @@
from typing import Any, Dict
from typing import Any, Dict, NamedTuple
from tornado.util import ObjectDict
from collections import namedtuple
class SSLError(Exception): ...
@@ -79,11 +79,17 @@ def parse_body_arguments(content_type, body, arguments, files, headers=...): ...
def parse_multipart_form_data(boundary, data, arguments, files): ...
def format_timestamp(ts): ...
RequestStartLine = namedtuple('RequestStartLine', ['method', 'path', 'version'])
class RequestStartLine(NamedTuple):
method: str
path: str
version: str
def parse_request_start_line(line): ...
ResponseStartLine = namedtuple('ResponseStartLine', ['version', 'code', 'reason'])
class ResponseStartLine(NamedTuple):
version: str
code: str
reason: str
def parse_response_start_line(line): ...
def doctests(): ...