mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-23 19:41:51 +08:00
Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949)
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import socket
|
||||
import sys
|
||||
from _typeshed import StrPath
|
||||
from typing import Any, Callable, ClassVar, Dict, Iterable, List, NamedTuple, Optional, Set, Text, Tuple, Union, overload
|
||||
from typing import Any, Callable, ClassVar, Iterable, NamedTuple, Optional, Text, Union, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_PCTRTT = Tuple[Tuple[str, str], ...]
|
||||
_PCTRTTT = Tuple[_PCTRTT, ...]
|
||||
_PeerCertRetDictType = Dict[str, Union[str, _PCTRTTT, _PCTRTT]]
|
||||
_PCTRTT = tuple[tuple[str, str], ...]
|
||||
_PCTRTTT = tuple[_PCTRTT, ...]
|
||||
_PeerCertRetDictType = dict[str, Union[str, _PCTRTTT, _PCTRTT]]
|
||||
_PeerCertRetType = Union[_PeerCertRetDictType, bytes, None]
|
||||
_EnumRetType = List[Tuple[bytes, str, Union[Set[str], bool]]]
|
||||
_EnumRetType = list[tuple[bytes, str, Union[set[str], bool]]]
|
||||
_PasswordType = Union[Callable[[], Union[str, bytes]], str, bytes]
|
||||
|
||||
_SC1ArgT = SSLSocket
|
||||
@@ -60,7 +60,7 @@ def RAND_egd(path: str) -> None: ...
|
||||
def RAND_add(__s: bytes, __entropy: float) -> None: ...
|
||||
def match_hostname(cert: _PeerCertRetType, hostname: str) -> None: ...
|
||||
def cert_time_to_seconds(cert_time: str) -> int: ...
|
||||
def get_server_certificate(addr: Tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ...) -> str: ...
|
||||
def get_server_certificate(addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ...) -> str: ...
|
||||
def DER_cert_to_PEM_cert(der_cert_bytes: bytes) -> str: ...
|
||||
def PEM_cert_to_DER_cert(pem_cert_string: str) -> bytes: ...
|
||||
|
||||
@@ -110,10 +110,10 @@ HAS_ALPN: bool
|
||||
HAS_ECDH: bool
|
||||
HAS_SNI: bool
|
||||
HAS_NPN: bool
|
||||
CHANNEL_BINDING_TYPES: List[str]
|
||||
CHANNEL_BINDING_TYPES: list[str]
|
||||
|
||||
OPENSSL_VERSION: str
|
||||
OPENSSL_VERSION_INFO: Tuple[int, int, int, int, int]
|
||||
OPENSSL_VERSION_INFO: tuple[int, int, int, int, int]
|
||||
OPENSSL_VERSION_NUMBER: int
|
||||
|
||||
ALERT_DESCRIPTION_HANDSHAKE_FAILURE: int
|
||||
@@ -200,12 +200,12 @@ class SSLSocket(socket.socket):
|
||||
def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ...
|
||||
@overload
|
||||
def getpeercert(self, binary_form: bool) -> _PeerCertRetType: ...
|
||||
def cipher(self) -> Tuple[str, str, int] | None: ...
|
||||
def cipher(self) -> tuple[str, str, int] | None: ...
|
||||
def compression(self) -> str | None: ...
|
||||
def get_channel_binding(self, cb_type: str = ...) -> bytes | None: ...
|
||||
def selected_alpn_protocol(self) -> str | None: ...
|
||||
def selected_npn_protocol(self) -> str | None: ...
|
||||
def accept(self) -> Tuple[SSLSocket, socket._RetAddress]: ...
|
||||
def accept(self) -> tuple[SSLSocket, socket._RetAddress]: ...
|
||||
def unwrap(self) -> socket.socket: ...
|
||||
def version(self) -> str | None: ...
|
||||
def pending(self) -> int: ...
|
||||
@@ -219,13 +219,13 @@ class SSLContext:
|
||||
verify_flags: int
|
||||
verify_mode: int
|
||||
def __init__(self, protocol: int) -> None: ...
|
||||
def cert_store_stats(self) -> Dict[str, int]: ...
|
||||
def cert_store_stats(self) -> dict[str, int]: ...
|
||||
def load_cert_chain(self, certfile: StrPath, keyfile: StrPath | None = ..., password: _PasswordType | None = ...) -> None: ...
|
||||
def load_default_certs(self, purpose: Purpose = ...) -> None: ...
|
||||
def load_verify_locations(
|
||||
self, cafile: StrPath | None = ..., capath: StrPath | None = ..., cadata: Text | bytes | None = ...
|
||||
) -> None: ...
|
||||
def get_ca_certs(self, binary_form: bool = ...) -> List[_PeerCertRetDictType] | List[bytes]: ...
|
||||
def get_ca_certs(self, binary_form: bool = ...) -> list[_PeerCertRetDictType] | list[bytes]: ...
|
||||
def set_default_verify_paths(self) -> None: ...
|
||||
def set_ciphers(self, __cipherlist: str) -> None: ...
|
||||
def set_alpn_protocols(self, alpn_protocols: Iterable[str]) -> None: ...
|
||||
@@ -241,7 +241,7 @@ class SSLContext:
|
||||
suppress_ragged_eofs: bool = ...,
|
||||
server_hostname: str | None = ...,
|
||||
) -> SSLSocket: ...
|
||||
def session_stats(self) -> Dict[str, int]: ...
|
||||
def session_stats(self) -> dict[str, int]: ...
|
||||
|
||||
# TODO below documented in cpython but not in docs.python.org
|
||||
# taken from python 3.4
|
||||
|
||||
Reference in New Issue
Block a user