Skip to content
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
36 changes: 28 additions & 8 deletions stdlib/ftplib.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import sys
from _typeshed import SupportsRead, SupportsReadline
from _typeshed import StrOrBytesPath, SupportsRead, SupportsReadline
from collections.abc import Callable, Iterable, Iterator
from socket import socket
from ssl import SSLContext
from types import TracebackType
from typing import Any, Final, Literal, TextIO
from typing_extensions import Self
from typing import Any, Final, Literal, TextIO, overload
from typing_extensions import Self, deprecated

__all__ = ["FTP", "error_reply", "error_temp", "error_perm", "error_proto", "all_errors", "FTP_TLS"]

Expand Down Expand Up @@ -120,23 +120,43 @@ class FTP_TLS(FTP):
encoding: str = "utf-8",
) -> None: ...
else:
@overload
def __init__(
self,
host: str = "",
user: str = "",
passwd: str = "",
acct: str = "",
keyfile: str | None = None,
certfile: str | None = None,
keyfile: None = None,
certfile: None = None,
context: SSLContext | None = None,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
*,
encoding: str = "utf-8",
) -> None: ...
ssl_version: int
keyfile: str | None
certfile: str | None
@overload
@deprecated(
"The `keyfile`, `certfile` parameters are deprecated since Python 3.6; "
"removed in Python 3.12. Use `context` parameter instead."
)
def __init__(
self,
host: str = "",
user: str = "",
passwd: str = "",
acct: str = "",
keyfile: StrOrBytesPath | None = None,
certfile: StrOrBytesPath | None = None,
context: None = None,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
*,
encoding: str = "utf-8",
) -> None: ...
ssl_version: int
keyfile: StrOrBytesPath | None
certfile: StrOrBytesPath | None
context: SSLContext
def login(self, user: str = "", passwd: str = "", acct: str = "", secure: bool = True) -> str: ...
def auth(self) -> str: ...
Expand Down
27 changes: 24 additions & 3 deletions stdlib/http/client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import io
import ssl
import sys
import types
from _typeshed import MaybeNone, ReadableBuffer, SupportsRead, SupportsReadline, WriteableBuffer
from _typeshed import MaybeNone, ReadableBuffer, StrOrBytesPath, SupportsRead, SupportsReadline, WriteableBuffer
from collections.abc import Callable, Iterable, Iterator, Mapping
from email._policybase import _MessageT
from socket import socket
Expand Down Expand Up @@ -223,19 +223,40 @@ class HTTPSConnection(HTTPConnection):
blocksize: int = 8192,
) -> None: ...
else:
@overload
def __init__(
self,
host: str,
port: int | None = None,
key_file: str | None = None,
cert_file: str | None = None,
key_file: None = None,
cert_file: None = None,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
*,
context: ssl.SSLContext | None = None,
check_hostname: None = None,
blocksize: int = 8192,
) -> None: ...
@overload
@deprecated(
"The `key_file`, `cert_file`, `check_hostname` parameters are deprecated since Python 3.6; "
"removed in Python 3.12. Use `context` parameter instead."
)
def __init__(
self,
host: str,
port: int | None = None,
key_file: StrOrBytesPath | None = None,
cert_file: StrOrBytesPath | None = None,
timeout: float | None = ...,
source_address: tuple[str, int] | None = None,
*,
context: ssl.SSLContext | None = None,
check_hostname: bool | None = None,
blocksize: int = 8192,
) -> None: ...
key_file: StrOrBytesPath | None
cert_file: StrOrBytesPath | None

class HTTPException(Exception): ...

Expand Down
28 changes: 21 additions & 7 deletions stdlib/imaplib.pyi
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import subprocess
import sys
import time
from _typeshed import ReadableBuffer, SizedBuffer, Unused
from _typeshed import ReadableBuffer, SizedBuffer, StrOrBytesPath, Unused
from builtins import list as _list # conflicts with a method named "list"
from collections.abc import Callable, Generator
from datetime import datetime
from re import Pattern
from socket import socket as _socket
from ssl import SSLContext, SSLSocket
from types import TracebackType
from typing import IO, Any, Literal, SupportsAbs, SupportsInt
from typing import IO, Any, Literal, SupportsAbs, SupportsInt, overload
from typing_extensions import Self, TypeAlias, deprecated

__all__ = ["IMAP4", "IMAP4_stream", "Internaldate2tuple", "Int2AP", "ParseFlags", "Time2Internaldate", "IMAP4_SSL"]
Expand Down Expand Up @@ -120,23 +120,37 @@ if sys.version_info >= (3, 14):
def burst(self, interval: float = 0.1) -> Generator[tuple[str, float | None]]: ...

