diff --git a/third_party/3/requests/adapters.pyi b/third_party/3/requests/adapters.pyi index b86bbf7ad..81d021281 100644 --- a/third_party/3/requests/adapters.pyi +++ b/third_party/3/requests/adapters.pyi @@ -1,6 +1,6 @@ # Stubs for requests.adapters (Python 3) -from typing import Any, Container, Union, Tuple +from typing import Any, Container, Union, Text, Tuple from . import models from .packages.urllib3 import poolmanager from .packages.urllib3 import response @@ -47,7 +47,7 @@ class BaseAdapter: def send(self, request: PreparedRequest, stream: bool=False, timeout: Union[None, float, Tuple[float, float]]=None, verify: bool=False, - cert: Union[None, Union[str, bytes], Container[Union[str, bytes]]]=None + cert: Union[None, Union[bytes, Text], Container[Union[bytes, Text]]]=None ) -> Response: ... def close(self) -> None: ... class HTTPAdapter(BaseAdapter): diff --git a/third_party/3/requests/api.pyi b/third_party/3/requests/api.pyi index 856a6e58e..85afdc536 100644 --- a/third_party/3/requests/api.pyi +++ b/third_party/3/requests/api.pyi @@ -4,24 +4,23 @@ from typing import Optional, Union, Any, Iterable, Mapping, MutableMapping, Tupl from .models import Response -_ParamsMappingValueType = Union[str, bytes, int, float, Iterable[Union[str, bytes, int, float]]] +_ParamsMappingValueType = Union[Text, bytes, int, float, Iterable[Union[Text, bytes, int, float]]] _Data = Union[None, bytes, MutableMapping[Text, Text], IO] def request(method: str, url: str, **kwargs) -> Response: ... -def get(url: Union[str, bytes], +def get(url: Union[Text, bytes], params: Optional[ - Union[ - Mapping[Union[str, bytes, int, float], _ParamsMappingValueType], - Union[str, bytes], - Tuple[Union[str, bytes, int, float], _ParamsMappingValueType], - Mapping[str, _ParamsMappingValueType], - Mapping[bytes, _ParamsMappingValueType], - Mapping[int, _ParamsMappingValueType], - Mapping[float, _ParamsMappingValueType]]]=None, + Union[Mapping[Union[Text, bytes, int, float], _ParamsMappingValueType], + Union[Text, bytes], + Tuple[Union[Text, bytes, int, float], _ParamsMappingValueType], + Mapping[Text, _ParamsMappingValueType], + Mapping[bytes, _ParamsMappingValueType], + Mapping[int, _ParamsMappingValueType], + Mapping[float, _ParamsMappingValueType]]] = None, **kwargs) -> Response: ... -def options(url: str, **kwargs) -> Response: ... -def head(url: str, **kwargs) -> Response: ... -def post(url: str, data: _Data = ..., json: Optional[MutableMapping] = ..., **kwargs) -> Response: ... -def put(url: str, data: _Data = ..., **kwargs) -> Response: ... -def patch(url: str, data: _Data = ..., **kwargs) -> Response: ... -def delete(url: str, **kwargs) -> Response: ... +def options(url: Union[str, Text], **kwargs) -> Response: ... +def head(url: Union[str, Text], **kwargs) -> Response: ... +def post(url: Union[str, Text], data: _Data = ..., json: Optional[MutableMapping] = ..., **kwargs) -> Response: ... +def put(url: Union[str, Text], data: _Data = ..., **kwargs) -> Response: ... +def patch(url: Union[str, Text], data: _Data = ..., **kwargs) -> Response: ... +def delete(url: Union[str, Text], **kwargs) -> Response: ... diff --git a/third_party/3/requests/cookies.pyi b/third_party/3/requests/cookies.pyi index f3bd57eed..66650210e 100644 --- a/third_party/3/requests/cookies.pyi +++ b/third_party/3/requests/cookies.pyi @@ -1,12 +1,14 @@ # Stubs for requests.cookies (Python 3) +import sys from typing import Any, MutableMapping -# import cookielib -from http import cookiejar as cookielib import collections from . import compat -# cookielib = compat.cookielib +if sys.version_info < (3, 0): + from cookielib import CookieJar +else: + from http.cookiejar import CookieJar class MockRequest: type = ... # type: Any @@ -39,7 +41,7 @@ def remove_cookie_by_name(cookiejar, name, domain=..., path=...): ... class CookieConflictError(RuntimeError): ... -class RequestsCookieJar(cookielib.CookieJar, MutableMapping): +class RequestsCookieJar(CookieJar, MutableMapping): def get(self, name, default=..., domain=..., path=...): ... def set(self, name, value, **kwargs): ... def iterkeys(self): ... diff --git a/third_party/3/requests/models.pyi b/third_party/3/requests/models.pyi index 7789899dc..265670fe8 100644 --- a/third_party/3/requests/models.pyi +++ b/third_party/3/requests/models.pyi @@ -1,6 +1,6 @@ # Stubs for requests.models (Python 3) -from typing import Any, List, MutableMapping, Iterator, Dict +from typing import Any, List, MutableMapping, Iterator, Dict, Text import datetime from . import hooks @@ -80,10 +80,10 @@ class Request(RequestHooksMixin): def prepare(self): ... class PreparedRequest(RequestEncodingMixin, RequestHooksMixin): - method = ... # type: Optional[str] - url = ... # type: Optional[str] + method = ... # type: Optional[Union[str, Text]] + url = ... # type: Optional[Union[str, Text]] headers = ... # type: CaseInsensitiveDict - body = ... # type: Optional[Union[str, bytes]] + body = ... # type: Optional[Union[bytes, Text]] hooks = ... # type: Any def __init__(self) -> None: ... def prepare(self, method=..., url=..., headers=..., files=..., data=..., params=..., diff --git a/third_party/3/requests/packages/urllib3/connection.pyi b/third_party/3/requests/packages/urllib3/connection.pyi index 77e4c429d..6e51d3575 100644 --- a/third_party/3/requests/packages/urllib3/connection.pyi +++ b/third_party/3/requests/packages/urllib3/connection.pyi @@ -1,21 +1,28 @@ # Stubs for requests.packages.urllib3.connection (Python 3.4) +import sys from typing import Any from . import packages -from http.client import HTTPConnection as _HTTPConnection import ssl -# from httplib import HTTPConnection as _HTTPConnection # python 2 from . import exceptions from .packages import ssl_match_hostname from .util import ssl_ from . import util -import http.client + +if sys.version_info <= (3, 0): + from httplib import HTTPConnection as _HTTPConnection + from httplib import HTTPException as HTTPException + + class ConnectionError(Exception): ... +else: + from http.client import HTTPConnection as _HTTPConnection + from http.client import HTTPException as HTTPException + from builtins import ConnectionError as ConnectionError + class DummyConnection: ... BaseSSLError = ssl.SSLError -ConnectionError = __builtins__.ConnectionError -HTTPException = http.client.HTTPException ConnectTimeoutError = exceptions.ConnectTimeoutError SystemTimeWarning = exceptions.SystemTimeWarning @@ -61,4 +68,4 @@ class VerifiedHTTPSConnection(HTTPSConnection): is_verified = ... # type: Any def connect(self): ... -UnverifiedHTTPSConnection = ... # type: Any +UnverifiedHTTPSConnection = HTTPSConnection diff --git a/third_party/3/requests/packages/urllib3/response.pyi b/third_party/3/requests/packages/urllib3/response.pyi index ba2a80164..b6f418a94 100644 --- a/third_party/3/requests/packages/urllib3/response.pyi +++ b/third_party/3/requests/packages/urllib3/response.pyi @@ -2,11 +2,9 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any -import io +from typing import Any, IO from . import _collections from . import exceptions -# from .packages import six from .connection import HTTPException as HTTPException, BaseSSLError as BaseSSLError from .util import response @@ -28,7 +26,7 @@ class GzipDecoder: def __getattr__(self, name): ... def decompress(self, data): ... -class HTTPResponse(io.IOBase): +class HTTPResponse(IO[Any]): CONTENT_DECODERS = ... # type: Any REDIRECT_STATUSES = ... # type: Any headers = ... # type: Any diff --git a/third_party/3/requests/sessions.pyi b/third_party/3/requests/sessions.pyi index 077d3c77f..252f7ee14 100644 --- a/third_party/3/requests/sessions.pyi +++ b/third_party/3/requests/sessions.pyi @@ -92,19 +92,19 @@ class Session(SessionRedirectMixin): cert: Union[Text, Tuple[Text, Text], None] = ..., json: Optional[MutableMapping] = ..., ) -> Response: ... - def get(self, url: Union[str, bytes], **kwargs) -> Response: ... - def options(self, url: Union[str, bytes], **kwargs) -> Response: ... - def head(self, url: Union[str, bytes], **kwargs) -> Response: ... - def post(self, url: Union[str, bytes], data: _Data = ..., json: Optional[MutableMapping] = ..., **kwargs) -> Response: ... - def put(self, url: Union[str, bytes], data: _Data = ..., **kwargs) -> Response: ... - def patch(self, url: Union[str, bytes], data: _Data = ..., **kwargs) -> Response: ... - def delete(self, url: Union[str, bytes], **kwargs) -> Response: ... + def get(self, url: Union[Text, bytes], **kwargs) -> Response: ... + def options(self, url: Union[Text, bytes], **kwargs) -> Response: ... + def head(self, url: Union[Text, bytes], **kwargs) -> Response: ... + def post(self, url: Union[Text, bytes], data: _Data = ..., json: Optional[MutableMapping] = ..., **kwargs) -> Response: ... + def put(self, url: Union[Text, bytes], data: _Data = ..., **kwargs) -> Response: ... + def patch(self, url: Union[Text, bytes], data: _Data = ..., **kwargs) -> Response: ... + def delete(self, url: Union[Text, bytes], **kwargs) -> Response: ... def send(self, request, **kwargs): ... def merge_environment_settings(self, url, proxies, stream, verify, cert): ... def get_adapter(self, url): ... def close(self) -> None: ... def mount(self, prefix: - Union[str, bytes], + Union[Text, bytes], adapter: BaseAdapter) -> None: ... def session() -> Session: ... diff --git a/third_party/3/requests/structures.pyi b/third_party/3/requests/structures.pyi index af4273bfd..53af72d8f 100644 --- a/third_party/3/requests/structures.pyi +++ b/third_party/3/requests/structures.pyi @@ -1,9 +1,9 @@ # Stubs for requests.structures (Python 3) -from typing import Any, Iterator, MutableMapping, Tuple, Union +from typing import Any, Iterator, MutableMapping, Text, Tuple, Union -class CaseInsensitiveDict(MutableMapping[str, Union[str, bytes]]): - def lower_items(self) -> Iterator[Tuple[str, Union[str, bytes]]]: ... +class CaseInsensitiveDict(MutableMapping[str, Union[Text, bytes]]): + def lower_items(self) -> Iterator[Tuple[str, Union[Text, bytes]]]: ... class LookupDict(dict): name = ... # type: Any