mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-10-08 21:15:17 +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 parent
a43e0a4c02
commit
0eb44e574c
11 files changed
+42
-25
No files matched your search
@@ -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