From 8016419a054d26d8502a71b0de27a0bd7815aae6 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 24 Jan 2022 11:12:13 +0000 Subject: [PATCH 1/6] Use import instead of type alias in `email/message.pyi` A hack that might fix #7019 --- stdlib/email/message.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index 5ce11e3d807e..ffe8d1cd550c 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -3,6 +3,7 @@ from email.contentmanager import ContentManager from email.errors import MessageDefect from email.policy import Policy from typing import Any, Generator, Iterator, Optional, Sequence, TypeVar, Union +from typing import Any as _HeaderType # using a type alias ("_HeaderType = Any") breaks mypy, who knows why _T = TypeVar("_T") @@ -10,7 +11,6 @@ _PayloadType = Union[list[Message], str, bytes] _CharsetType = Union[Charset, str, None] _ParamsType = Union[str, None, tuple[str, Optional[str], str]] _ParamType = Union[str, tuple[Optional[str], Optional[str], str]] -_HeaderType = Any class Message: policy: Policy # undocumented From 6a4983bfe7b44f4e920f7f57930e5bb55463f671 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Jan 2022 11:13:35 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/email/message.pyi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index ffe8d1cd550c..91d8e044d0f2 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -2,8 +2,16 @@ from email.charset import Charset from email.contentmanager import ContentManager from email.errors import MessageDefect from email.policy import Policy -from typing import Any, Generator, Iterator, Optional, Sequence, TypeVar, Union -from typing import Any as _HeaderType # using a type alias ("_HeaderType = Any") breaks mypy, who knows why +from typing import ( # using a type alias ("_HeaderType = Any") breaks mypy, who knows why + Any, + Any as _HeaderType, + Generator, + Iterator, + Optional, + Sequence, + TypeVar, + Union, +) _T = TypeVar("_T") From 7a7e65b7a91a8540e39c5783ce055c52b6b0f5d7 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 24 Jan 2022 11:14:07 +0000 Subject: [PATCH 3/6] Update message.pyi --- stdlib/email/message.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index 91d8e044d0f2..47e65986146e 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -2,9 +2,9 @@ from email.charset import Charset from email.contentmanager import ContentManager from email.errors import MessageDefect from email.policy import Policy -from typing import ( # using a type alias ("_HeaderType = Any") breaks mypy, who knows why +from typing import ( Any, - Any as _HeaderType, + Any as _HeaderType, # using a type alias ("_HeaderType = Any") breaks mypy, who knows why Generator, Iterator, Optional, From a2ac124bdeb2f329e23b8fe118218936649d9add Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Jan 2022 11:15:50 +0000 Subject: [PATCH 4/6] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/email/message.pyi | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index 47e65986146e..77d01eeb09d5 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -2,16 +2,8 @@ from email.charset import Charset from email.contentmanager import ContentManager from email.errors import MessageDefect from email.policy import Policy -from typing import ( - Any, - Any as _HeaderType, # using a type alias ("_HeaderType = Any") breaks mypy, who knows why - Generator, - Iterator, - Optional, - Sequence, - TypeVar, - Union, -) +from typing import Any as _HeaderType # using a type alias ("_HeaderType = Any") breaks mypy, who knows why +from typing import Any, Generator, Iterator, Optional, Sequence, TypeVar, Union _T = TypeVar("_T") From 56bd54b5b54b49e1338ed5ac433e94b1dd286aab Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 24 Jan 2022 11:17:35 +0000 Subject: [PATCH 5/6] Update message.pyi --- stdlib/email/message.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index 77d01eeb09d5..de27fd50843c 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -2,8 +2,8 @@ from email.charset import Charset from email.contentmanager import ContentManager from email.errors import MessageDefect from email.policy import Policy -from typing import Any as _HeaderType # using a type alias ("_HeaderType = Any") breaks mypy, who knows why -from typing import Any, Generator, Iterator, Optional, Sequence, TypeVar, Union +# using a type alias ("_HeaderType = Any") breaks mypy, who knows why +from typing import Any, Any as _HeaderType, Generator, Iterator, Optional, Sequence, TypeVar, Union _T = TypeVar("_T") From 2a049c566646e544d82fad923f89f945fda8584e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Jan 2022 11:18:44 +0000 Subject: [PATCH 6/6] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/email/message.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index de27fd50843c..699457dc9ab5 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -2,6 +2,7 @@ from email.charset import Charset from email.contentmanager import ContentManager from email.errors import MessageDefect from email.policy import Policy + # using a type alias ("_HeaderType = Any") breaks mypy, who knows why from typing import Any, Any as _HeaderType, Generator, Iterator, Optional, Sequence, TypeVar, Union