mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-12 10:52:31 +08:00
[stdlib] Deprecate keyfile, certfile and check_hostname parameters (#15259)
This commit is contained in:
+31
-7
@@ -1,6 +1,6 @@
|
||||
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
|
||||
@@ -8,7 +8,7 @@ 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",
|
||||
@@ -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(
|
||||
@@ -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__(
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user