Update poplib and smtplib for py312 (#10685)

This commit is contained in:
Alex Waygood
2023-09-08 18:42:03 +01:00
committed by GitHub
parent 53144ca572
commit c50a708818
8 changed files with 52 additions and 27 deletions

View File

@@ -1,5 +1,6 @@
import socket
import ssl
import sys
from builtins import list as _list # conflicts with a method named "list"
from re import Pattern
from typing import Any, BinaryIO, NoReturn, overload
@@ -51,14 +52,20 @@ class POP3:
def stls(self, context: ssl.SSLContext | None = None) -> bytes: ...
class POP3_SSL(POP3):
def __init__(
self,
host: str,
port: int = 995,
keyfile: str | None = None,
certfile: str | None = None,
timeout: float = ...,
context: ssl.SSLContext | None = None,
) -> None: ...
# "context" is actually the last argument, but that breaks LSP and it doesn't really matter because all the arguments are ignored
def stls(self, context: Any = None, keyfile: Any = None, certfile: Any = None) -> NoReturn: ...
if sys.version_info >= (3, 12):
def __init__(
self, host: str, port: int = 995, *, timeout: float = ..., context: ssl.SSLContext | None = None
) -> None: ...
def stls(self, context: Any = None) -> NoReturn: ...
else:
def __init__(
self,
host: str,
port: int = 995,
keyfile: str | None = None,
certfile: str | None = None,
timeout: float = ...,
context: ssl.SSLContext | None = None,
) -> None: ...
# "context" is actually the last argument, but that breaks LSP and it doesn't really matter because all the arguments are ignored
def stls(self, context: Any = None, keyfile: Any = None, certfile: Any = None) -> NoReturn: ...

View File

@@ -128,7 +128,13 @@ class SMTP:
def auth_plain(self, challenge: ReadableBuffer | None = None) -> str: ...
def auth_login(self, challenge: ReadableBuffer | None = None) -> str: ...
def login(self, user: str, password: str, *, initial_response_ok: bool = True) -> _Reply: ...
def starttls(self, keyfile: str | None = None, certfile: str | None = None, context: SSLContext | None = None) -> _Reply: ...
if sys.version_info >= (3, 12):
def starttls(self, *, context: SSLContext | None = None) -> _Reply: ...
else:
def starttls(
self, keyfile: str | None = None, certfile: str | None = None, context: SSLContext | None = None
) -> _Reply: ...
def sendmail(
self,
from_addr: str,
@@ -152,17 +158,29 @@ class SMTP_SSL(SMTP):
keyfile: str | None
certfile: str | None
context: SSLContext
def __init__(
self,
host: str = "",
port: int = 0,
local_hostname: str | None = None,
keyfile: str | None = None,
certfile: str | None = None,
timeout: float = ...,
source_address: _SourceAddress | None = None,
context: SSLContext | None = None,
) -> None: ...
if sys.version_info >= (3, 12):
def __init__(
self,
host: str = "",
port: int = 0,
local_hostname: str | None = None,
*,
timeout: float = ...,
source_address: _SourceAddress | None = None,
context: SSLContext | None = None,
) -> None: ...
else:
def __init__(
self,
host: str = "",
port: int = 0,
local_hostname: str | None = None,
keyfile: str | None = None,
certfile: str | None = None,
timeout: float = ...,
source_address: _SourceAddress | None = None,
context: SSLContext | None = None,
) -> None: ...
LMTP_PORT: int