Skip to content
Merged
Changes from 2 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
16 changes: 8 additions & 8 deletions stdlib/smtplib.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from _typeshed import Self
from _typeshed import ReadableBuffer, Self, _BufferWithLen
from collections.abc import Sequence
from email.message import Message as _Message
from re import Pattern
Expand Down Expand Up @@ -29,7 +29,7 @@ __all__ = [
_Reply: TypeAlias = tuple[int, bytes]
_SendErrs: TypeAlias = dict[str, _Reply]
# Should match source_address for socket.create_connection
_SourceAddress: TypeAlias = tuple[bytearray | bytes | str, int]
_SourceAddress: TypeAlias = tuple[ReadableBuffer | str, int]

SMTP_PORT: int
SMTP_SSL_PORT: int
Expand Down Expand Up @@ -102,7 +102,7 @@ class SMTP:
) -> None: ...
def set_debuglevel(self, debuglevel: int) -> None: ...
def connect(self, host: str = ..., port: int = ..., source_address: _SourceAddress | None = ...) -> _Reply: ...
def send(self, s: bytes | str) -> None: ...
def send(self, s: ReadableBuffer | str) -> None: ...
def putcmd(self, cmd: str, args: str = ...) -> None: ...
def getreply(self) -> _Reply: ...
def docmd(self, cmd: str, args: str = ...) -> _Reply: ...
Expand All @@ -114,7 +114,7 @@ class SMTP:
def noop(self) -> _Reply: ...
def mail(self, sender: str, options: Sequence[str] = ...) -> _Reply: ...
def rcpt(self, recip: str, options: Sequence[str] = ...) -> _Reply: ...
def data(self, msg: bytes | str) -> _Reply: ...
def data(self, msg: ReadableBuffer | str) -> _Reply: ...
def verify(self, address: str) -> _Reply: ...
vrfy = verify
def expn(self, address: str) -> _Reply: ...
Expand All @@ -125,16 +125,16 @@ class SMTP:
@overload
def auth_cram_md5(self, challenge: None = ...) -> None: ...
@overload
def auth_cram_md5(self, challenge: bytes) -> str: ...
def auth_plain(self, challenge: bytes | None = ...) -> str: ...
def auth_login(self, challenge: bytes | None = ...) -> str: ...
def auth_cram_md5(self, challenge: ReadableBuffer) -> str: ...
def auth_plain(self, challenge: ReadableBuffer | None = ...) -> str: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The challenge parameter doesn't look like it's actually used for this one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next one doesn't really use it either, I figured I should be consistent with auth_cram_md5.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense, I figured as much!

def auth_login(self, challenge: ReadableBuffer | None = ...) -> str: ...
def login(self, user: str, password: str, *, initial_response_ok: bool = ...) -> _Reply: ...
def starttls(self, keyfile: str | None = ..., certfile: str | None = ..., context: SSLContext | None = ...) -> _Reply: ...
def sendmail(
self,
from_addr: str,
to_addrs: str | Sequence[str],
msg: bytes | str,
msg: _BufferWithLen | str,
mail_options: Sequence[str] = ...,
rcpt_options: Sequence[str] = ...,
) -> _SendErrs: ...
Expand Down