email.Message.walk yields self (#8398)

This updates the generator used by `Message` to return `Self` so that it correctly changes when a `MIMEPart` or `EmailMessage`.

Fixes #8290
This commit is contained in:
Kevin Kirsche
2022-07-26 05:17:45 -04:00
committed by GitHub
parent abd893abae
commit 5732b8f34e

View File

@@ -1,3 +1,4 @@
from _typeshed import Self
from collections.abc import Generator, Iterator, Sequence
from email import _ParamsType, _ParamType
from email.charset import Charset
@@ -55,7 +56,7 @@ class Message:
def set_boundary(self, boundary: str) -> None: ...
def get_content_charset(self, failobj: _T = ...) -> _T | str: ...
def get_charsets(self, failobj: _T = ...) -> _T | list[str]: ...
def walk(self) -> Generator[Message, None, None]: ...
def walk(self: Self) -> Generator[Self, None, None]: ...
def get_content_disposition(self) -> str | None: ...
def as_string(self, unixfrom: bool = ..., maxheaderlen: int = ..., policy: Policy | None = ...) -> str: ...
def as_bytes(self, unixfrom: bool = ..., policy: Policy | None = ...) -> bytes: ...