Remove Python 3.6 branches from typeshed (#8269)

This commit is contained in:
Alex Waygood
2022-07-11 09:55:17 +01:00
committed by GitHub
parent 29c17ffb47
commit edc0ecd857
114 changed files with 1016 additions and 2642 deletions

View File

@@ -38,13 +38,11 @@ class SSLWantWriteError(SSLError): ...
class SSLSyscallError(SSLError): ...
class SSLEOFError(SSLError): ...
if sys.version_info >= (3, 7):
class SSLCertVerificationError(SSLError, ValueError):
verify_code: int
verify_message: str
CertificateError = SSLCertVerificationError
else:
class CertificateError(ValueError): ...
class SSLCertVerificationError(SSLError, ValueError):
verify_code: int
verify_message: str
CertificateError = SSLCertVerificationError
def wrap_socket(
sock: socket.socket,
@@ -65,34 +63,18 @@ def create_default_context(
capath: StrOrBytesPath | None = ...,
cadata: str | bytes | None = ...,
) -> SSLContext: ...
if sys.version_info >= (3, 7):
def _create_unverified_context(
protocol: int = ...,
*,
cert_reqs: int = ...,
check_hostname: bool = ...,
purpose: Purpose = ...,
certfile: StrOrBytesPath | None = ...,
keyfile: StrOrBytesPath | None = ...,
cafile: StrOrBytesPath | None = ...,
capath: StrOrBytesPath | None = ...,
cadata: str | bytes | None = ...,
) -> SSLContext: ...
else:
def _create_unverified_context(
protocol: int = ...,
*,
cert_reqs: int | None = ...,
check_hostname: bool = ...,
purpose: Purpose = ...,
certfile: StrOrBytesPath | None = ...,
keyfile: StrOrBytesPath | None = ...,
cafile: StrOrBytesPath | None = ...,
capath: StrOrBytesPath | None = ...,
cadata: str | bytes | None = ...,
) -> SSLContext: ...
def _create_unverified_context(
protocol: int = ...,
*,
cert_reqs: int = ...,
check_hostname: bool = ...,
purpose: Purpose = ...,
certfile: StrOrBytesPath | None = ...,
keyfile: StrOrBytesPath | None = ...,
cafile: StrOrBytesPath | None = ...,
capath: StrOrBytesPath | None = ...,
cadata: str | bytes | None = ...,
) -> SSLContext: ...
_create_default_https_context: Callable[..., SSLContext]
@@ -192,8 +174,7 @@ class Options(enum.IntFlag):
OP_SINGLE_ECDH_USE: int
OP_NO_COMPRESSION: int
OP_NO_TICKET: int
if sys.version_info >= (3, 7):
OP_NO_RENEGOTIATION: int
OP_NO_RENEGOTIATION: int
if sys.version_info >= (3, 8):
OP_ENABLE_MIDDLEBOX_COMPAT: int
@@ -209,18 +190,16 @@ OP_SINGLE_DH_USE: Options
OP_SINGLE_ECDH_USE: Options
OP_NO_COMPRESSION: Options
OP_NO_TICKET: Options
if sys.version_info >= (3, 7):
OP_NO_RENEGOTIATION: Options
OP_NO_RENEGOTIATION: Options
if sys.version_info >= (3, 8):
OP_ENABLE_MIDDLEBOX_COMPAT: Options
if sys.version_info >= (3, 7):
HAS_NEVER_CHECK_COMMON_NAME: bool
HAS_SSLv2: bool
HAS_SSLv3: bool
HAS_TLSv1: bool
HAS_TLSv1_1: bool
HAS_TLSv1_2: bool
HAS_NEVER_CHECK_COMMON_NAME: bool
HAS_SSLv2: bool
HAS_SSLv3: bool
HAS_TLSv1: bool
HAS_TLSv1_1: bool
HAS_TLSv1_2: bool
HAS_TLSv1_3: bool
HAS_ALPN: bool
HAS_ECDH: bool
@@ -310,31 +289,7 @@ class SSLSocket(socket.socket):
session: SSLSession | None
@property
def session_reused(self) -> bool | None: ...
if sys.version_info >= (3, 7):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
else:
def __init__(
self,
sock: socket.socket | None = ...,
keyfile: str | None = ...,
certfile: str | None = ...,
server_side: bool = ...,
cert_reqs: int = ...,
ssl_version: int = ...,
ca_certs: str | None = ...,
do_handshake_on_connect: bool = ...,
family: int = ...,
type: int = ...,
proto: int = ...,
fileno: int | None = ...,
suppress_ragged_eofs: bool = ...,
npn_protocols: Iterable[str] | None = ...,
ciphers: str | None = ...,
server_hostname: str | None = ...,
_context: SSLContext | None = ...,
_session: Any | None = ...,
) -> None: ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def connect(self, addr: socket._Address | bytes) -> None: ...
def connect_ex(self, addr: socket._Address | bytes) -> int: ...
def recv(self, buflen: int = ..., flags: int = ...) -> bytes: ...
@@ -372,15 +327,14 @@ class SSLSocket(socket.socket):
if sys.version_info >= (3, 8):
def verify_client_post_handshake(self) -> None: ...
if sys.version_info >= (3, 7):
class TLSVersion(enum.IntEnum):
MINIMUM_SUPPORTED: int
MAXIMUM_SUPPORTED: int
SSLv3: int
TLSv1: int
TLSv1_1: int
TLSv1_2: int
TLSv1_3: int
class TLSVersion(enum.IntEnum):
MINIMUM_SUPPORTED: int
MAXIMUM_SUPPORTED: int
SSLv3: int
TLSv1: int
TLSv1_1: int
TLSv1_2: int
TLSv1_3: int
class SSLContext:
check_hostname: bool
@@ -389,16 +343,15 @@ class SSLContext:
verify_mode: VerifyMode
@property
def protocol(self) -> _SSLMethod: ...
if sys.version_info >= (3, 7):
hostname_checks_common_name: bool
maximum_version: TLSVersion
minimum_version: TLSVersion
sni_callback: Callable[[SSLObject, str, SSLContext], None | int] | None
# The following two attributes have class-level defaults.
# However, the docs explicitly state that it's OK to override these attributes on instances,
# so making these ClassVars wouldn't be appropriate
sslobject_class: type[SSLObject]
sslsocket_class: type[SSLSocket]
hostname_checks_common_name: bool
maximum_version: TLSVersion
minimum_version: TLSVersion
sni_callback: Callable[[SSLObject, str, SSLContext], None | int] | None
# The following two attributes have class-level defaults.
# However, the docs explicitly state that it's OK to override these attributes on instances,
# so making these ClassVars wouldn't be appropriate
sslobject_class: type[SSLObject]
sslsocket_class: type[SSLSocket]
if sys.version_info >= (3, 8):
keylog_filename: str
post_handshake_auth: bool
@@ -423,11 +376,7 @@ class SSLContext:
def set_ciphers(self, __cipherlist: str) -> None: ...
def set_alpn_protocols(self, alpn_protocols: Iterable[str]) -> None: ...
def set_npn_protocols(self, npn_protocols: Iterable[str]) -> None: ...
if sys.version_info >= (3, 7):
def set_servername_callback(self, server_name_callback: _SrvnmeCbType | None) -> None: ...
else:
def set_servername_callback(self, __method: _SrvnmeCbType | None) -> None: ...
def set_servername_callback(self, server_name_callback: _SrvnmeCbType | None) -> None: ...
def load_dh_params(self, __path: str) -> None: ...
def set_ecdh_curve(self, __name: str) -> None: ...
def wrap_socket(
@@ -458,11 +407,7 @@ class SSLObject:
session: SSLSession | None
@property
def session_reused(self) -> bool: ...
if sys.version_info >= (3, 7):
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
else:
def __init__(self, sslobj: Any, owner: SSLSocket | SSLObject | None = ..., session: Any | None = ...) -> None: ...
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def read(self, len: int = ..., buffer: bytearray | None = ...) -> bytes: ...
def write(self, data: bytes) -> int: ...
@overload