mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-10 02:19:18 +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,12 +1,11 @@
|
||||
from collections.abc import Callable
|
||||
from email._policybase import _MessageT
|
||||
from email.message import Message
|
||||
from email.policy import Policy
|
||||
from typing import Generic, TypeVar, overload
|
||||
from typing import Generic, overload
|
||||
|
||||
__all__ = ["FeedParser", "BytesFeedParser"]
|
||||
|
||||
_MessageT = TypeVar("_MessageT", bound=Message, default=Message)
|
||||
|
||||
class FeedParser(Generic[_MessageT]):
|
||||
@overload
|
||||
def __init__(self: FeedParser[Message], _factory: None = None, *, policy: Policy[Message] = ...) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user