mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 20:01:29 +08:00
Add defaults to third-party stubs U-Z (#9971)
This commit is contained in:
@@ -24,5 +24,5 @@ Retry = retry.Retry
|
||||
class NullHandler(logging.Handler):
|
||||
def emit(self, record): ...
|
||||
|
||||
def add_stderr_logger(level: int = ...) -> logging.StreamHandler[TextIO]: ...
|
||||
def add_stderr_logger(level: int = 10) -> logging.StreamHandler[TextIO]: ...
|
||||
def disable_warnings(category: type[Warning] = ...) -> None: ...
|
||||
|
||||
@@ -15,7 +15,7 @@ class RecentlyUsedContainer(MutableMapping[_KT, _VT]):
|
||||
ContainerCls: Any
|
||||
dispose_func: Any
|
||||
lock: Any
|
||||
def __init__(self, maxsize=..., dispose_func=...) -> None: ...
|
||||
def __init__(self, maxsize=10, dispose_func=None) -> None: ...
|
||||
def __getitem__(self, key): ...
|
||||
def __setitem__(self, key, value) -> None: ...
|
||||
def __delitem__(self, key) -> None: ...
|
||||
@@ -25,7 +25,7 @@ class RecentlyUsedContainer(MutableMapping[_KT, _VT]):
|
||||
def keys(self): ...
|
||||
|
||||
class HTTPHeaderDict(MutableMapping[str, str]):
|
||||
def __init__(self, headers=..., **kwargs) -> None: ...
|
||||
def __init__(self, headers=None, **kwargs) -> None: ...
|
||||
def __setitem__(self, key, val) -> None: ...
|
||||
def __getitem__(self, key): ...
|
||||
def __delitem__(self, key) -> None: ...
|
||||
|
||||
@@ -36,7 +36,7 @@ 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: ...
|
||||
def __init__(self, host, port=None, key_file=None, cert_file=None, strict=None, timeout=..., **kw) -> None: ...
|
||||
sock: Any
|
||||
def connect(self): ...
|
||||
|
||||
@@ -48,7 +48,9 @@ class VerifiedHTTPSConnection(HTTPSConnection):
|
||||
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=...): ...
|
||||
def set_cert(
|
||||
self, key_file=None, cert_file=None, cert_reqs=None, ca_certs=None, assert_hostname=None, assert_fingerprint=None
|
||||
): ...
|
||||
sock: Any
|
||||
auto_open: Any
|
||||
is_verified: Any
|
||||
|
||||
@@ -45,7 +45,7 @@ class ConnectionPool:
|
||||
QueueCls: ClassVar[type[queue.Queue[Any]]]
|
||||
host: str
|
||||
port: int | None
|
||||
def __init__(self, host: str, port: int | None = ...) -> None: ...
|
||||
def __init__(self, host: str, port: int | None = None) -> None: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
@@ -69,15 +69,15 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
port: int | None = ...,
|
||||
strict: bool = ...,
|
||||
port: int | None = None,
|
||||
strict: bool = False,
|
||||
timeout: _Timeout = ...,
|
||||
maxsize: int = ...,
|
||||
block: bool = ...,
|
||||
headers: Mapping[str, str] | None = ...,
|
||||
retries: _Retries | None = ...,
|
||||
_proxy: Url | None = ...,
|
||||
_proxy_headers: Mapping[str, str] | None = ...,
|
||||
maxsize: int = 1,
|
||||
block: bool = False,
|
||||
headers: Mapping[str, str] | None = None,
|
||||
retries: _Retries | None = None,
|
||||
_proxy: Url | None = None,
|
||||
_proxy_headers: Mapping[str, str] | None = None,
|
||||
**conn_kw,
|
||||
) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
@@ -86,14 +86,14 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
|
||||
self,
|
||||
method,
|
||||
url,
|
||||
body=...,
|
||||
headers=...,
|
||||
retries=...,
|
||||
redirect=...,
|
||||
assert_same_host=...,
|
||||
body=None,
|
||||
headers=None,
|
||||
retries=None,
|
||||
redirect=True,
|
||||
assert_same_host=True,
|
||||
timeout=...,
|
||||
pool_timeout=...,
|
||||
release_conn=...,
|
||||
pool_timeout=None,
|
||||
release_conn=None,
|
||||
**response_kw,
|
||||
): ...
|
||||
|
||||
@@ -108,22 +108,22 @@ class HTTPSConnectionPool(HTTPConnectionPool):
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
port: int | None = ...,
|
||||
strict: bool = ...,
|
||||
port: int | None = None,
|
||||
strict: bool = False,
|
||||
timeout: _Timeout = ...,
|
||||
maxsize: int = ...,
|
||||
block: bool = ...,
|
||||
headers: Mapping[str, str] | None = ...,
|
||||
retries: _Retries | None = ...,
|
||||
_proxy: Url | None = ...,
|
||||
_proxy_headers: Mapping[str, str] | None = ...,
|
||||
key_file: str | None = ...,
|
||||
cert_file: str | None = ...,
|
||||
cert_reqs: int | str | None = ...,
|
||||
ca_certs: str | None = ...,
|
||||
ssl_version: int | str | None = ...,
|
||||
assert_hostname: str | Literal[False] | None = ...,
|
||||
assert_fingerprint: str | None = ...,
|
||||
maxsize: int = 1,
|
||||
block: bool = False,
|
||||
headers: Mapping[str, str] | None = None,
|
||||
retries: _Retries | None = None,
|
||||
_proxy: Url | None = None,
|
||||
_proxy_headers: Mapping[str, str] | None = None,
|
||||
key_file: str | None = None,
|
||||
cert_file: str | None = None,
|
||||
cert_reqs: int | str | None = None,
|
||||
ca_certs: str | None = None,
|
||||
ssl_version: int | str | None = None,
|
||||
assert_hostname: str | Literal[False] | None = None,
|
||||
assert_fingerprint: str | None = None,
|
||||
**conn_kw,
|
||||
) -> None: ...
|
||||
|
||||
|
||||
@@ -29,11 +29,11 @@ ConnectionError = ProtocolError
|
||||
|
||||
class MaxRetryError(RequestError):
|
||||
reason: Exception | None
|
||||
def __init__(self, pool: ConnectionPool, url: str, reason: Exception | None = ...) -> None: ...
|
||||
def __init__(self, pool: ConnectionPool, url: str, reason: Exception | None = None) -> None: ...
|
||||
|
||||
class HostChangedError(RequestError):
|
||||
retries: Retry | int
|
||||
def __init__(self, pool: ConnectionPool, url: str, retries: Retry | int = ...) -> None: ...
|
||||
def __init__(self, pool: ConnectionPool, url: str, retries: Retry | int = 3) -> None: ...
|
||||
|
||||
class TimeoutStateError(HTTPError): ...
|
||||
class TimeoutError(HTTPError): ...
|
||||
|
||||
@@ -5,7 +5,7 @@ from typing_extensions import TypeAlias
|
||||
_FieldValue: TypeAlias = str | bytes
|
||||
_FieldValueTuple: TypeAlias = _FieldValue | tuple[str, _FieldValue] | tuple[str, _FieldValue, str]
|
||||
|
||||
def guess_content_type(filename: str | None, default: str = ...) -> str: ...
|
||||
def guess_content_type(filename: str | None, default: str = "application/octet-stream") -> str: ...
|
||||
def format_header_param_rfc2231(name: str, value: _FieldValue) -> str: ...
|
||||
def format_header_param_html5(name: str, value: _FieldValue) -> str: ...
|
||||
|
||||
@@ -18,8 +18,8 @@ class RequestField:
|
||||
self,
|
||||
name: str,
|
||||
data: _FieldValue,
|
||||
filename: str | None = ...,
|
||||
headers: Mapping[str, str] | None = ...,
|
||||
filename: str | None = None,
|
||||
headers: Mapping[str, str] | None = None,
|
||||
header_formatter: Callable[[str, _FieldValue], str] = ...,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
@@ -28,5 +28,5 @@ class RequestField:
|
||||
) -> RequestField: ...
|
||||
def render_headers(self) -> str: ...
|
||||
def make_multipart(
|
||||
self, content_disposition: str | None = ..., content_type: str | None = ..., content_location: str | None = ...
|
||||
self, content_disposition: str | None = None, content_type: str | None = None, content_location: str | None = None
|
||||
) -> None: ...
|
||||
|
||||
@@ -14,4 +14,4 @@ _TYPE_FIELDS: TypeAlias = _TYPE_FIELDS_SEQUENCE | Mapping[str, fields._FieldValu
|
||||
def choose_boundary() -> str: ...
|
||||
def iter_field_objects(fields: _TYPE_FIELDS) -> Iterable[RequestField]: ...
|
||||
def iter_fields(fields): ...
|
||||
def encode_multipart_formdata(fields: _TYPE_FIELDS, boundary: str | None = ...) -> tuple[bytes, str]: ...
|
||||
def encode_multipart_formdata(fields: _TYPE_FIELDS, boundary: str | None = None) -> tuple[bytes, str]: ...
|
||||
|
||||
@@ -8,13 +8,13 @@ class PoolManager(RequestMethods):
|
||||
proxy: Any
|
||||
connection_pool_kw: Any
|
||||
pools: Any
|
||||
def __init__(self, num_pools=..., headers=..., **connection_pool_kw) -> None: ...
|
||||
def __init__(self, num_pools=10, headers=None, **connection_pool_kw) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> Literal[False]: ...
|
||||
def clear(self): ...
|
||||
def connection_from_host(self, host, port=..., scheme=...): ...
|
||||
def connection_from_host(self, host, port=None, scheme="http"): ...
|
||||
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): ...
|
||||
@@ -23,8 +23,8 @@ class PoolManager(RequestMethods):
|
||||
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=...): ...
|
||||
def __init__(self, proxy_url, num_pools=10, headers=None, proxy_headers=None, **connection_pool_kw) -> None: ...
|
||||
def connection_from_host(self, host, port=None, scheme="http"): ...
|
||||
# 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): ...
|
||||
|
||||
@@ -2,10 +2,10 @@ 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 __init__(self, headers=None) -> None: ...
|
||||
def urlopen(self, method, url, body=None, headers=None, encode_multipart=True, multipart_boundary=None, **kw): ...
|
||||
def request(self, method, url, fields=None, headers=None, **urlopen_kw): ...
|
||||
def request_encode_url(self, method, url, fields=None, **urlopen_kw): ...
|
||||
def request_encode_body(
|
||||
self, method, url, fields=..., headers=..., encode_multipart=..., multipart_boundary=..., **urlopen_kw
|
||||
self, method, url, fields=None, headers=None, encode_multipart=True, multipart_boundary=None, **urlopen_kw
|
||||
): ...
|
||||
|
||||
@@ -52,23 +52,23 @@ class HTTPResponse(io.IOBase):
|
||||
length_remaining: int | None
|
||||
def __init__(
|
||||
self,
|
||||
body: _TYPE_BODY = ...,
|
||||
headers: Mapping[str, str] | Mapping[bytes, bytes] | None = ...,
|
||||
status: int = ...,
|
||||
version: int = ...,
|
||||
reason: str | None = ...,
|
||||
strict: int = ...,
|
||||
preload_content: bool = ...,
|
||||
decode_content: bool = ...,
|
||||
original_response: _HttplibHTTPResponse | None = ...,
|
||||
pool: HTTPConnectionPool | None = ...,
|
||||
connection: HTTPConnection | None = ...,
|
||||
msg: _HttplibHTTPMessage | None = ...,
|
||||
retries: Retry | None = ...,
|
||||
enforce_content_length: bool = ...,
|
||||
request_method: str | None = ...,
|
||||
request_url: str | None = ...,
|
||||
auto_close: bool = ...,
|
||||
body: _TYPE_BODY = "",
|
||||
headers: Mapping[str, str] | Mapping[bytes, bytes] | None = None,
|
||||
status: int = 0,
|
||||
version: int = 0,
|
||||
reason: str | None = None,
|
||||
strict: int = 0,
|
||||
preload_content: bool = True,
|
||||
decode_content: bool = True,
|
||||
original_response: _HttplibHTTPResponse | None = None,
|
||||
pool: HTTPConnectionPool | None = None,
|
||||
connection: HTTPConnection | None = None,
|
||||
msg: _HttplibHTTPMessage | None = None,
|
||||
retries: Retry | None = None,
|
||||
enforce_content_length: bool = False,
|
||||
request_method: str | None = None,
|
||||
request_url: str | None = None,
|
||||
auto_close: bool = True,
|
||||
) -> None: ...
|
||||
def get_redirect_location(self) -> Literal[False] | str | None: ...
|
||||
def release_conn(self) -> None: ...
|
||||
@@ -79,12 +79,12 @@ class HTTPResponse(io.IOBase):
|
||||
def connection(self) -> HTTPConnection | Any: ...
|
||||
def isclosed(self) -> bool: ...
|
||||
def tell(self) -> int: ...
|
||||
def read(self, amt: int | None = ..., decode_content: bool | None = ..., cache_content: bool = ...) -> bytes: ...
|
||||
def stream(self, amt: int | None = ..., decode_content: bool | None = ...) -> Iterator[bytes]: ...
|
||||
def read(self, amt: int | None = None, decode_content: bool | None = None, cache_content: bool = False) -> bytes: ...
|
||||
def stream(self, amt: int | None = 65536, decode_content: bool | None = None) -> Iterator[bytes]: ...
|
||||
@classmethod
|
||||
def from_httplib(cls, r: _HttplibHTTPResponse, **response_kw: Any) -> Self: ...
|
||||
def getheaders(self) -> HTTPHeaderDict: ...
|
||||
def getheader(self, name, default=...) -> str | None: ...
|
||||
def getheader(self, name, default=None) -> str | None: ...
|
||||
def info(self) -> HTTPHeaderDict: ...
|
||||
def close(self) -> None: ...
|
||||
@property
|
||||
@@ -94,5 +94,5 @@ class HTTPResponse(io.IOBase):
|
||||
def readable(self) -> bool: ...
|
||||
def readinto(self, b: bytearray) -> int: ...
|
||||
def supports_chunked_reads(self) -> bool: ...
|
||||
def read_chunked(self, amt: int | None = ..., decode_content: bool | None = ...) -> Iterator[bytes]: ...
|
||||
def read_chunked(self, amt: int | None = None, decode_content: bool | None = None) -> Iterator[bytes]: ...
|
||||
def geturl(self) -> str | None: ...
|
||||
|
||||
@@ -5,4 +5,4 @@ select: Any
|
||||
HAS_IPV6: bool
|
||||
|
||||
def is_connection_dropped(conn): ...
|
||||
def create_connection(address, timeout=..., source_address=..., socket_options=...): ...
|
||||
def create_connection(address, timeout=..., source_address=None, socket_options=None): ...
|
||||
|
||||
@@ -7,5 +7,5 @@ from typing import Any
|
||||
ACCEPT_ENCODING: Any
|
||||
|
||||
def make_headers(
|
||||
keep_alive=..., accept_encoding=..., user_agent=..., basic_auth=..., proxy_basic_auth=..., disable_cache=...
|
||||
keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None, proxy_basic_auth=None, disable_cache=None
|
||||
): ...
|
||||
|
||||
@@ -45,40 +45,40 @@ class Retry:
|
||||
remove_headers_on_redirect: frozenset[str]
|
||||
def __init__(
|
||||
self,
|
||||
total: bool | int | None = ...,
|
||||
connect: int | None = ...,
|
||||
read: int | None = ...,
|
||||
redirect: bool | int | None = ...,
|
||||
status: int | None = ...,
|
||||
other: int | None = ...,
|
||||
total: bool | int | None = 10,
|
||||
connect: int | None = None,
|
||||
read: int | None = None,
|
||||
redirect: bool | int | None = None,
|
||||
status: int | None = None,
|
||||
other: int | None = None,
|
||||
allowed_methods: Collection[str] | Literal[False] | None = ...,
|
||||
status_forcelist: Collection[int] | None = ...,
|
||||
backoff_factor: float = ...,
|
||||
raise_on_redirect: bool = ...,
|
||||
raise_on_status: bool = ...,
|
||||
history: tuple[RequestHistory, ...] | None = ...,
|
||||
respect_retry_after_header: bool = ...,
|
||||
status_forcelist: Collection[int] | None = None,
|
||||
backoff_factor: float = 0,
|
||||
raise_on_redirect: bool = True,
|
||||
raise_on_status: bool = True,
|
||||
history: tuple[RequestHistory, ...] | None = None,
|
||||
respect_retry_after_header: bool = True,
|
||||
remove_headers_on_redirect: Collection[str] = ...,
|
||||
method_whitelist: Collection[str] | None = ...,
|
||||
) -> None: ...
|
||||
def new(self, **kw: Any) -> Self: ...
|
||||
@classmethod
|
||||
def from_int(
|
||||
cls, retries: Retry | bool | int | None, redirect: bool | int | None = ..., default: Retry | bool | int | None = ...
|
||||
cls, retries: Retry | bool | int | None, redirect: bool | int | None = True, default: Retry | bool | int | None = None
|
||||
) -> Retry: ...
|
||||
def get_backoff_time(self) -> float: ...
|
||||
def parse_retry_after(self, retry_after: str) -> float: ...
|
||||
def get_retry_after(self, response: HTTPResponse) -> float | None: ...
|
||||
def sleep_for_retry(self, response: HTTPResponse | None = ...) -> bool: ...
|
||||
def sleep(self, response: HTTPResponse | None = ...) -> None: ...
|
||||
def is_retry(self, method: str, status_code: int, has_retry_after: bool = ...) -> bool: ...
|
||||
def sleep_for_retry(self, response: HTTPResponse | None = None) -> bool: ...
|
||||
def sleep(self, response: HTTPResponse | None = None) -> None: ...
|
||||
def is_retry(self, method: str, status_code: int, has_retry_after: bool = False) -> bool: ...
|
||||
def is_exhausted(self) -> bool: ...
|
||||
def increment(
|
||||
self,
|
||||
method: str | None = ...,
|
||||
url: str | None = ...,
|
||||
response: HTTPResponse | None = ...,
|
||||
error: Exception | None = ...,
|
||||
_pool: ConnectionPool | None = ...,
|
||||
_stacktrace: TracebackType | None = ...,
|
||||
method: str | None = None,
|
||||
url: str | None = None,
|
||||
response: HTTPResponse | None = None,
|
||||
error: Exception | None = None,
|
||||
_pool: ConnectionPool | None = None,
|
||||
_stacktrace: TracebackType | None = None,
|
||||
) -> Retry: ...
|
||||
|
||||
@@ -17,15 +17,15 @@ DEFAULT_CIPHERS: str
|
||||
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 create_urllib3_context(ssl_version=None, cert_reqs=None, options=None, ciphers=None): ...
|
||||
def ssl_wrap_socket(
|
||||
sock,
|
||||
keyfile=...,
|
||||
certfile=...,
|
||||
cert_reqs=...,
|
||||
ca_certs=...,
|
||||
server_hostname=...,
|
||||
ssl_version=...,
|
||||
ciphers=...,
|
||||
ssl_context=...,
|
||||
keyfile=None,
|
||||
certfile=None,
|
||||
cert_reqs=None,
|
||||
ca_certs=None,
|
||||
server_hostname=None,
|
||||
ssl_version=None,
|
||||
ciphers=None,
|
||||
ssl_context=None,
|
||||
): ...
|
||||
|
||||
@@ -9,7 +9,7 @@ def current_time(): ...
|
||||
class Timeout:
|
||||
DEFAULT_TIMEOUT: Any
|
||||
total: Any
|
||||
def __init__(self, total=..., connect=..., read=...) -> None: ...
|
||||
def __init__(self, total=None, connect=..., read=...) -> None: ...
|
||||
@classmethod
|
||||
def from_float(cls, timeout): ...
|
||||
def clone(self): ...
|
||||
|
||||
@@ -18,13 +18,13 @@ class _UrlBase(NamedTuple):
|
||||
class Url(_UrlBase):
|
||||
def __new__(
|
||||
cls,
|
||||
scheme: str | None = ...,
|
||||
auth: str | None = ...,
|
||||
host: str | None = ...,
|
||||
port: int | None = ...,
|
||||
path: str | None = ...,
|
||||
query: str | None = ...,
|
||||
fragment: str | None = ...,
|
||||
scheme: str | None = None,
|
||||
auth: str | None = None,
|
||||
host: str | None = None,
|
||||
port: int | None = None,
|
||||
path: str | None = None,
|
||||
query: str | None = None,
|
||||
fragment: str | None = None,
|
||||
): ...
|
||||
@property
|
||||
def hostname(self) -> str | None: ...
|
||||
|
||||
Reference in New Issue
Block a user