From 8f34c4aa9bb93d021eff3f4a9032981f15061344 Mon Sep 17 00:00:00 2001 From: Maxwell Muoto <41130755+max-muoto@users.noreply.github.com> Date: Sat, 13 Jul 2024 15:28:58 -0500 Subject: [PATCH 1/6] Update email.utils for 3.13 --- stdlib/@tests/stubtest_allowlists/py313.txt | 2 -- stdlib/email/utils.pyi | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/py313.txt b/stdlib/@tests/stubtest_allowlists/py313.txt index ec09ae8ed888..7b253f536e85 100644 --- a/stdlib/@tests/stubtest_allowlists/py313.txt +++ b/stdlib/@tests/stubtest_allowlists/py313.txt @@ -37,8 +37,6 @@ ctypes.wintypes.PCHAR.from_param ctypes.wintypes.PWCHAR.from_param doctest.TestResults.__doc__ doctest.TestResults.__new__ -email.utils.getaddresses -email.utils.parseaddr filecmp.dircmp.__init__ importlib.resources.Anchor importlib.resources.Resource diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index 0b62647532db..605eeae37ec9 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -28,9 +28,20 @@ _PDTZ: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int | None def quote(str: str) -> str: ... def unquote(str: str) -> str: ... -def parseaddr(addr: str | None) -> tuple[str, str]: ... + +if sys.version_info >= (3, 13): + def parseaddr(addr: str, *, strict: bool = True) -> tuple[str, str]: ... +else: + def parseaddr(addr: str) -> tuple[str, str]: ... + def formataddr(pair: tuple[str | None, str], charset: str | Charset = "utf-8") -> str: ... -def getaddresses(fieldvalues: list[str]) -> list[tuple[str, str]]: ... + +if sys.version_info >= (3, 13): + def getaddresses(fieldvalues: list[str], *, strict: bool = True) -> list[tuple[str, str]]: ... + +else: + def getaddresses(fieldvalues: list[str]) -> list[tuple[str, str]]: ... + @overload def parsedate(data: None) -> None: ... @overload From 9ba6b9a04010c97720a7cdf90042fc5447bb41fc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 13 Jul 2024 20:30:51 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/email/utils.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index 605eeae37ec9..b42244a2f0e0 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -31,6 +31,7 @@ def unquote(str: str) -> str: ... if sys.version_info >= (3, 13): def parseaddr(addr: str, *, strict: bool = True) -> tuple[str, str]: ... + else: def parseaddr(addr: str) -> tuple[str, str]: ... From 63e9986a5ed6b7dcb27a7e4ae89312cb0cd4c32c Mon Sep 17 00:00:00 2001 From: Max Muoto Date: Sat, 13 Jul 2024 15:55:42 -0500 Subject: [PATCH 3/6] Update stdlib/email/utils.pyi Co-authored-by: Jelle Zijlstra --- stdlib/email/utils.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index b42244a2f0e0..49a47813bf9d 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -41,7 +41,7 @@ if sys.version_info >= (3, 13): def getaddresses(fieldvalues: list[str], *, strict: bool = True) -> list[tuple[str, str]]: ... else: - def getaddresses(fieldvalues: list[str]) -> list[tuple[str, str]]: ... + def getaddresses(fieldvalues: Iterable[str]) -> list[tuple[str, str]]: ... @overload def parsedate(data: None) -> None: ... From 39a9a4f7b8c0ddfb5e87d448ffb7a29f71e941b9 Mon Sep 17 00:00:00 2001 From: Max Muoto Date: Sat, 13 Jul 2024 15:55:47 -0500 Subject: [PATCH 4/6] Update stdlib/email/utils.pyi Co-authored-by: Jelle Zijlstra --- stdlib/email/utils.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index 49a47813bf9d..8500143fc184 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -38,7 +38,7 @@ else: def formataddr(pair: tuple[str | None, str], charset: str | Charset = "utf-8") -> str: ... if sys.version_info >= (3, 13): - def getaddresses(fieldvalues: list[str], *, strict: bool = True) -> list[tuple[str, str]]: ... + def getaddresses(fieldvalues: Iterable[str], *, strict: bool = True) -> list[tuple[str, str]]: ... else: def getaddresses(fieldvalues: Iterable[str]) -> list[tuple[str, str]]: ... From 135c9d0b6be3f2ebb4a0583fd0c70721c9ed23fc Mon Sep 17 00:00:00 2001 From: Maxwell Muoto <41130755+max-muoto@users.noreply.github.com> Date: Sat, 13 Jul 2024 15:58:13 -0500 Subject: [PATCH 5/6] Address feedback --- stdlib/email/utils.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index 8500143fc184..2918bbf598fb 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -1,6 +1,7 @@ import datetime import sys from _typeshed import Unused +from collections.abc import Iterable from email import _ParamType from email.charset import Charset from typing import overload @@ -30,8 +31,7 @@ def quote(str: str) -> str: ... def unquote(str: str) -> str: ... if sys.version_info >= (3, 13): - def parseaddr(addr: str, *, strict: bool = True) -> tuple[str, str]: ... - + def parseaddr(addr: str | list[str], *, strict: bool = True) -> tuple[str, str]: ... else: def parseaddr(addr: str) -> tuple[str, str]: ... From 3f5fb9a146ecd98069f7ba1106bf10f68d526fab Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 13 Jul 2024 21:00:23 +0000 Subject: [PATCH 6/6] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/email/utils.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index 2918bbf598fb..2724dbf6ec2f 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -32,6 +32,7 @@ def unquote(str: str) -> str: ... if sys.version_info >= (3, 13): def parseaddr(addr: str | list[str], *, strict: bool = True) -> tuple[str, str]: ... + else: def parseaddr(addr: str) -> tuple[str, str]: ...