mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-10-07 04:34:33 +08:00
email.message: Allow any header value (#11574)
This commit is contained in:
1 parent
579d208b19
commit
4c5c5760cf
2 files changed
+12
-2
No files matched your search
@@ -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