diff --git a/stdlib/email/base64mime.pyi b/stdlib/email/base64mime.pyi index a8030a978..e55658046 100644 --- a/stdlib/email/base64mime.pyi +++ b/stdlib/email/base64mime.pyi @@ -1,3 +1,5 @@ +__all__ = ["body_decode", "body_encode", "decode", "decodestring", "header_encode", "header_length"] + def header_length(bytearray: str | bytes) -> int: ... def header_encode(header_bytes: str | bytes, charset: str = ...) -> str: ... def body_encode(s: bytes, maxlinelen: int = ..., eol: str = ...) -> str: ... diff --git a/stdlib/email/charset.pyi b/stdlib/email/charset.pyi index 6677cadbd..fd3de9cea 100644 --- a/stdlib/email/charset.pyi +++ b/stdlib/email/charset.pyi @@ -1,5 +1,7 @@ from typing import Iterator +__all__ = ["Charset", "add_alias", "add_charset", "add_codec"] + QP: int # undocumented BASE64: int # undocumented SHORTEST: int # undocumented diff --git a/stdlib/email/encoders.pyi b/stdlib/email/encoders.pyi index e05225e89..55223bdc0 100644 --- a/stdlib/email/encoders.pyi +++ b/stdlib/email/encoders.pyi @@ -1,5 +1,7 @@ from email.message import Message +__all__ = ["encode_7or8bit", "encode_base64", "encode_noop", "encode_quopri"] + def encode_base64(msg: Message) -> None: ... def encode_quopri(msg: Message) -> None: ... def encode_7or8bit(msg: Message) -> None: ... diff --git a/stdlib/email/feedparser.pyi b/stdlib/email/feedparser.pyi index ffcf4f0a7..fd27a7242 100644 --- a/stdlib/email/feedparser.pyi +++ b/stdlib/email/feedparser.pyi @@ -2,6 +2,8 @@ from email.message import Message from email.policy import Policy from typing import Callable, Generic, TypeVar, overload +__all__ = ["FeedParser", "BytesFeedParser"] + _M = TypeVar("_M", bound=Message) class FeedParser(Generic[_M]): diff --git a/stdlib/email/generator.pyi b/stdlib/email/generator.pyi index 48237f66c..5a6b6374d 100644 --- a/stdlib/email/generator.pyi +++ b/stdlib/email/generator.pyi @@ -2,6 +2,8 @@ from _typeshed import SupportsWrite from email.message import Message from email.policy import Policy +__all__ = ["Generator", "DecodedGenerator", "BytesGenerator"] + class Generator: def clone(self, fp: SupportsWrite[str]) -> Generator: ... def write(self, s: str) -> None: ... diff --git a/stdlib/email/header.pyi b/stdlib/email/header.pyi index 427bbe285..bd851bcf8 100644 --- a/stdlib/email/header.pyi +++ b/stdlib/email/header.pyi @@ -1,5 +1,7 @@ from email.charset import Charset +__all__ = ["Header", "decode_header", "make_header"] + class Header: def __init__( self, diff --git a/stdlib/email/iterators.pyi b/stdlib/email/iterators.pyi index 9081a3e3b..4bc81c093 100644 --- a/stdlib/email/iterators.pyi +++ b/stdlib/email/iterators.pyi @@ -1,5 +1,8 @@ from email.message import Message from typing import Iterator +__all__ = ["body_line_iterator", "typed_subpart_iterator", "walk"] + def body_line_iterator(msg: Message, decode: bool = ...) -> Iterator[str]: ... def typed_subpart_iterator(msg: Message, maintype: str = ..., subtype: str | None = ...) -> Iterator[str]: ... +def walk(self: Message) -> Iterator[Message]: ... diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index 699457dc9..d6857328a 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -6,6 +6,8 @@ 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 +__all__ = ["Message", "EmailMessage"] + _T = TypeVar("_T") _PayloadType = Union[list[Message], str, bytes] diff --git a/stdlib/email/mime/application.pyi b/stdlib/email/mime/application.pyi index d176cd613..978324c03 100644 --- a/stdlib/email/mime/application.pyi +++ b/stdlib/email/mime/application.pyi @@ -2,6 +2,8 @@ from email.mime.nonmultipart import MIMENonMultipart from email.policy import Policy from typing import Callable, Optional, Union +__all__ = ["MIMEApplication"] + _ParamsType = Union[str, None, tuple[str, Optional[str], str]] class MIMEApplication(MIMENonMultipart): diff --git a/stdlib/email/mime/audio.pyi b/stdlib/email/mime/audio.pyi index 38657c932..aa7b9ceb2 100644 --- a/stdlib/email/mime/audio.pyi +++ b/stdlib/email/mime/audio.pyi @@ -2,6 +2,8 @@ from email.mime.nonmultipart import MIMENonMultipart from email.policy import Policy from typing import Callable, Optional, Union +__all__ = ["MIMEAudio"] + _ParamsType = Union[str, None, tuple[str, Optional[str], str]] class MIMEAudio(MIMENonMultipart): diff --git a/stdlib/email/mime/base.pyi b/stdlib/email/mime/base.pyi index cb655607b..faa561fcb 100644 --- a/stdlib/email/mime/base.pyi +++ b/stdlib/email/mime/base.pyi @@ -2,6 +2,8 @@ import email.message from email.policy import Policy from typing import Optional, Union +__all__ = ["MIMEBase"] + _ParamsType = Union[str, None, tuple[str, Optional[str], str]] class MIMEBase(email.message.Message): diff --git a/stdlib/email/mime/image.pyi b/stdlib/email/mime/image.pyi index 0325d9e59..4e767e6aa 100644 --- a/stdlib/email/mime/image.pyi +++ b/stdlib/email/mime/image.pyi @@ -2,6 +2,8 @@ from email.mime.nonmultipart import MIMENonMultipart from email.policy import Policy from typing import Callable, Optional, Union +__all__ = ["MIMEImage"] + _ParamsType = Union[str, None, tuple[str, Optional[str], str]] class MIMEImage(MIMENonMultipart): diff --git a/stdlib/email/mime/message.pyi b/stdlib/email/mime/message.pyi index 8878741e8..9e7cd04b6 100644 --- a/stdlib/email/mime/message.pyi +++ b/stdlib/email/mime/message.pyi @@ -2,5 +2,7 @@ from email.message import Message from email.mime.nonmultipart import MIMENonMultipart from email.policy import Policy +__all__ = ["MIMEMessage"] + class MIMEMessage(MIMENonMultipart): def __init__(self, _msg: Message, _subtype: str = ..., *, policy: Policy | None = ...) -> None: ... diff --git a/stdlib/email/mime/multipart.pyi b/stdlib/email/mime/multipart.pyi index 6c316c055..3b70d5875 100644 --- a/stdlib/email/mime/multipart.pyi +++ b/stdlib/email/mime/multipart.pyi @@ -3,6 +3,8 @@ from email.mime.base import MIMEBase from email.policy import Policy from typing import Optional, Sequence, Union +__all__ = ["MIMEMultipart"] + _ParamsType = Union[str, None, tuple[str, Optional[str], str]] class MIMEMultipart(MIMEBase): diff --git a/stdlib/email/mime/nonmultipart.pyi b/stdlib/email/mime/nonmultipart.pyi index 4addff188..5497d89b1 100644 --- a/stdlib/email/mime/nonmultipart.pyi +++ b/stdlib/email/mime/nonmultipart.pyi @@ -1,3 +1,5 @@ from email.mime.base import MIMEBase +__all__ = ["MIMENonMultipart"] + class MIMENonMultipart(MIMEBase): ... diff --git a/stdlib/email/mime/text.pyi b/stdlib/email/mime/text.pyi index afcafa66e..9672c3b71 100644 --- a/stdlib/email/mime/text.pyi +++ b/stdlib/email/mime/text.pyi @@ -1,5 +1,7 @@ from email.mime.nonmultipart import MIMENonMultipart from email.policy import Policy +__all__ = ["MIMEText"] + class MIMEText(MIMENonMultipart): def __init__(self, _text: str, _subtype: str = ..., _charset: str | None = ..., *, policy: Policy | None = ...) -> None: ... diff --git a/stdlib/email/parser.pyi b/stdlib/email/parser.pyi index edff6f5b4..bbc5d0124 100644 --- a/stdlib/email/parser.pyi +++ b/stdlib/email/parser.pyi @@ -3,6 +3,8 @@ from email.message import Message from email.policy import Policy from typing import BinaryIO, Callable, TextIO, TypeVar +__all__ = ["Parser", "HeaderParser", "BytesParser", "BytesHeaderParser", "FeedParser", "BytesFeedParser"] + _M = TypeVar("_M", bound=Message) FeedParser = email.feedparser.FeedParser[_M] diff --git a/stdlib/email/policy.pyi b/stdlib/email/policy.pyi index 15991c7e0..d4ebb1fd5 100644 --- a/stdlib/email/policy.pyi +++ b/stdlib/email/policy.pyi @@ -5,6 +5,8 @@ from email.header import Header from email.message import Message from typing import Any, Callable +__all__ = ["Compat32", "compat32", "Policy", "EmailPolicy", "default", "strict", "SMTP", "HTTP"] + class Policy(metaclass=ABCMeta): max_line_length: int | None linesep: str diff --git a/stdlib/email/quoprimime.pyi b/stdlib/email/quoprimime.pyi index 41c4bd8cc..c5d324d17 100644 --- a/stdlib/email/quoprimime.pyi +++ b/stdlib/email/quoprimime.pyi @@ -1,3 +1,16 @@ +__all__ = [ + "body_decode", + "body_encode", + "body_length", + "decode", + "decodestring", + "header_decode", + "header_encode", + "header_length", + "quote", + "unquote", +] + def header_check(octet: int) -> bool: ... def body_check(octet: int) -> bool: ... def header_length(bytearray: bytes) -> int: ... diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index 728a5a53f..2b7f1bab3 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -3,6 +3,24 @@ import sys from email.charset import Charset from typing import Optional, Union, overload +__all__ = [ + "collapse_rfc2231_value", + "decode_params", + "decode_rfc2231", + "encode_rfc2231", + "formataddr", + "formatdate", + "format_datetime", + "getaddresses", + "make_msgid", + "mktime_tz", + "parseaddr", + "parsedate", + "parsedate_tz", + "parsedate_to_datetime", + "unquote", +] + _ParamType = Union[str, tuple[Optional[str], Optional[str], str]] _PDTZ = tuple[int, int, int, int, int, int, int, int, int, Optional[int]] diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index fffd72f49..6f25348ed 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -431,7 +431,6 @@ email.contentmanager.get_text_content email.contentmanager.set_bytes_content email.contentmanager.set_message_content email.contentmanager.set_text_content -email.iterators.walk pipes.Template.makepipeline pipes.Template.open_r pipes.Template.open_w