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

View File

@@ -1,8 +1,7 @@
import ssl
from typing import Any, AnyStr, Dict, List, Union, Optional, Mapping, Callable, Sequence, Text, Tuple, Type
from urllib import addinfourl
from httplib import HTTPConnectionProtocol, HTTPResponse
from typing import Any, AnyStr, Callable, Dict, List, Mapping, Optional, Sequence, Text, Tuple, Type, Union
from urllib import addinfourl
_string = Union[str, unicode]
@@ -23,9 +22,14 @@ class Request(object):
type: Optional[str]
origin_req_host = ...
unredirected_hdrs: Dict[str, str]
def __init__(self, url: str, data: Optional[str] = ..., headers: Dict[str, str] = ...,
origin_req_host: Optional[str] = ..., unverifiable: bool = ...) -> None: ...
def __init__(
self,
url: str,
data: Optional[str] = ...,
headers: Dict[str, str] = ...,
origin_req_host: Optional[str] = ...,
unverifiable: bool = ...,
) -> None: ...
def __getattr__(self, attr): ...
def get_method(self) -> str: ...
def add_data(self, data) -> None: ...
@@ -47,23 +51,29 @@ class Request(object):
class OpenerDirector(object):
addheaders: List[Tuple[str, str]]
def add_handler(self, handler: BaseHandler) -> None: ...
def open(self, fullurl: Union[Request, _string], data: Optional[_string] = ..., timeout: Optional[float] = ...) -> Optional[addinfourl]: ...
def open(
self, fullurl: Union[Request, _string], data: Optional[_string] = ..., timeout: Optional[float] = ...
) -> Optional[addinfourl]: ...
def error(self, proto: _string, *args: Any): ...
# Note that this type is somewhat a lie. The return *can* be None if
# a custom opener has been installed that fails to handle the request.
def urlopen(url: Union[Request, _string], data: Optional[_string] = ..., timeout: Optional[float] = ...,
cafile: Optional[_string] = ..., capath: Optional[_string] = ..., cadefault: bool = ...,
context: Optional[ssl.SSLContext] = ...) -> addinfourl: ...
def urlopen(
url: Union[Request, _string],
data: Optional[_string] = ...,
timeout: Optional[float] = ...,
cafile: Optional[_string] = ...,
capath: Optional[_string] = ...,
cadefault: bool = ...,
context: Optional[ssl.SSLContext] = ...,
) -> addinfourl: ...
def install_opener(opener: OpenerDirector) -> None: ...
def build_opener(*handlers: Union[BaseHandler, Type[BaseHandler]]) -> OpenerDirector: ...
class BaseHandler:
handler_order: int
parent: OpenerDirector
def add_parent(self, parent: OpenerDirector) -> None: ...
def close(self) -> None: ...
def __lt__(self, other: Any) -> bool: ...
@@ -84,10 +94,8 @@ class HTTPRedirectHandler(BaseHandler):
def http_error_307(self, req: Request, fp: addinfourl, code: int, msg: str, headers: Mapping[str, str]): ...
inf_msg: str
class ProxyHandler(BaseHandler):
proxies: Mapping[str, str]
def __init__(self, proxies: Optional[Mapping[str, str]] = ...): ...
def proxy_open(self, req: Request, proxy, type): ...
@@ -118,8 +126,7 @@ class AbstractDigestAuthHandler:
def __init__(self, passwd: Optional[HTTPPasswordMgr] = ...) -> None: ...
def add_password(self, realm: Optional[Text], uri: Union[Text, Sequence[Text]], user: Text, passwd: Text) -> None: ...
def reset_retry_count(self) -> None: ...
def http_error_auth_reqed(self, auth_header: str, host: str, req: Request,
headers: Mapping[str, str]) -> None: ...
def http_error_auth_reqed(self, auth_header: str, host: str, req: Request, headers: Mapping[str, str]) -> None: ...
def retry_http_digest_auth(self, req: Request, auth: str) -> Optional[HTTPResponse]: ...
def get_cnonce(self, nonce: str) -> str: ...
def get_authorization(self, req: Request, chal: Mapping[str, str]) -> str: ...
@@ -140,10 +147,7 @@ class AbstractHTTPHandler(BaseHandler): # undocumented
def __init__(self, debuglevel: int = ...) -> None: ...
def set_http_debuglevel(self, level: int) -> None: ...
def do_request_(self, request: Request) -> Request: ...
def do_open(self,
http_class: HTTPConnectionProtocol,
req: Request,
**http_conn_args: Optional[Any]) -> addinfourl: ...
def do_open(self, http_class: HTTPConnectionProtocol, req: Request, **http_conn_args: Optional[Any]) -> addinfourl: ...
class HTTPHandler(AbstractHTTPHandler):
def http_open(self, req: Request) -> addinfourl: ...