requests: add type hints to requests.utils (#8395)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
This commit is contained in:
Kevin Kirsche
2022-07-26 09:25:56 -04:00
committed by GitHub
parent 37911bfaa3
commit 33878a6ea4

View File

@@ -1,54 +1,59 @@
from collections.abc import Iterable, Mapping
from collections.abc import Generator, Iterable, Mapping
from contextlib import AbstractContextManager
from typing import Any, AnyStr
from typing_extensions import TypeAlias
from . import compat, cookies, exceptions, structures
from .models import PreparedRequest
_Uri: TypeAlias = str | bytes
OrderedDict = compat.OrderedDict
cookiejar_from_dict = cookies.cookiejar_from_dict
CaseInsensitiveDict = structures.CaseInsensitiveDict
InvalidURL = exceptions.InvalidURL
NETRC_FILES: Any
NETRC_FILES: tuple[str, str]
DEFAULT_CA_BUNDLE_PATH: Any
DEFAULT_PORTS: Any
DEFAULT_PORTS: dict[str, int]
DEFAULT_ACCEPT_ENCODING: str
def dict_to_sequence(d): ...
def super_len(o): ...
def get_netrc_auth(url, raise_errors: bool = ...): ...
def get_netrc_auth(url: _Uri, raise_errors: bool = ...) -> tuple[str, str] | None: ...
def guess_filename(obj): ...
def extract_zipped_paths(path): ...
def from_key_val_list(value): ...
def to_key_val_list(value): ...
def parse_list_header(value): ...
def parse_dict_header(value): ...
def unquote_header_value(value, is_filename=...): ...
def unquote_header_value(value, is_filename: bool = ...): ...
def dict_from_cookiejar(cj): ...
def add_dict_to_cookiejar(cj, cookie_dict): ...
def get_encodings_from_content(content): ...
def get_encoding_from_headers(headers): ...
def stream_decode_response_unicode(iterator, r): ...
def iter_slices(string, slice_length): ...
def iter_slices(string: str, slice_length: int | None) -> Generator[str, None, None]: ...
def get_unicode_from_response(r): ...
UNRESERVED_SET: Any
UNRESERVED_SET: frozenset[str]
def unquote_unreserved(uri): ...
def requote_uri(uri): ...
def address_in_network(ip, net): ...
def dotted_netmask(mask): ...
def is_ipv4_address(string_ip): ...
def is_valid_cidr(string_network): ...
def set_environ(env_name, value): ...
def should_bypass_proxies(url, no_proxy: Iterable[AnyStr] | None) -> bool: ...
def get_environ_proxies(url, no_proxy: Iterable[AnyStr] | None = ...) -> dict[Any, Any]: ...
def select_proxy(url: str, proxies: Mapping[Any, Any] | None): ...
def default_user_agent(name=...): ...
def default_headers(): ...
def unquote_unreserved(uri: str) -> str: ...
def requote_uri(uri: str) -> str: ...
def address_in_network(ip: str, net: str) -> bool: ...
def dotted_netmask(mask: int) -> str: ...
def is_ipv4_address(string_ip: str) -> bool: ...
def is_valid_cidr(string_network: str) -> bool: ...
def set_environ(env_name: str, value: None) -> AbstractContextManager[None]: ...
def should_bypass_proxies(url: _Uri, no_proxy: Iterable[str] | None) -> bool: ...
def get_environ_proxies(url: _Uri, no_proxy: Iterable[str] | None = ...) -> dict[Any, Any]: ...
def select_proxy(url: _Uri, proxies: Mapping[Any, Any] | None): ...
def default_user_agent(name: str = ...) -> str: ...
def default_headers() -> CaseInsensitiveDict[str]: ...
def parse_header_links(value: str) -> list[dict[str, str]]: ...
def guess_json_utf(data): ...
def prepend_scheme_if_needed(url, new_scheme): ...
def get_auth_from_url(url): ...
def get_auth_from_url(url: _Uri) -> tuple[str, str]: ...
def to_native_string(string, encoding=...): ...
def urldefragauth(url): ...
def rewind_body(prepared_request): ...
def urldefragauth(url: _Uri): ...
def rewind_body(prepared_request: PreparedRequest) -> None: ...
def check_header_validity(header: tuple[AnyStr, AnyStr]) -> None: ...