mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-31 21:20:23 +08:00
Clean up and fix email message types (#13532)
* Unify the `_MessageT` type var in `email._policybase`. * Use explicit type arguments for `Message` type in `_MessageT` type var. In particular, change bound from `Message[str, str]` to `Message[Any, Any]`. * Change `__init__()` overloads of `Parser` and `BytesParser` to accept `Message` objects that are not `Message[str, str]` if `_class` is not also given.
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
from collections.abc import Callable
|
||||
from email._policybase import Compat32 as Compat32, Policy as Policy, _MessageFactory, compat32 as compat32
|
||||
from email._policybase import Compat32 as Compat32, Policy as Policy, _MessageFactory, _MessageT, compat32 as compat32
|
||||
from email.contentmanager import ContentManager
|
||||
from email.message import EmailMessage, Message
|
||||
from typing import Any, TypeVar, overload
|
||||
from email.message import EmailMessage
|
||||
from typing import Any, overload
|
||||
from typing_extensions import Self
|
||||
|
||||
__all__ = ["Compat32", "compat32", "Policy", "EmailPolicy", "default", "strict", "SMTP", "HTTP"]
|
||||
|
||||
_MessageT = TypeVar("_MessageT", bound=Message, default=Message)
|
||||
|
||||
class EmailPolicy(Policy[_MessageT]):
|
||||
utf8: bool
|
||||
refold_source: str
|
||||
|
||||
Reference in New Issue
Block a user