Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions stdlib/@tests/stubtest_allowlists/common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ codecs.StreamRecoder.\w+
urllib.response.addbase.\w+

# __all__-related weirdness (see #6523)
email.__all__
email.base64mime
email.charset
email.encoders
Expand Down
38 changes: 23 additions & 15 deletions stdlib/email/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ from email.policy import Policy
from typing import IO
from typing_extensions import TypeAlias

# At runtime, listing submodules in __all__ without them being imported is
# valid, and causes them to be included in a star import. See #6523

__all__ = [ # noqa: F822 # Undefined names in __all__
"base64mime", # pyright: ignore[reportUnsupportedDunderAll]
"charset", # pyright: ignore[reportUnsupportedDunderAll]
"encoders", # pyright: ignore[reportUnsupportedDunderAll]
"errors", # pyright: ignore[reportUnsupportedDunderAll]
"feedparser", # pyright: ignore[reportUnsupportedDunderAll]
"generator", # pyright: ignore[reportUnsupportedDunderAll]
"header", # pyright: ignore[reportUnsupportedDunderAll]
"iterators", # pyright: ignore[reportUnsupportedDunderAll]
"message", # pyright: ignore[reportUnsupportedDunderAll]
"message_from_file",
"message_from_binary_file",
"message_from_string",
"message_from_bytes",
"mime", # pyright: ignore[reportUnsupportedDunderAll]
"parser", # pyright: ignore[reportUnsupportedDunderAll]
"quoprimime", # pyright: ignore[reportUnsupportedDunderAll]
"utils", # pyright: ignore[reportUnsupportedDunderAll]
]

# Definitions imported by multiple submodules in typeshed
_ParamType: TypeAlias = str | tuple[str | None, str | None, str] # noqa: Y047
_ParamsType: TypeAlias = str | None | tuple[str, str | None, str] # noqa: Y047
Expand All @@ -12,18 +35,3 @@ def message_from_string(s: str, _class: Callable[[], Message] = ..., *, policy:
def message_from_bytes(s: bytes | bytearray, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ...
def message_from_file(fp: IO[str], _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ...
def message_from_binary_file(fp: IO[bytes], _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> Message: ...

# Names in __all__ with no definition:
# base64mime
# charset
# encoders
# errors
# feedparser
# generator
# header
# iterators
# message
# mime
# parser
# quoprimime
# utils