mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
email.message: Allow any header value (#11574)
This commit is contained in:
@@ -15,9 +15,10 @@ _PayloadType: TypeAlias = Message | str
|
||||
_EncodedPayloadType: TypeAlias = Message | bytes
|
||||
_MultipartPayloadType: TypeAlias = list[_PayloadType]
|
||||
_CharsetType: TypeAlias = Charset | str | None
|
||||
# Type returned by Policy.header_fetch_parse, AnyOf[str | Header]
|
||||
# Type returned by Policy.header_fetch_parse, often str or Header.
|
||||
_HeaderType: TypeAlias = Any
|
||||
_HeaderTypeParam: TypeAlias = str | Header
|
||||
# Type accepted by Policy.header_store_parse.
|
||||
_HeaderTypeParam: TypeAlias = str | Header | Any
|
||||
|
||||
class _SupportsEncodeToPayload(Protocol):
|
||||
def encode(self, encoding: str, /) -> _PayloadType | _MultipartPayloadType | _SupportsDecodeToPayload: ...
|
||||
@@ -25,6 +26,9 @@ class _SupportsEncodeToPayload(Protocol):
|
||||
class _SupportsDecodeToPayload(Protocol):
|
||||
def decode(self, encoding: str, errors: str, /) -> _PayloadType | _MultipartPayloadType: ...
|
||||
|
||||
# TODO: This class should be generic over the header policy and/or the header
|
||||
# value types allowed by the policy. This depends on PEP 696 support
|
||||
# (https://github.com/python/typeshed/issues/11422).
|
||||
class Message:
|
||||
policy: Policy # undocumented
|
||||
preamble: str | None
|
||||
|
||||
Reference in New Issue
Block a user