diff --git a/stubs/requests/@tests/stubtest_allowlist.txt b/stubs/requests/@tests/stubtest_allowlist.txt index 236bdeafdf90..245ae698dc24 100644 --- a/stubs/requests/@tests/stubtest_allowlist.txt +++ b/stubs/requests/@tests/stubtest_allowlist.txt @@ -28,63 +28,6 @@ requests.models.RequestField.__init__ requests.models.RequestField.from_tuples requests.options requests.packages.VendorAlias -requests.packages.urllib3.HTTPConnectionPool.__init__ -requests.packages.urllib3.HTTPConnectionPool.urlopen -requests.packages.urllib3.HTTPResponse.__init__ -requests.packages.urllib3.HTTPSConnectionPool.__init__ -requests.packages.urllib3.NullHandler -requests.packages.urllib3.PoolManager.connection_from_host -requests.packages.urllib3.PoolManager.connection_from_url -requests.packages.urllib3.PoolManager.urlopen -requests.packages.urllib3.ProxyManager.__init__ -requests.packages.urllib3.ProxyManager.connection_from_host -requests.packages.urllib3.ProxyManager.urlopen -requests.packages.urllib3.Retry.is_forced_retry -requests.packages.urllib3.Retry.sleep -requests.packages.urllib3._collections.HTTPHeaderDict.from_httplib -requests.packages.urllib3._collections.HTTPHeaderDict.getlist -requests.packages.urllib3._collections.RLock -requests.packages.urllib3.connection.HTTPConnection.request -requests.packages.urllib3.connection.HTTPSConnection.__init__ -requests.packages.urllib3.connection.VerifiedHTTPSConnection.__init__ -requests.packages.urllib3.connection.VerifiedHTTPSConnection.set_cert -requests.packages.urllib3.connectionpool.ConnectionError -requests.packages.urllib3.connectionpool.HTTPConnection.request -requests.packages.urllib3.connectionpool.HTTPConnectionPool.__init__ -requests.packages.urllib3.connectionpool.HTTPConnectionPool.urlopen -requests.packages.urllib3.connectionpool.HTTPResponse.__init__ -requests.packages.urllib3.connectionpool.HTTPSConnection.__init__ -requests.packages.urllib3.connectionpool.HTTPSConnectionPool.__init__ -requests.packages.urllib3.connectionpool.ProxyError.__init__ -requests.packages.urllib3.connectionpool.RequestMethods.request_encode_url -requests.packages.urllib3.connectionpool.Retry.is_forced_retry -requests.packages.urllib3.connectionpool.Retry.sleep -requests.packages.urllib3.connectionpool.VerifiedHTTPSConnection.__init__ -requests.packages.urllib3.connectionpool.VerifiedHTTPSConnection.set_cert -requests.packages.urllib3.exceptions.ProxyError.__init__ -requests.packages.urllib3.fields.RequestField.__init__ -requests.packages.urllib3.fields.RequestField.from_tuples -requests.packages.urllib3.filepost.RequestField.__init__ -requests.packages.urllib3.filepost.RequestField.from_tuples -requests.packages.urllib3.poolmanager.PoolManager.connection_from_host -requests.packages.urllib3.poolmanager.PoolManager.connection_from_url -requests.packages.urllib3.poolmanager.PoolManager.urlopen -requests.packages.urllib3.poolmanager.ProxyManager.__init__ -requests.packages.urllib3.poolmanager.ProxyManager.connection_from_host -requests.packages.urllib3.poolmanager.ProxyManager.urlopen -requests.packages.urllib3.request.RequestMethods.request_encode_url -requests.packages.urllib3.response.HTTPHeaderDict.from_httplib -requests.packages.urllib3.response.HTTPHeaderDict.getlist -requests.packages.urllib3.response.HTTPResponse.__init__ -requests.packages.urllib3.response.PY3 -requests.packages.urllib3.util.Retry.is_forced_retry -requests.packages.urllib3.util.Retry.sleep -requests.packages.urllib3.util.connection.poll -requests.packages.urllib3.util.connection.select -requests.packages.urllib3.util.retry.Retry.is_forced_retry -requests.packages.urllib3.util.retry.Retry.sleep -requests.packages.urllib3.util.ssl_.create_default_context -requests.packages.urllib3.util.ssl_.ssl_wrap_socket requests.patch requests.post requests.put diff --git a/stubs/requests/METADATA.toml b/stubs/requests/METADATA.toml index e6e352159441..6ed98019159d 100644 --- a/stubs/requests/METADATA.toml +++ b/stubs/requests/METADATA.toml @@ -1,2 +1,3 @@ version = "2.27.*" +requires = ["types-urllib3<1.27"] # keep in sync with requests's setup.py python2 = true diff --git a/stubs/requests/requests/adapters.pyi b/stubs/requests/requests/adapters.pyi index 34cc23ef5ca8..575525ea28e2 100644 --- a/stubs/requests/requests/adapters.pyi +++ b/stubs/requests/requests/adapters.pyi @@ -1,8 +1,9 @@ from typing import Any, Container, Mapping, Text +from urllib3 import exceptions as urllib3_exceptions, poolmanager, response +from urllib3.util import retry + from . import cookies, exceptions, models, structures, utils -from .packages.urllib3 import exceptions as urllib3_exceptions, poolmanager, response -from .packages.urllib3.util import retry PreparedRequest = models.PreparedRequest Response = models.Response diff --git a/stubs/requests/requests/exceptions.pyi b/stubs/requests/requests/exceptions.pyi index 456496a7fc1c..88479bbca5f0 100644 --- a/stubs/requests/requests/exceptions.pyi +++ b/stubs/requests/requests/exceptions.pyi @@ -1,6 +1,6 @@ from typing import Any -from .packages.urllib3.exceptions import HTTPError as BaseHTTPError +from urllib3.exceptions import HTTPError as BaseHTTPError class RequestException(IOError): response: Any diff --git a/stubs/requests/requests/models.pyi b/stubs/requests/requests/models.pyi index db4e4214c880..466547a1aa19 100644 --- a/stubs/requests/requests/models.pyi +++ b/stubs/requests/requests/models.pyi @@ -2,9 +2,10 @@ import datetime from json import JSONDecoder from typing import Any, Callable, Iterator, Text, Type, TypeVar +from urllib3 import exceptions as urllib3_exceptions, fields, filepost, util + from . import auth, cookies, exceptions, hooks, status_codes, structures, utils from .cookies import RequestsCookieJar -from .packages.urllib3 import exceptions as urllib3_exceptions, fields, filepost, util _VT = TypeVar("_VT") diff --git a/stubs/requests/requests/packages/__init__.pyi b/stubs/requests/requests/packages/__init__.pyi index b50dba35e4ae..370324481c48 100644 --- a/stubs/requests/requests/packages/__init__.pyi +++ b/stubs/requests/requests/packages/__init__.pyi @@ -1,3 +1,5 @@ +# requests also imports urllib3 as requests.packages.urllib3, the stubs don't reflect that. + class VendorAlias: def __init__(self, package_names) -> None: ... def find_module(self, fullname, path=...): ... diff --git a/stubs/requests/requests/packages/urllib3/__init__.pyi b/stubs/requests/requests/packages/urllib3/__init__.pyi deleted file mode 100644 index f63b8fa12da6..000000000000 --- a/stubs/requests/requests/packages/urllib3/__init__.pyi +++ /dev/null @@ -1,26 +0,0 @@ -import logging -from typing import Any - -from . import connectionpool, filepost, poolmanager, response -from .util import request as _request, retry, timeout, url - -__license__: Any - -HTTPConnectionPool = connectionpool.HTTPConnectionPool -HTTPSConnectionPool = connectionpool.HTTPSConnectionPool -connection_from_url = connectionpool.connection_from_url -encode_multipart_formdata = filepost.encode_multipart_formdata -PoolManager = poolmanager.PoolManager -ProxyManager = poolmanager.ProxyManager -proxy_from_url = poolmanager.proxy_from_url -HTTPResponse = response.HTTPResponse -make_headers = _request.make_headers -get_host = url.get_host -Timeout = timeout.Timeout -Retry = retry.Retry - -class NullHandler(logging.Handler): - def emit(self, record): ... - -def add_stderr_logger(level=...): ... -def disable_warnings(category=...): ... diff --git a/stubs/requests/requests/packages/urllib3/_collections.pyi b/stubs/requests/requests/packages/urllib3/_collections.pyi deleted file mode 100644 index 15aca7bd6209..000000000000 --- a/stubs/requests/requests/packages/urllib3/_collections.pyi +++ /dev/null @@ -1,51 +0,0 @@ -from typing import Any, MutableMapping, NoReturn, TypeVar - -_KT = TypeVar("_KT") -_VT = TypeVar("_VT") - -class RLock: - def __enter__(self): ... - def __exit__(self, exc_type, exc_value, traceback): ... - -class RecentlyUsedContainer(MutableMapping[_KT, _VT]): - ContainerCls: Any - dispose_func: Any - lock: Any - def __init__(self, maxsize=..., dispose_func=...) -> None: ... - def __getitem__(self, key): ... - def __setitem__(self, key, value): ... - def __delitem__(self, key): ... - def __len__(self): ... - def __iter__(self): ... - def clear(self): ... - def keys(self): ... - -class HTTPHeaderDict(MutableMapping[str, str]): - def __init__(self, headers=..., **kwargs) -> None: ... - def __setitem__(self, key, val): ... - def __getitem__(self, key): ... - def __delitem__(self, key): ... - def __contains__(self, key): ... - def __eq__(self, other): ... - def __iter__(self) -> NoReturn: ... - def __len__(self) -> int: ... - def __ne__(self, other): ... - values: Any - get: Any - update: Any - iterkeys: Any - itervalues: Any - def pop(self, key, default=...): ... - def discard(self, key): ... - def add(self, key, val): ... - def extend(self, *args, **kwargs): ... - def getlist(self, key): ... - getheaders: Any - getallmatchingheaders: Any - iget: Any - def copy(self): ... - def iteritems(self): ... - def itermerged(self): ... - def items(self): ... - @classmethod - def from_httplib(cls, message, duplicates=...): ... diff --git a/stubs/requests/requests/packages/urllib3/connection.pyi b/stubs/requests/requests/packages/urllib3/connection.pyi deleted file mode 100644 index 39d0f6abbc93..000000000000 --- a/stubs/requests/requests/packages/urllib3/connection.pyi +++ /dev/null @@ -1,64 +0,0 @@ -import ssl -import sys -from typing import Any - -from . import exceptions, util -from .packages import ssl_match_hostname -from .util import ssl_ - -if sys.version_info >= (3, 0): - from builtins import ConnectionError as ConnectionError - from http.client import HTTPConnection as _HTTPConnection, HTTPException as HTTPException -else: - from httplib import HTTPConnection as _HTTPConnection, HTTPException as HTTPException - class ConnectionError(Exception): ... - -class DummyConnection: ... - -BaseSSLError = ssl.SSLError - -ConnectTimeoutError = exceptions.ConnectTimeoutError -SystemTimeWarning = exceptions.SystemTimeWarning -SecurityWarning = exceptions.SecurityWarning -match_hostname = ssl_match_hostname.match_hostname -resolve_cert_reqs = ssl_.resolve_cert_reqs -resolve_ssl_version = ssl_.resolve_ssl_version -ssl_wrap_socket = ssl_.ssl_wrap_socket -assert_fingerprint = ssl_.assert_fingerprint -connection = util.connection - -port_by_scheme: Any -RECENT_DATE: Any - -class HTTPConnection(_HTTPConnection): - default_port: Any - default_socket_options: Any - is_verified: Any - source_address: Any - socket_options: Any - def __init__(self, *args, **kw) -> None: ... - def connect(self): ... - -class HTTPSConnection(HTTPConnection): - default_port: Any - key_file: Any - cert_file: Any - def __init__(self, host, port=..., key_file=..., cert_file=..., strict=..., timeout=..., **kw) -> None: ... - sock: Any - def connect(self): ... - -class VerifiedHTTPSConnection(HTTPSConnection): - cert_reqs: Any - ca_certs: Any - ssl_version: Any - assert_fingerprint: Any - key_file: Any - cert_file: Any - assert_hostname: Any - def set_cert(self, key_file=..., cert_file=..., cert_reqs=..., ca_certs=..., assert_hostname=..., assert_fingerprint=...): ... - sock: Any - auto_open: Any - is_verified: Any - def connect(self): ... - -UnverifiedHTTPSConnection = HTTPSConnection diff --git a/stubs/requests/requests/packages/urllib3/connectionpool.pyi b/stubs/requests/requests/packages/urllib3/connectionpool.pyi deleted file mode 100644 index 90832482d6d7..000000000000 --- a/stubs/requests/requests/packages/urllib3/connectionpool.pyi +++ /dev/null @@ -1,121 +0,0 @@ -from typing import Any - -from . import connection, exceptions, request, response -from .connection import BaseSSLError as BaseSSLError, ConnectionError as ConnectionError, HTTPException as HTTPException -from .packages import ssl_match_hostname -from .util import connection as _connection, retry, timeout, url - -ClosedPoolError = exceptions.ClosedPoolError -ProtocolError = exceptions.ProtocolError -EmptyPoolError = exceptions.EmptyPoolError -HostChangedError = exceptions.HostChangedError -LocationValueError = exceptions.LocationValueError -MaxRetryError = exceptions.MaxRetryError -ProxyError = exceptions.ProxyError -ReadTimeoutError = exceptions.ReadTimeoutError -SSLError = exceptions.SSLError -TimeoutError = exceptions.TimeoutError -InsecureRequestWarning = exceptions.InsecureRequestWarning -CertificateError = ssl_match_hostname.CertificateError -port_by_scheme = connection.port_by_scheme -DummyConnection = connection.DummyConnection -HTTPConnection = connection.HTTPConnection -HTTPSConnection = connection.HTTPSConnection -VerifiedHTTPSConnection = connection.VerifiedHTTPSConnection -RequestMethods = request.RequestMethods -HTTPResponse = response.HTTPResponse -is_connection_dropped = _connection.is_connection_dropped -Retry = retry.Retry -Timeout = timeout.Timeout -get_host = url.get_host - -xrange: Any -log: Any - -class ConnectionPool: - scheme: Any - QueueCls: Any - host: Any - port: Any - def __init__(self, host, port=...) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type, exc_val, exc_tb): ... - def close(self): ... - -class HTTPConnectionPool(ConnectionPool, RequestMethods): - scheme: Any - ConnectionCls: Any - strict: Any - timeout: Any - retries: Any - pool: Any - block: Any - proxy: Any - proxy_headers: Any - num_connections: Any - num_requests: Any - conn_kw: Any - def __init__( - self, - host, - port=..., - strict=..., - timeout=..., - maxsize=..., - block=..., - headers=..., - retries=..., - _proxy=..., - _proxy_headers=..., - **conn_kw, - ) -> None: ... - def close(self): ... - def is_same_host(self, url): ... - def urlopen( - self, - method, - url, - body=..., - headers=..., - retries=..., - redirect=..., - assert_same_host=..., - timeout=..., - pool_timeout=..., - release_conn=..., - **response_kw, - ): ... - -class HTTPSConnectionPool(HTTPConnectionPool): - scheme: Any - ConnectionCls: Any - key_file: Any - cert_file: Any - cert_reqs: Any - ca_certs: Any - ssl_version: Any - assert_hostname: Any - assert_fingerprint: Any - def __init__( - self, - host, - port=..., - strict=..., - timeout=..., - maxsize=..., - block=..., - headers=..., - retries=..., - _proxy=..., - _proxy_headers=..., - key_file=..., - cert_file=..., - cert_reqs=..., - ca_certs=..., - ssl_version=..., - assert_hostname=..., - assert_fingerprint=..., - **conn_kw, - ) -> None: ... - -def connection_from_url(url, **kw): ... diff --git a/stubs/requests/requests/packages/urllib3/contrib/__init__.pyi b/stubs/requests/requests/packages/urllib3/contrib/__init__.pyi deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/stubs/requests/requests/packages/urllib3/exceptions.pyi b/stubs/requests/requests/packages/urllib3/exceptions.pyi deleted file mode 100644 index ddb4e83ba77e..000000000000 --- a/stubs/requests/requests/packages/urllib3/exceptions.pyi +++ /dev/null @@ -1,50 +0,0 @@ -from typing import Any - -class HTTPError(Exception): ... -class HTTPWarning(Warning): ... - -class PoolError(HTTPError): - pool: Any - def __init__(self, pool, message) -> None: ... - def __reduce__(self): ... - -class RequestError(PoolError): - url: Any - def __init__(self, pool, url, message) -> None: ... - def __reduce__(self): ... - -class SSLError(HTTPError): ... -class ProxyError(HTTPError): ... -class DecodeError(HTTPError): ... -class ProtocolError(HTTPError): ... - -ConnectionError: Any - -class MaxRetryError(RequestError): - reason: Any - def __init__(self, pool, url, reason=...) -> None: ... - -class HostChangedError(RequestError): - retries: Any - def __init__(self, pool, url, retries=...) -> None: ... - -class TimeoutStateError(HTTPError): ... -class TimeoutError(HTTPError): ... -class ReadTimeoutError(TimeoutError, RequestError): ... -class ConnectTimeoutError(TimeoutError): ... -class EmptyPoolError(PoolError): ... -class ClosedPoolError(PoolError): ... -class LocationValueError(ValueError, HTTPError): ... - -class LocationParseError(LocationValueError): - location: Any - def __init__(self, location) -> None: ... - -class ResponseError(HTTPError): - GENERIC_ERROR: Any - SPECIFIC_ERROR: Any - -class SecurityWarning(HTTPWarning): ... -class InsecureRequestWarning(SecurityWarning): ... -class SystemTimeWarning(SecurityWarning): ... -class InsecurePlatformWarning(SecurityWarning): ... diff --git a/stubs/requests/requests/packages/urllib3/fields.pyi b/stubs/requests/requests/packages/urllib3/fields.pyi deleted file mode 100644 index df18769b7263..000000000000 --- a/stubs/requests/requests/packages/urllib3/fields.pyi +++ /dev/null @@ -1,13 +0,0 @@ -from typing import Any - -def guess_content_type(filename, default=...): ... -def format_header_param(name, value): ... - -class RequestField: - data: Any - headers: Any - def __init__(self, name, data, filename=..., headers=...) -> None: ... - @classmethod - def from_tuples(cls, fieldname, value): ... - def render_headers(self): ... - def make_multipart(self, content_disposition=..., content_type=..., content_location=...): ... diff --git a/stubs/requests/requests/packages/urllib3/filepost.pyi b/stubs/requests/requests/packages/urllib3/filepost.pyi deleted file mode 100644 index 49bd7e046ab0..000000000000 --- a/stubs/requests/requests/packages/urllib3/filepost.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from typing import Any - -from . import fields - -RequestField = fields.RequestField - -writer: Any - -def choose_boundary(): ... -def iter_field_objects(fields): ... -def iter_fields(fields): ... -def encode_multipart_formdata(fields, boundary=...): ... diff --git a/stubs/requests/requests/packages/urllib3/packages/__init__.pyi b/stubs/requests/requests/packages/urllib3/packages/__init__.pyi deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyi b/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyi deleted file mode 100644 index 1915c0e5d00c..000000000000 --- a/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/__init__.pyi +++ /dev/null @@ -1,4 +0,0 @@ -import ssl - -CertificateError = ssl.CertificateError -match_hostname = ssl.match_hostname diff --git a/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyi b/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyi deleted file mode 100644 index c21998013cf2..000000000000 --- a/stubs/requests/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.pyi +++ /dev/null @@ -1,3 +0,0 @@ -class CertificateError(ValueError): ... - -def match_hostname(cert, hostname): ... diff --git a/stubs/requests/requests/packages/urllib3/poolmanager.pyi b/stubs/requests/requests/packages/urllib3/poolmanager.pyi deleted file mode 100644 index 68ad69622b66..000000000000 --- a/stubs/requests/requests/packages/urllib3/poolmanager.pyi +++ /dev/null @@ -1,28 +0,0 @@ -from typing import Any - -from .request import RequestMethods - -class PoolManager(RequestMethods): - proxy: Any - connection_pool_kw: Any - pools: Any - def __init__(self, num_pools=..., headers=..., **connection_pool_kw) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type, exc_val, exc_tb): ... - def clear(self): ... - def connection_from_host(self, host, port=..., scheme=...): ... - def connection_from_url(self, url): ... - # TODO: This was the original signature -- copied another one from base class to fix complaint. - # def urlopen(self, method, url, redirect=True, **kw): ... - def urlopen(self, method, url, body=..., headers=..., encode_multipart=..., multipart_boundary=..., **kw): ... - -class ProxyManager(PoolManager): - proxy: Any - proxy_headers: Any - def __init__(self, proxy_url, num_pools=..., headers=..., proxy_headers=..., **connection_pool_kw) -> None: ... - def connection_from_host(self, host, port=..., scheme=...): ... - # TODO: This was the original signature -- copied another one from base class to fix complaint. - # def urlopen(self, method, url, redirect=True, **kw): ... - def urlopen(self, method, url, body=..., headers=..., encode_multipart=..., multipart_boundary=..., **kw): ... - -def proxy_from_url(url, **kw): ... diff --git a/stubs/requests/requests/packages/urllib3/request.pyi b/stubs/requests/requests/packages/urllib3/request.pyi deleted file mode 100644 index b95ab295ba84..000000000000 --- a/stubs/requests/requests/packages/urllib3/request.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any - -class RequestMethods: - headers: Any - def __init__(self, headers=...) -> None: ... - def urlopen(self, method, url, body=..., headers=..., encode_multipart=..., multipart_boundary=..., **kw): ... - def request(self, method, url, fields=..., headers=..., **urlopen_kw): ... - def request_encode_url(self, method, url, fields=..., **urlopen_kw): ... - def request_encode_body( - self, method, url, fields=..., headers=..., encode_multipart=..., multipart_boundary=..., **urlopen_kw - ): ... diff --git a/stubs/requests/requests/packages/urllib3/response.pyi b/stubs/requests/requests/packages/urllib3/response.pyi deleted file mode 100644 index 1c78b48a2572..000000000000 --- a/stubs/requests/requests/packages/urllib3/response.pyi +++ /dev/null @@ -1,66 +0,0 @@ -import io -from typing import Any - -from . import _collections, exceptions -from .connection import BaseSSLError as BaseSSLError, HTTPException as HTTPException -from .util import response - -HTTPHeaderDict = _collections.HTTPHeaderDict -ProtocolError = exceptions.ProtocolError -DecodeError = exceptions.DecodeError -ReadTimeoutError = exceptions.ReadTimeoutError -binary_type = bytes # six.binary_type -PY3 = True # six.PY3 -is_fp_closed = response.is_fp_closed - -class DeflateDecoder: - def __init__(self) -> None: ... - def __getattr__(self, name): ... - def decompress(self, data): ... - -class GzipDecoder: - def __init__(self) -> None: ... - def __getattr__(self, name): ... - def decompress(self, data): ... - -class HTTPResponse(io.IOBase): - CONTENT_DECODERS: Any - REDIRECT_STATUSES: Any - headers: Any - status: Any - version: Any - reason: Any - strict: Any - decode_content: Any - def __init__( - self, - body=..., - headers=..., - status=..., - version=..., - reason=..., - strict=..., - preload_content=..., - decode_content=..., - original_response=..., - pool=..., - connection=..., - ) -> None: ... - def get_redirect_location(self): ... - def release_conn(self): ... - @property - def data(self): ... - def tell(self): ... - def read(self, amt=..., decode_content=..., cache_content=...): ... - def stream(self, amt=..., decode_content=...): ... - @classmethod - def from_httplib(cls, r, **response_kw): ... - def getheaders(self): ... - def getheader(self, name, default=...): ... - def close(self): ... - @property - def closed(self): ... - def fileno(self): ... - def flush(self): ... - def readable(self): ... - def readinto(self, b): ... diff --git a/stubs/requests/requests/packages/urllib3/util/__init__.pyi b/stubs/requests/requests/packages/urllib3/util/__init__.pyi deleted file mode 100644 index 2d0d66dcb603..000000000000 --- a/stubs/requests/requests/packages/urllib3/util/__init__.pyi +++ /dev/null @@ -1,20 +0,0 @@ -import ssl - -from . import connection, request, response, retry, ssl_, timeout, url - -is_connection_dropped = connection.is_connection_dropped -make_headers = request.make_headers -is_fp_closed = response.is_fp_closed -SSLContext = ssl.SSLContext -HAS_SNI = ssl_.HAS_SNI -assert_fingerprint = ssl_.assert_fingerprint -resolve_cert_reqs = ssl_.resolve_cert_reqs -resolve_ssl_version = ssl_.resolve_ssl_version -ssl_wrap_socket = ssl_.ssl_wrap_socket -current_time = timeout.current_time -Timeout = timeout.Timeout -Retry = retry.Retry -get_host = url.get_host -parse_url = url.parse_url -split_first = url.split_first -Url = url.Url diff --git a/stubs/requests/requests/packages/urllib3/util/connection.pyi b/stubs/requests/requests/packages/urllib3/util/connection.pyi deleted file mode 100644 index db77bd0095dd..000000000000 --- a/stubs/requests/requests/packages/urllib3/util/connection.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from typing import Any - -poll: Any -select: Any -HAS_IPV6: bool - -def is_connection_dropped(conn): ... -def create_connection(address, timeout=..., source_address=..., socket_options=...): ... diff --git a/stubs/requests/requests/packages/urllib3/util/request.pyi b/stubs/requests/requests/packages/urllib3/util/request.pyi deleted file mode 100644 index f770cd9faa73..000000000000 --- a/stubs/requests/requests/packages/urllib3/util/request.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from typing import Any - -# from ..packages import six - -# b = six.b - -ACCEPT_ENCODING: Any - -def make_headers( - keep_alive=..., accept_encoding=..., user_agent=..., basic_auth=..., proxy_basic_auth=..., disable_cache=... -): ... diff --git a/stubs/requests/requests/packages/urllib3/util/response.pyi b/stubs/requests/requests/packages/urllib3/util/response.pyi deleted file mode 100644 index 30463da4e4de..000000000000 --- a/stubs/requests/requests/packages/urllib3/util/response.pyi +++ /dev/null @@ -1 +0,0 @@ -def is_fp_closed(obj): ... diff --git a/stubs/requests/requests/packages/urllib3/util/retry.pyi b/stubs/requests/requests/packages/urllib3/util/retry.pyi deleted file mode 100644 index c4aedaa6cc62..000000000000 --- a/stubs/requests/requests/packages/urllib3/util/retry.pyi +++ /dev/null @@ -1,49 +0,0 @@ -from typing import Any - -from .. import exceptions - -ConnectTimeoutError = exceptions.ConnectTimeoutError -MaxRetryError = exceptions.MaxRetryError -ProtocolError = exceptions.ProtocolError -ReadTimeoutError = exceptions.ReadTimeoutError -ResponseError = exceptions.ResponseError - -log: Any - -class Retry: - DEFAULT_METHOD_WHITELIST: Any - BACKOFF_MAX: Any - total: Any - connect: Any - read: Any - redirect: Any - status_forcelist: Any - method_whitelist: Any - backoff_factor: Any - raise_on_redirect: Any - def __init__( - self, - total=..., - connect=..., - read=..., - redirect=..., - status=..., - other=..., - allowed_methods=..., - status_forcelist=..., - backoff_factor=..., - raise_on_redirect=..., - raise_on_status=..., - history=..., - respect_retry_after_header=..., - remove_headers_on_redirect=..., - method_whitelist=..., - ) -> None: ... - def new(self, **kw): ... - @classmethod - def from_int(cls, retries, redirect=..., default=...): ... - def get_backoff_time(self): ... - def sleep(self): ... - def is_forced_retry(self, method, status_code): ... - def is_exhausted(self): ... - def increment(self, method=..., url=..., response=..., error=..., _pool=..., _stacktrace=...): ... diff --git a/stubs/requests/requests/packages/urllib3/util/ssl_.pyi b/stubs/requests/requests/packages/urllib3/util/ssl_.pyi deleted file mode 100644 index 1542e91da79a..000000000000 --- a/stubs/requests/requests/packages/urllib3/util/ssl_.pyi +++ /dev/null @@ -1,30 +0,0 @@ -import ssl -from typing import Any - -from .. import exceptions - -SSLError = exceptions.SSLError -InsecurePlatformWarning = exceptions.InsecurePlatformWarning -SSLContext = ssl.SSLContext - -HAS_SNI: Any -create_default_context: Any -OP_NO_SSLv2: Any -OP_NO_SSLv3: Any -OP_NO_COMPRESSION: Any - -def assert_fingerprint(cert, fingerprint): ... -def resolve_cert_reqs(candidate): ... -def resolve_ssl_version(candidate): ... -def create_urllib3_context(ssl_version=..., cert_reqs=..., options=..., ciphers=...): ... -def ssl_wrap_socket( - sock, - keyfile=..., - certfile=..., - cert_reqs=..., - ca_certs=..., - server_hostname=..., - ssl_version=..., - ciphers=..., - ssl_context=..., -): ... diff --git a/stubs/requests/requests/packages/urllib3/util/timeout.pyi b/stubs/requests/requests/packages/urllib3/util/timeout.pyi deleted file mode 100644 index 25879d685ea9..000000000000 --- a/stubs/requests/requests/packages/urllib3/util/timeout.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from typing import Any - -from .. import exceptions - -TimeoutStateError = exceptions.TimeoutStateError - -def current_time(): ... - -class Timeout: - DEFAULT_TIMEOUT: Any - total: Any - def __init__(self, total=..., connect=..., read=...) -> None: ... - @classmethod - def from_float(cls, timeout): ... - def clone(self): ... - def start_connect(self): ... - def get_connect_duration(self): ... - @property - def connect_timeout(self): ... - @property - def read_timeout(self): ... diff --git a/stubs/requests/requests/packages/urllib3/util/url.pyi b/stubs/requests/requests/packages/urllib3/util/url.pyi deleted file mode 100644 index 2d43e2d2626d..000000000000 --- a/stubs/requests/requests/packages/urllib3/util/url.pyi +++ /dev/null @@ -1,23 +0,0 @@ -from typing import Any - -from .. import exceptions - -LocationParseError = exceptions.LocationParseError - -url_attrs: Any - -class Url: - slots: Any - def __new__(cls, scheme=..., auth=..., host=..., port=..., path=..., query=..., fragment=...): ... - @property - def hostname(self): ... - @property - def request_uri(self): ... - @property - def netloc(self): ... - @property - def url(self): ... - -def split_first(s, delims): ... -def parse_url(url): ... -def get_host(url): ... diff --git a/stubs/requests/requests/sessions.pyi b/stubs/requests/requests/sessions.pyi index c01e32a6bf3a..1250a32836a5 100644 --- a/stubs/requests/requests/sessions.pyi +++ b/stubs/requests/requests/sessions.pyi @@ -1,9 +1,10 @@ from _typeshed import SupportsItems from typing import IO, Any, Callable, Iterable, Mapping, MutableMapping, Optional, Text, TypeVar, Union +from urllib3 import _collections + from . import adapters, auth as _auth, compat, cookies, exceptions, hooks, models, status_codes, structures, utils from .models import Response -from .packages.urllib3 import _collections _KT = TypeVar("_KT") _VT = TypeVar("_VT") diff --git a/stubs/urllib3/METADATA.toml b/stubs/urllib3/METADATA.toml index 68342cc21165..aae196c41ab1 100644 --- a/stubs/urllib3/METADATA.toml +++ b/stubs/urllib3/METADATA.toml @@ -1 +1,2 @@ version = "1.26.*" +python2 = true