class IMAP4_SSL(IMAP4):
if sys.version_info < (3, 12):
keyfile: str
certfile: str
if sys.version_info >= (3, 12):
def __init__(
self, host: str = "", port: int = 993, *, ssl_context: SSLContext | None = None, timeout: float | None = None
) -> None: ...
else:
@overload
def __init__(
self,
host: str = "",
port: int = 993,
keyfile: str | None = None,
certfile: str | None = None,
keyfile: None = None,
certfile: None = None,
ssl_context: SSLContext | None = None,
timeout: float | None = None,
) -> None: ...
@overload
@deprecated(
"The `keyfile`, `certfile` parameters are deprecated since Python 3.6; "
"removed in Python 3.12. Use `ssl_context` parameter instead."
)
def __init__(
self,
host: str = "",
port: int = 993,
keyfile: StrOrBytesPath | None = None,
certfile: StrOrBytesPath | None = None,
ssl_context: None = None,
timeout: float | None = None,
) -> None: ...
keyfile: StrOrBytesPath | None
certfile: StrOrBytesPath | None
sslobj: SSLSocket
if sys.version_info >= (3, 14):
@property
Expand Down
24 changes: 21 additions & 3 deletions stdlib/poplib.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import socket
import ssl
import sys
from _typeshed import StrOrBytesPath
from builtins import list as _list # conflicts with a method named "list"
from re import Pattern
from typing import Any, BinaryIO, Final, NoReturn, overload
from typing_extensions import TypeAlias
from typing_extensions import TypeAlias, deprecated

__all__ = ["POP3", "error_proto", "POP3_SSL"]

Expand Down Expand Up @@ -58,15 +59,32 @@ class POP3_SSL(POP3):
) -> None: ...
def stls(self, context: Any = None) -> NoReturn: ...
else:
@overload
def __init__(
self,
host: str,
port: int = 995,
keyfile: str | None = None,
certfile: str | None = None,
keyfile: None = None,
certfile: None = None,
timeout: float = ...,
context: ssl.SSLContext | None = None,
) -> None: ...
@overload
@deprecated(
"The `keyfile`, `certfile` parameters are deprecated since Python 3.6; "
"removed in Python 3.12. Use `context` parameter instead."
)
def __init__(
self,
host: str,
port: int = 995,
keyfile: StrOrBytesPath | None = None,
certfile: StrOrBytesPath | None = None,
timeout: float = ...,
context: None = None,
) -> None: ...
keyfile: StrOrBytesPath | None
certfile: StrOrBytesPath | 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: ...
38 changes: 31 additions & 7 deletions stdlib/smtplib.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import sys
from _socket import _Address as _SourceAddress
from _typeshed import ReadableBuffer, SizedBuffer
from _typeshed import ReadableBuffer, SizedBuffer, StrOrBytesPath
from collections.abc import Sequence
from email.message import Message as _Message
from re import Pattern
from socket import socket
from ssl import SSLContext
from types import TracebackType
from typing import Any, Final, Protocol, overload, type_check_only
from typing_extensions import Self, TypeAlias
from typing_extensions import Self, TypeAlias, deprecated

__all__ = [
"SMTPException",
Expand Down Expand Up @@ -131,8 +131,15 @@ class SMTP:
if sys.version_info >= (3, 12):
def starttls(self, *, context: SSLContext | None = None) -> _Reply: ...
else:
@overload
def starttls(self, keyfile: None = None, certfile: None = None, context: SSLContext | None = None) -> _Reply: ...
@overload
@deprecated(
"The `keyfile`, `certfile` parameters are deprecated since Python 3.6; "
"removed in Python 3.12. Use `context` parameter instead."
)
def starttls(
self, keyfile: str | None = None, certfile: str | None = None, context: SSLContext | None = None
self, keyfile: StrOrBytesPath | None = None, certfile: StrOrBytesPath | None = None, context: None = None
) -> _Reply: ...

def sendmail(
Expand All @@ -155,8 +162,6 @@ class SMTP:
def quit(self) -> _Reply: ...

class SMTP_SSL(SMTP):
keyfile: str | None
certfile: str | None
context: SSLContext
if sys.version_info >= (3, 12):
def __init__(
Expand All @@ -170,17 +175,36 @@ class SMTP_SSL(SMTP):
context: SSLContext | None = None,
) -> None: ...
else:
@overload
def __init__(
self,
host: str = "",
port: int = 0,
local_hostname: str | None = None,
keyfile: str | None = None,
certfile: str | None = None,
keyfile: None = None,
certfile: None = None,
timeout: float = ...,
source_address: _SourceAddress | None = None,
context: SSLContext | None = None,
) -> None: ...
@overload
@deprecated(
"The `keyfile`, `certfile` parameters are deprecated since Python 3.6; "
"removed in Python 3.12. Use `context` parameter instead."
)
def __init__(
self,
host: str = "",
port: int = 0,
local_hostname: str | None = None,
keyfile: StrOrBytesPath | None = None,
certfile: StrOrBytesPath | None = None,
timeout: float = ...,
source_address: _SourceAddress | None = None,
context: None = None,
) -> None: ...
keyfile: StrOrBytesPath | None
certfile: StrOrBytesPath | None

LMTP_PORT: Final = 2003

Expand Down