Use typing_extensions.Self in the stdlib (#9694)

This commit is contained in:
Alex Waygood
2023-02-09 09:12:13 +00:00
committed by GitHub
parent 10086c06a1
commit 9ed39d8796
98 changed files with 627 additions and 654 deletions

View File

@@ -1,4 +1,3 @@
from _typeshed import Self
from collections.abc import Generator, Iterator, Sequence
from email import _ParamsType, _ParamType
from email.charset import Charset
@@ -6,7 +5,7 @@ from email.contentmanager import ContentManager
from email.errors import MessageDefect
from email.policy import Policy
from typing import Any, TypeVar, overload
from typing_extensions import TypeAlias
from typing_extensions import Self, TypeAlias
__all__ = ["Message", "EmailMessage"]
@@ -84,7 +83,7 @@ class Message:
def get_charsets(self, failobj: None = None) -> list[str] | None: ...
@overload
def get_charsets(self, failobj: _T) -> list[str] | _T: ...
def walk(self: Self) -> Generator[Self, None, None]: ...
def walk(self) -> Generator[Self, None, None]: ...
def get_content_disposition(self) -> str | None: ...
def as_string(self, unixfrom: bool = False, maxheaderlen: int = 0, policy: Policy | None = None) -> str: ...
def as_bytes(self, unixfrom: bool = False, policy: Policy | None = None) -> bytes: ...