@@ -3,6 +3,7 @@ from socket import socket, _Address, _RetAddress
33import ssl
44import sys
55from typing import Any , Awaitable , Callable , Dict , Generator , IO , List , Optional , Sequence , Tuple , TypeVar , Union , overload
6+ from abc import ABCMeta
67from asyncio .futures import Future
78from asyncio .coroutines import coroutine
89from asyncio .events import AbstractEventLoop , AbstractServer , Handle , TimerHandle
@@ -17,7 +18,9 @@ _ProtocolFactory = Callable[[], BaseProtocol]
1718_SSLContext = Union [bool , None , ssl .SSLContext ]
1819_TransProtPair = Tuple [BaseTransport , BaseProtocol ]
1920
20- class BaseEventLoop (AbstractEventLoop ):
21+ class Server (AbstractServer ): ...
22+
23+ class BaseEventLoop (AbstractEventLoop , metaclass = ABCMeta ):
2124 def run_forever (self ) -> None : ...
2225
2326 # Can't use a union, see mypy issue # 1873.
@@ -76,18 +79,12 @@ class BaseEventLoop(AbstractEventLoop):
7679 async def create_server (self , protocol_factory : _ProtocolFactory , host : Optional [Union [str , Sequence [str ]]] = ...,
7780 port : int = ..., * , family : int = ..., flags : int = ..., sock : None = ..., backlog : int = ...,
7881 ssl : _SSLContext = ..., reuse_address : Optional [bool ] = ..., reuse_port : Optional [bool ] = ...,
79- ssl_handshake_timeout : Optional [float ] = ..., start_serving : bool = ...) -> AbstractServer : ...
82+ ssl_handshake_timeout : Optional [float ] = ..., start_serving : bool = ...) -> Server : ...
8083 @overload
8184 async def create_server (self , protocol_factory : _ProtocolFactory , host : None = ..., port : None = ..., * ,
8285 family : int = ..., flags : int = ..., sock : socket = ..., backlog : int = ...,
8386 ssl : _SSLContext = ..., reuse_address : Optional [bool ] = ..., reuse_port : Optional [bool ] = ...,
84- ssl_handshake_timeout : Optional [float ] = ..., start_serving : bool = ...) -> AbstractServer : ...
85- async def create_unix_connection (self , protocol_factory : _ProtocolFactory , path : str , * , ssl : _SSLContext = ...,
86- sock : Optional [socket ] = ..., server_hostname : str = ...,
87- ssl_handshake_timeout : Optional [float ]) -> _TransProtPair : ...
88- async def create_unix_server (self , protocol_factory : _ProtocolFactory , path : str , * , sock : Optional [socket ] = ...,
89- backlog : int = ..., ssl : _SSLContext = ..., ssl_handshake_timeout : Optional [float ] = ...,
90- start_serving : bool = ...) -> AbstractServer : ...
87+ ssl_handshake_timeout : Optional [float ] = ..., start_serving : bool = ...) -> Server : ...
9188 async def connect_accepted_socket (self , protocol_factory : _ProtocolFactory , sock : socket , * , ssl : _SSLContext = ...,
9289 ssl_handshake_timeout : Optional [float ] = ...) -> _TransProtPair : ...
9390 async def sendfile (self , transport : BaseTransport , file : IO [bytes ], offset : int = ..., count : Optional [int ] = ..., * ,
@@ -112,21 +109,14 @@ class BaseEventLoop(AbstractEventLoop):
112109 family : int = ..., flags : int = ...,
113110 sock : None = ..., backlog : int = ..., ssl : _SSLContext = ...,
114111 reuse_address : Optional [bool ] = ...,
115- reuse_port : Optional [bool ] = ...) -> Generator [Any , None , AbstractServer ]: ...
112+ reuse_port : Optional [bool ] = ...) -> Generator [Any , None , Server ]: ...
116113 @overload
117114 @coroutine
118115 def create_server (self , protocol_factory : _ProtocolFactory , host : None = ..., port : None = ..., * ,
119116 family : int = ..., flags : int = ...,
120117 sock : socket , backlog : int = ..., ssl : _SSLContext = ...,
121118 reuse_address : Optional [bool ] = ...,
122- reuse_port : Optional [bool ] = ...) -> Generator [Any , None , AbstractServer ]: ...
123- @coroutine
124- def create_unix_connection (self , protocol_factory : _ProtocolFactory , path : str , * ,
125- ssl : _SSLContext = ..., sock : Optional [socket ] = ...,
126- server_hostname : str = ...) -> Generator [Any , None , _TransProtPair ]: ...
127- @coroutine
128- def create_unix_server (self , protocol_factory : _ProtocolFactory , path : str , * ,
129- sock : Optional [socket ] = ..., backlog : int = ..., ssl : _SSLContext = ...) -> Generator [Any , None , AbstractServer ]: ...
119+ reuse_port : Optional [bool ] = ...) -> Generator [Any , None , Server ]: ...
130120 @coroutine
131121 def connect_accepted_socket (self , protocol_factory : _ProtocolFactory , sock : socket , * , ssl : _SSLContext = ...) -> Generator [Any , None , _TransProtPair ]: ...
132122 @coroutine
0 commit comments