mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-06-24 09:48:39 +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:
@@ -5,6 +5,7 @@ import sys
|
||||
import types
|
||||
from _typeshed import MaybeNone, ReadableBuffer, SupportsRead, SupportsReadline, WriteableBuffer
|
||||
from collections.abc import Callable, Iterable, Iterator, Mapping
|
||||
from email._policybase import _MessageT
|
||||
from socket import socket
|
||||
from typing import BinaryIO, Literal, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
@@ -33,7 +34,6 @@ __all__ = [
|
||||
|
||||
_DataType: TypeAlias = SupportsRead[bytes] | Iterable[ReadableBuffer] | ReadableBuffer
|
||||
_T = TypeVar("_T")
|
||||
_MessageT = TypeVar("_MessageT", bound=email.message.Message)
|
||||
_HeaderValue: TypeAlias = ReadableBuffer | str | int
|
||||
|
||||
HTTP_PORT: int
|
||||
|
||||
Reference in New Issue
Block a user