Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -1,11 +1,11 @@
import ssl
import sys
from typing import Any, Callable, ClassVar, Deque, Dict, List, Optional, Tuple
from typing import Any, Callable, ClassVar, Deque, Dict, List, Tuple
from typing_extensions import Literal
from . import constants, events, futures, protocols, transports
def _create_transport_context(server_side: bool, server_hostname: Optional[str]) -> ssl.SSLContext: ...
def _create_transport_context(server_side: bool, server_hostname: str | None) -> ssl.SSLContext: ...
_UNWRAPPED: Literal["UNWRAPPED"]
_DO_HANDSHAKE: Literal["DO_HANDSHAKE"]
@@ -18,25 +18,25 @@ class _SSLPipe:
_context: ssl.SSLContext
_server_side: bool
_server_hostname: Optional[str]
_server_hostname: str | None
_state: str
_incoming: ssl.MemoryBIO
_outgoing: ssl.MemoryBIO
_sslobj: Optional[ssl.SSLObject]
_sslobj: ssl.SSLObject | None
_need_ssldata: bool
_handshake_cb: Optional[Callable[[Optional[BaseException]], None]]
_shutdown_cb: Optional[Callable[[], None]]
def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: Optional[str] = ...) -> None: ...
_handshake_cb: Callable[[BaseException | None], None] | None
_shutdown_cb: Callable[[], None] | None
def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: str | None = ...) -> None: ...
@property
def context(self) -> ssl.SSLContext: ...
@property
def ssl_object(self) -> Optional[ssl.SSLObject]: ...
def ssl_object(self) -> ssl.SSLObject | None: ...
@property
def need_ssldata(self) -> bool: ...
@property
def wrapped(self) -> bool: ...
def do_handshake(self, callback: Optional[Callable[[Optional[BaseException]], None]] = ...) -> List[bytes]: ...
def shutdown(self, callback: Optional[Callable[[], None]] = ...) -> List[bytes]: ...
def do_handshake(self, callback: Callable[[BaseException | None], None] | None = ...) -> List[bytes]: ...
def shutdown(self, callback: Callable[[], None] | None = ...) -> List[bytes]: ...
def feed_eof(self) -> None: ...
def feed_ssldata(self, data: bytes, only_handshake: bool = ...) -> Tuple[List[bytes], List[bytes]]: ...
def feed_appdata(self, data: bytes, offset: int = ...) -> Tuple[List[bytes], int]: ...
@@ -49,7 +49,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
_ssl_protocol: SSLProtocol
_closed: bool
def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol) -> None: ...
def get_extra_info(self, name: str, default: Optional[Any] = ...) -> Dict[str, Any]: ...
def get_extra_info(self, name: str, default: Any | None = ...) -> Dict[str, Any]: ...
def set_protocol(self, protocol: protocols.BaseProtocol) -> None: ...
def get_protocol(self) -> protocols.BaseProtocol: ...
def is_closing(self) -> bool: ...
@@ -58,7 +58,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
def is_reading(self) -> bool: ...
def pause_reading(self) -> None: ...
def resume_reading(self) -> None: ...
def set_write_buffer_limits(self, high: Optional[int] = ..., low: Optional[int] = ...) -> None: ...
def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ...
def get_write_buffer_size(self) -> int: ...
if sys.version_info >= (3, 7):
@property
@@ -70,7 +70,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
class SSLProtocol(protocols.Protocol):
_server_side: bool
_server_hostname: Optional[str]
_server_hostname: str | None
_sslcontext: ssl.SSLContext
_extra: Dict[str, Any]
_write_backlog: Deque[Tuple[bytes, int]]
@@ -78,13 +78,13 @@ class SSLProtocol(protocols.Protocol):
_waiter: futures.Future[Any]
_loop: events.AbstractEventLoop
_app_transport: _SSLProtocolTransport
_sslpipe: Optional[_SSLPipe]
_sslpipe: _SSLPipe | None
_session_established: bool
_in_handshake: bool
_in_shutdown: bool
_transport: Optional[transports.BaseTransport]
_transport: transports.BaseTransport | None
_call_connection_made: bool
_ssl_handshake_timeout: Optional[int]
_ssl_handshake_timeout: int | None
_app_protocol: protocols.BaseProtocol
_app_protocol_is_buffer: bool
@@ -96,9 +96,9 @@ class SSLProtocol(protocols.Protocol):
sslcontext: ssl.SSLContext,
waiter: futures.Future[Any],
server_side: bool = ...,
server_hostname: Optional[str] = ...,
server_hostname: str | None = ...,
call_connection_made: bool = ...,
ssl_handshake_timeout: Optional[int] = ...,
ssl_handshake_timeout: int | None = ...,
) -> None: ...
else:
def __init__(
@@ -108,25 +108,25 @@ class SSLProtocol(protocols.Protocol):
sslcontext: ssl.SSLContext,
waiter: futures.Future[Any],
server_side: bool = ...,
server_hostname: Optional[str] = ...,
server_hostname: str | None = ...,
call_connection_made: bool = ...,
) -> None: ...
if sys.version_info >= (3, 7):
def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ...
def _wakeup_waiter(self, exc: Optional[BaseException] = ...) -> None: ...
def _wakeup_waiter(self, exc: BaseException | None = ...) -> None: ...
def connection_made(self, transport: transports.BaseTransport) -> None: ...
def connection_lost(self, exc: Optional[BaseException]) -> None: ...
def connection_lost(self, exc: BaseException | None) -> None: ...
def pause_writing(self) -> None: ...
def resume_writing(self) -> None: ...
def data_received(self, data: bytes) -> None: ...
def eof_received(self) -> None: ...
def _get_extra_info(self, name: str, default: Optional[Any] = ...) -> Any: ...
def _get_extra_info(self, name: str, default: Any | None = ...) -> Any: ...
def _start_shutdown(self) -> None: ...
def _write_appdata(self, data: bytes) -> None: ...
def _start_handshake(self) -> None: ...
if sys.version_info >= (3, 7):
def _check_handshake_timeout(self) -> None: ...
def _on_handshake_complete(self, handshake_exc: Optional[BaseException]) -> None: ...
def _on_handshake_complete(self, handshake_exc: BaseException | None) -> None: ...
def _process_write_backlog(self) -> None: ...
def _fatal_error(self, exc: BaseException, message: str = ...) -> None: ...
def _finalize(self) -> None: ...