Add assorted annotations (#3335)

* Add assorted annotations

* Fix type of Purpose items
This commit is contained in:
Sebastian Rittau
2019-10-11 05:51:49 +02:00
committed by Jelle Zijlstra
parent 8a7d61741d
commit d41bcd39e1
2 changed files with 20 additions and 18 deletions

View File

@@ -181,8 +181,8 @@ if sys.version_info < (3,):
else:
class _ASN1Object(NamedTuple('_ASN1Object', [('nid', int), ('shortname', str), ('longname', str), ('oid', str)])): ...
class Purpose(_ASN1Object, enum.Enum):
SERVER_AUTH = ...
CLIENT_AUTH = ...
SERVER_AUTH: _ASN1Object
CLIENT_AUTH: _ASN1Object
class SSLSocket(socket.socket):
context: SSLContext
@@ -208,17 +208,15 @@ class SSLSocket(socket.socket):
def version(self) -> Optional[str]: ...
def pending(self) -> int: ...
if sys.version_info >= (3, 7):
class TLSVersion(enum.IntEnum):
MINIMUM_SUPPORTED = ...
MAXIMUM_SUPPORTED = ...
SSLv3 = ...
TLSv1 = ...
TLSv1_1 = ...
TLSv1_2 = ...
TLSv1_3 = ...
MINIMUM_SUPPORTED: int
MAXIMUM_SUPPORTED: int
SSLv3: int
TLSv1: int
TLSv1_1: int
TLSv1_2: int
TLSv1_3: int
class SSLContext:
check_hostname: bool

View File

@@ -112,14 +112,18 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO):
# urllib.request uses it for a parameter.
class _HTTPConnectionProtocol(Protocol):
if sys.version_info >= (3, 7):
def __call__(self, host: str, port: Optional[int] = ...,
timeout: float = ...,
source_address: Optional[Tuple[str, int]] = ...,
blocksize: int = ...): ...
def __call__(
self,
host: str,
port: Optional[int] = ...,
timeout: float = ...,
source_address: Optional[Tuple[str, int]] = ...,
blocksize: int = ...,
) -> HTTPConnection: ...
else:
def __call__(self, host: str, port: Optional[int] = ...,
timeout: float = ...,
source_address: Optional[Tuple[str, int]] = ...): ...
def __call__(
self, host: str, port: Optional[int] = ..., timeout: float = ..., source_address: Optional[Tuple[str, int]] = ...,
) -> HTTPConnection: ...
class HTTPConnection:
timeout: float