apply black and isort (#4287)

* apply black and isort

* move some type ignores
This commit is contained in:
Jelle Zijlstra
2020-06-28 13:31:00 -07:00
committed by GitHub
parent fe58699ca5
commit 5d553c9584
800 changed files with 13875 additions and 10332 deletions
+16 -10
View File
@@ -1,17 +1,16 @@
import sys
from abc import abstractmethod
from types import TracebackType
from typing import Optional, Dict, MutableMapping, Type, Text, Callable, List, Tuple, IO
from typing import IO, Callable, Dict, List, MutableMapping, Optional, Text, Tuple, Type
from .headers import Headers
from .types import WSGIApplication, WSGIEnvironment, StartResponse, InputStream, ErrorStream
from .types import ErrorStream, InputStream, StartResponse, WSGIApplication, WSGIEnvironment
from .util import FileWrapper, guess_scheme
_exc_info = Tuple[Optional[Type[BaseException]],
Optional[BaseException],
Optional[TracebackType]]
_exc_info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
def format_date_time(timestamp: Optional[float]) -> str: ... # undocumented
if sys.version_info >= (3, 2):
def read_environ() -> Dict[str, str]: ...
@@ -34,15 +33,15 @@ class BaseHandler:
error_status: str
error_headers: List[Tuple[Text, Text]]
error_body: bytes
def run(self, application: WSGIApplication) -> None: ...
def setup_environ(self) -> None: ...
def finish_response(self) -> None: ...
def get_scheme(self) -> str: ...
def set_content_length(self) -> None: ...
def cleanup_headers(self) -> None: ...
def start_response(self, status: Text, headers: List[Tuple[Text, Text]], exc_info: Optional[_exc_info] = ...) -> Callable[[bytes], None]: ...
def start_response(
self, status: Text, headers: List[Tuple[Text, Text]], exc_info: Optional[_exc_info] = ...
) -> Callable[[bytes], None]: ...
def send_preamble(self) -> None: ...
def write(self, data: bytes) -> None: ...
def sendfile(self) -> bool: ...
@@ -54,7 +53,6 @@ class BaseHandler:
def log_exception(self, exc_info: _exc_info) -> None: ...
def handle_error(self) -> None: ...
def error_output(self, environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ...
@abstractmethod
def _write(self, data: bytes) -> None: ...
@abstractmethod
@@ -71,7 +69,15 @@ class SimpleHandler(BaseHandler):
stdout: IO[bytes]
stderr: ErrorStream
base_env: MutableMapping[str, str]
def __init__(self, stdin: InputStream, stdout: IO[bytes], stderr: ErrorStream, environ: MutableMapping[str, str], multithread: bool = ..., multiprocess: bool = ...) -> None: ...
def __init__(
self,
stdin: InputStream,
stdout: IO[bytes],
stderr: ErrorStream,
environ: MutableMapping[str, str],
multithread: bool = ...,
multiprocess: bool = ...,
) -> None: ...
def get_stdin(self) -> InputStream: ...
def get_stderr(self) -> ErrorStream: ...
def add_cgi_vars(self) -> None: ...
+1 -1
View File
@@ -1,5 +1,5 @@
import sys
from typing import overload, Pattern, Optional, List, Tuple
from typing import List, Optional, Pattern, Tuple, overload
_HeaderList = List[Tuple[str, str]]
+5 -4
View File
@@ -1,8 +1,8 @@
import sys
from typing import Optional, List, Type, TypeVar, overload
from typing import List, Optional, Type, TypeVar, overload
from .handlers import SimpleHandler
from .types import WSGIApplication, WSGIEnvironment, StartResponse, ErrorStream
from .types import ErrorStream, StartResponse, WSGIApplication, WSGIEnvironment
if sys.version_info < (3,):
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
@@ -33,8 +33,9 @@ class WSGIRequestHandler(BaseHTTPRequestHandler):
def demo_app(environ: WSGIEnvironment, start_response: StartResponse) -> List[bytes]: ...
_S = TypeVar("_S", bound=WSGIServer)
@overload
def make_server(host: str, port: int, app: WSGIApplication, *, handler_class: Type[WSGIRequestHandler] = ...) -> WSGIServer: ...
@overload
def make_server(host: str, port: int, app: WSGIApplication, server_class: Type[_S], handler_class: Type[WSGIRequestHandler] = ...) -> _S: ...
def make_server(
host: str, port: int, app: WSGIApplication, server_class: Type[_S], handler_class: Type[WSGIRequestHandler] = ...
) -> _S: ...
+2 -2
View File
@@ -1,7 +1,7 @@
import sys
from typing import Any, Iterable, Iterator, Optional, NoReturn, Callable
from typing import Any, Callable, Iterable, Iterator, NoReturn, Optional
from _typeshed.wsgi import WSGIApplication, InputStream, ErrorStream
from _typeshed.wsgi import ErrorStream, InputStream, WSGIApplication
class WSGIWarning(Warning): ...