diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index 2441f5863a95..be9759ac051a 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -63,6 +63,7 @@ "stubs/SQLAlchemy", "stubs/stripe", "stubs/ttkthemes", + "stubs/urllib3", "stubs/vobject" ], "typeCheckingMode": "basic", diff --git a/stubs/urllib3/@tests/stubtest_allowlist.txt b/stubs/urllib3/@tests/stubtest_allowlist.txt new file mode 100644 index 000000000000..c1ad59f1549d --- /dev/null +++ b/stubs/urllib3/@tests/stubtest_allowlist.txt @@ -0,0 +1,59 @@ +urllib3.HTTPConnectionPool.__init__ +urllib3.HTTPConnectionPool.urlopen +urllib3.HTTPResponse.__init__ +urllib3.HTTPSConnectionPool.__init__ +urllib3.NullHandler +urllib3.PoolManager.connection_from_host +urllib3.PoolManager.connection_from_url +urllib3.PoolManager.urlopen +urllib3.ProxyManager.__init__ +urllib3.ProxyManager.connection_from_host +urllib3.ProxyManager.urlopen +urllib3.Retry.is_forced_retry +urllib3.Retry.sleep +urllib3._collections.HTTPHeaderDict.from_httplib +urllib3._collections.HTTPHeaderDict.getlist +urllib3._collections.RLock +urllib3.connection.HTTPConnection.request +urllib3.connection.HTTPSConnection.__init__ +urllib3.connection.VerifiedHTTPSConnection.__init__ +urllib3.connection.VerifiedHTTPSConnection.set_cert +urllib3.connectionpool.ConnectionError +urllib3.connectionpool.HTTPConnection.request +urllib3.connectionpool.HTTPConnectionPool.__init__ +urllib3.connectionpool.HTTPConnectionPool.urlopen +urllib3.connectionpool.HTTPResponse.__init__ +urllib3.connectionpool.HTTPSConnection.__init__ +urllib3.connectionpool.HTTPSConnectionPool.__init__ +urllib3.connectionpool.ProxyError.__init__ +urllib3.connectionpool.RequestMethods.request_encode_url +urllib3.connectionpool.Retry.is_forced_retry +urllib3.connectionpool.Retry.sleep +urllib3.connectionpool.VerifiedHTTPSConnection.__init__ +urllib3.connectionpool.VerifiedHTTPSConnection.set_cert +urllib3.exceptions.ProxyError.__init__ +urllib3.fields.RequestField.__init__ +urllib3.fields.RequestField.from_tuples +urllib3.filepost.RequestField.__init__ +urllib3.filepost.RequestField.from_tuples +urllib3.packages.ssl_match_hostname +urllib3.packages.ssl_match_hostname._implementation +urllib3.poolmanager.PoolManager.connection_from_host +urllib3.poolmanager.PoolManager.connection_from_url +urllib3.poolmanager.PoolManager.urlopen +urllib3.poolmanager.ProxyManager.__init__ +urllib3.poolmanager.ProxyManager.connection_from_host +urllib3.poolmanager.ProxyManager.urlopen +urllib3.request.RequestMethods.request_encode_url +urllib3.response.HTTPHeaderDict.from_httplib +urllib3.response.HTTPHeaderDict.getlist +urllib3.response.HTTPResponse.__init__ +urllib3.response.PY3 +urllib3.util.Retry.is_forced_retry +urllib3.util.Retry.sleep +urllib3.util.connection.poll +urllib3.util.connection.select +urllib3.util.retry.Retry.is_forced_retry +urllib3.util.retry.Retry.sleep +urllib3.util.ssl_.create_default_context +urllib3.util.ssl_.ssl_wrap_socket diff --git a/stubs/urllib3/METADATA.toml b/stubs/urllib3/METADATA.toml new file mode 100644 index 000000000000..68342cc21165 --- /dev/null +++ b/stubs/urllib3/METADATA.toml @@ -0,0 +1 @@ +version = "1.26.*" diff --git a/stubs/urllib3/urllib3/__init__.pyi b/stubs/urllib3/urllib3/__init__.pyi new file mode 100644 index 000000000000..f63b8fa12da6 --- /dev/null +++ b/stubs/urllib3/urllib3/__init__.pyi @@ -0,0 +1,26 @@ +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/urllib3/urllib3/_collections.pyi b/stubs/urllib3/urllib3/_collections.pyi new file mode 100644 index 000000000000..15aca7bd6209 --- /dev/null +++ b/stubs/urllib3/urllib3/_collections.pyi @@ -0,0 +1,51 @@ +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/urllib3/urllib3/connection.pyi b/stubs/urllib3/urllib3/connection.pyi new file mode 100644 index 000000000000..39d0f6abbc93 --- /dev/null +++ b/stubs/urllib3/urllib3/connection.pyi @@ -0,0 +1,64 @@ +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/urllib3/urllib3/connectionpool.pyi b/stubs/urllib3/urllib3/connectionpool.pyi new file mode 100644 index 000000000000..90832482d6d7 --- /dev/null +++ b/stubs/urllib3/urllib3/connectionpool.pyi @@ -0,0 +1,121 @@ +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/urllib3/urllib3/contrib/__init__.pyi b/stubs/urllib3/urllib3/contrib/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/stubs/urllib3/urllib3/exceptions.pyi b/stubs/urllib3/urllib3/exceptions.pyi new file mode 100644 index 000000000000..ddb4e83ba77e --- /dev/null +++ b/stubs/urllib3/urllib3/exceptions.pyi @@ -0,0 +1,50 @@ +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/urllib3/urllib3/fields.pyi b/stubs/urllib3/urllib3/fields.pyi new file mode 100644 index 000000000000..df18769b7263 --- /dev/null +++ b/stubs/urllib3/urllib3/fields.pyi @@ -0,0 +1,13 @@ +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/urllib3/urllib3/filepost.pyi b/stubs/urllib3/urllib3/filepost.pyi new file mode 100644 index 000000000000..49bd7e046ab0 --- /dev/null +++ b/stubs/urllib3/urllib3/filepost.pyi @@ -0,0 +1,12 @@ +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/urllib3/urllib3/packages/__init__.pyi b/stubs/urllib3/urllib3/packages/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/stubs/urllib3/urllib3/packages/ssl_match_hostname/__init__.pyi b/stubs/urllib3/urllib3/packages/ssl_match_hostname/__init__.pyi new file mode 100644 index 000000000000..1915c0e5d00c --- /dev/null +++ b/stubs/urllib3/urllib3/packages/ssl_match_hostname/__init__.pyi @@ -0,0 +1,4 @@ +import ssl + +CertificateError = ssl.CertificateError +match_hostname = ssl.match_hostname diff --git a/stubs/urllib3/urllib3/packages/ssl_match_hostname/_implementation.pyi b/stubs/urllib3/urllib3/packages/ssl_match_hostname/_implementation.pyi new file mode 100644 index 000000000000..c21998013cf2 --- /dev/null +++ b/stubs/urllib3/urllib3/packages/ssl_match_hostname/_implementation.pyi @@ -0,0 +1,3 @@ +class CertificateError(ValueError): ... + +def match_hostname(cert, hostname): ... diff --git a/stubs/urllib3/urllib3/poolmanager.pyi b/stubs/urllib3/urllib3/poolmanager.pyi new file mode 100644 index 000000000000..68ad69622b66 --- /dev/null +++ b/stubs/urllib3/urllib3/poolmanager.pyi @@ -0,0 +1,28 @@ +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/urllib3/urllib3/request.pyi b/stubs/urllib3/urllib3/request.pyi new file mode 100644 index 000000000000..b95ab295ba84 --- /dev/null +++ b/stubs/urllib3/urllib3/request.pyi @@ -0,0 +1,11 @@ +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/urllib3/urllib3/response.pyi b/stubs/urllib3/urllib3/response.pyi new file mode 100644 index 000000000000..1c78b48a2572 --- /dev/null +++ b/stubs/urllib3/urllib3/response.pyi @@ -0,0 +1,66 @@ +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/urllib3/urllib3/util/__init__.pyi b/stubs/urllib3/urllib3/util/__init__.pyi new file mode 100644 index 000000000000..2d0d66dcb603 --- /dev/null +++ b/stubs/urllib3/urllib3/util/__init__.pyi @@ -0,0 +1,20 @@ +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/urllib3/urllib3/util/connection.pyi b/stubs/urllib3/urllib3/util/connection.pyi new file mode 100644 index 000000000000..db77bd0095dd --- /dev/null +++ b/stubs/urllib3/urllib3/util/connection.pyi @@ -0,0 +1,8 @@ +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/urllib3/urllib3/util/request.pyi b/stubs/urllib3/urllib3/util/request.pyi new file mode 100644 index 000000000000..f770cd9faa73 --- /dev/null +++ b/stubs/urllib3/urllib3/util/request.pyi @@ -0,0 +1,11 @@ +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/urllib3/urllib3/util/response.pyi b/stubs/urllib3/urllib3/util/response.pyi new file mode 100644 index 000000000000..30463da4e4de --- /dev/null +++ b/stubs/urllib3/urllib3/util/response.pyi @@ -0,0 +1 @@ +def is_fp_closed(obj): ... diff --git a/stubs/urllib3/urllib3/util/retry.pyi b/stubs/urllib3/urllib3/util/retry.pyi new file mode 100644 index 000000000000..c4aedaa6cc62 --- /dev/null +++ b/stubs/urllib3/urllib3/util/retry.pyi @@ -0,0 +1,49 @@ +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/urllib3/urllib3/util/ssl_.pyi b/stubs/urllib3/urllib3/util/ssl_.pyi new file mode 100644 index 000000000000..1542e91da79a --- /dev/null +++ b/stubs/urllib3/urllib3/util/ssl_.pyi @@ -0,0 +1,30 @@ +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/urllib3/urllib3/util/timeout.pyi b/stubs/urllib3/urllib3/util/timeout.pyi new file mode 100644 index 000000000000..25879d685ea9 --- /dev/null +++ b/stubs/urllib3/urllib3/util/timeout.pyi @@ -0,0 +1,21 @@ +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/urllib3/urllib3/util/url.pyi b/stubs/urllib3/urllib3/util/url.pyi new file mode 100644 index 000000000000..2d43e2d2626d --- /dev/null +++ b/stubs/urllib3/urllib3/util/url.pyi @@ -0,0 +1,23 @@ +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): ...