Skip to content

Fix and comment type mismatches in email library hints #10437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 11, 2023
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
9 changes: 7 additions & 2 deletions stdlib/email/charset.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from collections.abc import Iterator
from collections.abc import Callable, Iterator
from email.message import Message
from typing import overload

__all__ = ["Charset", "add_alias", "add_charset", "add_codec"]

Expand All @@ -14,10 +16,13 @@ class Charset:
input_codec: str | None
output_codec: str | None
def __init__(self, input_charset: str = "us-ascii") -> None: ...
def get_body_encoding(self) -> str: ...
def get_body_encoding(self) -> str | Callable[[Message], None]: ...
def get_output_charset(self) -> str | None: ...
def header_encode(self, string: str) -> str: ...
def header_encode_lines(self, string: str, maxlengths: Iterator[int]) -> list[str]: ...
@overload
def body_encode(self, string: None) -> None: ...
@overload
def body_encode(self, string: str) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, __value: object) -> bool: ...
Expand Down
2 changes: 1 addition & 1 deletion stdlib/email/utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ else:
def localtime(dt: datetime.datetime | None = None, isdst: int = -1) -> datetime.datetime: ...

def make_msgid(idstring: str | None = None, domain: str | None = None) -> str: ...
def decode_rfc2231(s: str) -> tuple[str | None, str | None, str]: ...
def decode_rfc2231(s: str) -> tuple[str | None, str | None, str]: ... # May return list[str]. See issue #10431 for details.
def encode_rfc2231(s: str, charset: str | None = None, language: str | None = None) -> str: ...
def collapse_rfc2231_value(value: _ParamType, errors: str = "replace", fallback_charset: str = "us-ascii") -> str: ...
def decode_params(params: list[tuple[str, str]]) -> list[tuple[str, _ParamType]]: ...