From e2b27b95e76dc2a1025ff6f3b2c04639f9de63a6 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Fri, 11 Oct 2019 21:01:37 +0200 Subject: [PATCH 1/2] Add missing exception to smtplib Improve a few other types --- stdlib/3/smtplib.pyi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stdlib/3/smtplib.pyi b/stdlib/3/smtplib.pyi index 803b010bd7a0..a56c5e4a8815 100644 --- a/stdlib/3/smtplib.pyi +++ b/stdlib/3/smtplib.pyi @@ -17,6 +17,7 @@ bCRLF: bytes OLDSTYLE_AUTH: Pattern[str] class SMTPException(OSError): ... +class SMTPNotSupportedError(SMTPException): ... class SMTPServerDisconnected(SMTPException): ... class SMTPResponseException(SMTPException): @@ -53,12 +54,13 @@ class _AuthObject(Protocol): class SMTP: debuglevel: int = ... + sock: Optional[socket] = ... # Type of file should match what socket.makefile() returns - file: Any = ... + file: Optional[Any] = ... helo_resp: Optional[bytes] = ... ehlo_msg: str = ... ehlo_resp: Optional[bytes] = ... - does_esmtp: int = ... + does_esmtp: bool = ... default_port: int = ... timeout: float esmtp_features: Dict[str, str] @@ -116,6 +118,7 @@ class SMTP: def quit(self) -> _Reply: ... class SMTP_SSL(SMTP): + default_port: int = ... keyfile: Optional[str] certfile: Optional[str] context: SSLContext From 8caa8641feffd15a24736765b89f38e193bad7fe Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Sat, 12 Oct 2019 14:32:00 +0200 Subject: [PATCH 2/2] Remove duplicate definition of 'sock' --- stdlib/3/smtplib.pyi | 1 - 1 file changed, 1 deletion(-) diff --git a/stdlib/3/smtplib.pyi b/stdlib/3/smtplib.pyi index a56c5e4a8815..60e3a35b83ba 100644 --- a/stdlib/3/smtplib.pyi +++ b/stdlib/3/smtplib.pyi @@ -75,7 +75,6 @@ class SMTP: exc_value: Optional[BaseException], tb: Optional[TracebackType]) -> None: ... def set_debuglevel(self, debuglevel: int) -> None: ... - sock: Optional[socket] def connect(self, host: str = ..., port: int = ..., source_address: Optional[_SourceAddress] = ...) -> _Reply: ... def send(self, s: Union[bytes, str]) -> None: ...