Improve urllib3.fields annotations (#8456)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Kevin Kirsche
2022-08-01 10:39:21 -04:00
committed by GitHub
parent 76643099a9
commit 3d9e907873
2 changed files with 26 additions and 11 deletions

View File

@@ -24,10 +24,6 @@ urllib3.connectionpool.HTTPSConnectionPool.__init__
urllib3.connectionpool.RequestMethods.request_encode_url
urllib3.connectionpool.VerifiedHTTPSConnection.__init__
urllib3.connectionpool.VerifiedHTTPSConnection.set_cert
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

View File

@@ -1,13 +1,32 @@
from typing import Any
from collections.abc import Callable, Mapping
from typing import Any, Union
from typing_extensions import TypeAlias
def guess_content_type(filename, default=...): ...
def format_header_param(name, value): ...
_FieldValue: TypeAlias = str | bytes
_FieldValueTuple: TypeAlias = Union[_FieldValue, tuple[str, _FieldValue], tuple[str, _FieldValue, str]]
def guess_content_type(filename: str | None, default: str = ...) -> str: ...
def format_header_param_rfc2231(name: str, value: _FieldValue) -> str: ...
def format_header_param_html5(name: str, value: _FieldValue) -> str: ...
format_header_param = format_header_param_html5
class RequestField:
data: Any
headers: Any
def __init__(self, name, data, filename=..., headers=...) -> None: ...
def __init__(
self,
name: str,
data: _FieldValue,
filename: str | None = ...,
headers: Mapping[str, str] | None = ...,
header_formatter: Callable[[str, _FieldValue], str] = ...,
) -> None: ...
@classmethod
def from_tuples(cls, fieldname, value): ...
def render_headers(self): ...
def make_multipart(self, content_disposition=..., content_type=..., content_location=...): ...
def from_tuples(
cls, fieldname: str, value: _FieldValueTuple, header_formatter: Callable[[str, _FieldValue], str] = ...
) -> RequestField: ...
def render_headers(self) -> str: ...
def make_multipart(
self, content_disposition: str | None = ..., content_type: str | None = ..., content_location: str | None = ...
) -> None: ...