8000 smtplib: Improve bytes handling by JelleZijlstra · Pull Request #9094 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content
< 8000 div class="position-relative js-review-state-classes js-suggested-changes-subset-files" data-pjax data-discussion-hovercards-enabled data-issue-and-pr-hovercards-enabled >

smtplib: Improve bytes handling #9094

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
Nov 5, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use socket._Address
  • Loading branch information
JelleZijlstra committed Nov 5, 2022
commit 32b02de5ad12179b9b989c19c9f549c5d569604f
16 changes: 8 additions & 8 deletions stdlib/smtplib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ from types import TracebackType
from typing import Any, Protocol, overload
from typing_extensions import TypeAlias

from _socket import _Address

__all__ = [
"SMTPException",
"SMTPServerDisconnected",
Expand All @@ -28,8 +30,6 @@ __all__ = [

_Reply: TypeAlias = tuple[int, bytes]
_SendErrs: TypeAlias = dict[str, _Reply]
# Should match source_address for socket.create_connection
_SourceAddress: TypeAlias = tuple[ReadableBuffer | str, int]

SMTP_PORT: int
SMTP_SSL_PORT: int
Expand Down Expand Up @@ -86,22 +86,22 @@ class SMTP:
timeout: float
esmtp_features: dict[str, str]
command_encoding: str
source_address: _SourceAddress | None
source_address: _Address | None
local_hostname: str
def __init__(
self,
host: str = ...,
port: int = ...,
local_hostname: str | None = ...,
timeout: float = ...,
source_address: _SourceAddress | None = ...,
source_address: _Address | None = ...,
) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None
) -> None: ...
def set_debuglevel(self, debuglevel: int) -> None: ...
def connect(self, host: str = ..., port: int = ..., source_address: _SourceAddress | None = ...) -> _Reply: ...
def connect(self, host: str = ..., port: int = ..., source_address: _Address | None = ...) -> _Reply: ...
def send(self, s: ReadableBuffer | str) -> None: ...
def putcmd(self, cmd: str, args: str = ...) -> None: ...
def getreply(self) -> _Reply: ...
Expand Down Expand Up @@ -161,7 +161,7 @@ class SMTP_SSL(SMTP):
keyfile: str | None = ...,
certfile: str | None = ...,
timeout: float = ...,
source_address: _SourceAddress | None = ...,
source_address: _Address | None = ...,
context: SSLContext | None = ...,
) -> None: ...

Expand All @@ -174,10 +174,10 @@ class LMTP(SMTP):
host: str = ...,
port: int = ...,
local_hostname: str | None = ...,
source_address: _SourceAddress | None = ...,
source_address: _Address | None = ...,
timeout: float = ...,
) -> None: ...
else:
def __init__(
self, host: str = ..., port: int = ..., local_hostname: str | None = ..., source_address: _SourceAddress | None = ...
self, host: str = ..., port: int = ..., local_hostname: str | None = ..., source_address: _Address | None = ...
) -> None: ...
0