@@ -39,10 +39,8 @@ class AbstractServer:
39
39
if sys .version_info >= (3 , 7 ):
40
40
def get_loop (self ) -> AbstractEventLoop : ...
41
41
def is_serving (self ) -> bool : ...
42
- @coroutine
43
- def start_serving (self ) -> Generator [Any , None , None ]: ...
44
- @coroutine
45
- def serve_forever (self ) -> Generator [Any , None , None ]: ...
42
+ async def start_serving (self ) -> None : ...
43
+ async def serve_forever (self ) -> None : ...
46
44
@coroutine
47
45
def wait_closed (self ) -> Generator [Any , None , None ]: ...
48
46
@@ -113,60 +111,50 @@ class AbstractEventLoop(metaclass=ABCMeta):
113
111
def getnameinfo (self , sockaddr : tuple , flags : int = ...) -> Generator [Any , None , Tuple [str , int ]]: ...
114
112
if sys .version_info >= (3 , 7 ):
115
113
@abstractmethod
116
- @coroutine
117
- def sock_sendfile (self , sock : socket , file : IO [bytes ], offset : int = ..., count : Optional [int ] = ..., * ,
118
- fallback : bool = ...) -> Generator [Any , None , int ]: ...
114
+ async def sock_sendfile (self , sock : socket , file : IO [bytes ], offset : int = ..., count : Optional [int ] = ..., * ,
115
+ fallback : bool = ...) -> int : ...
119
116
@overload
120
117
@abstractmethod
121
- @coroutine
122
- def create_connection (self , protocol_factory : _ProtocolFactory , host : str = ..., port : int = ..., * ,
123
- ssl : _SSLContext = ..., family : int = ..., proto : int = ..., flags : int = ..., sock : None = ...,
124
- local_addr : Optional [str ] = ..., server_hostname : Optional [str ] = ...,
125
- ssl_handshake_timeout : Optional [float ] = ...) -> Generator [Any , None , _TransProtPair ]: ...
118
+ async def create_connection (self , protocol_factory : _ProtocolFactory , host : str = ..., port : int = ..., * ,
119
+ ssl : _SSLContext = ..., family : int = ..., proto : int = ..., flags : int = ...,
120
+ sock : None = ..., local_addr : Optional [str ] = ..., server_hostname : Optional [str ] = ...,
121
+ ssl_handshake_timeout : Optional [float ] = ...) -> _TransProtPair : ...
126
122
@overload
127
123
@abstractmethod
128
- @coroutine
129
- def create_connection (self , protocol_factory : _ProtocolFactory , host : None = ..., port : None = ..., * ,
130
- ssl : _SSLContext = ..., family : int = ..., proto : int = ..., flags : int = ..., sock : socket ,
131
- local_addr : None = ..., server_hostname : Optional [str ] = ...,
132
- ssl_handshake_timeout : Optional [float ] = ...) -> Generator [Any , None , _TransProtPair ]: ...
124
+ async def create_connection (self , protocol_factory : _ProtocolFactory , host : None = ..., port : None = ..., * ,
125
+ ssl : _SSLContext = ..., family : int = ..., proto : int = ..., flags : int = ...,
126
+ sock : socket , local_addr : None = ..., server_hostname : Optional [str ] = ...,
127
+ ssl_handshake_timeout : Optional [float ] = ...) -> _TransProtPair : ...
133
128
@overload
134
129
@abstractmethod
135
- @coroutine
136
- def create_server (self , protocol_factory : _ProtocolFactory , host : Optional [Union [str , Sequence [str ]]] = ...,
137
- port : int = ..., * , family : int = ..., flags : int = ..., sock : None = ..., backlog : int = ...,
138
- ssl : _SSLContext = ..., reuse_address : Optional [bool ] = ..., reuse_port : Optional [bool ] = ...,
139
- ssl_handshake_timeout : Optional [float ] = ..., start_serving : bool = ...) -> Generator [Any , None , AbstractServer ]: ...
130
+ async def create_server (self , protocol_factory : _ProtocolFactory , host : Optional [Union [str , Sequence [str ]]] = ...,
131
+ port : int = ..., * , family : int = ..., flags : int = ..., sock : None = ..., backlog : int = ...,
132
+ ssl : _SSLContext = ..., reuse_address : Optional [bool ] = ..., reuse_port : Optional [bool ] = ...,
133
+ ssl_handshake_timeout : Optional [float ] = ..., start_serving : bool = ...) -> AbstractServer : ...
140
134
@overload
141
135
@abstractmethod
142
- @coroutine
143
- def create_server (self , protocol_factory : _ProtocolFactory , host : None = ..., port : None = ..., * ,
144
- family : int = ..., flags : int = ..., sock : socket = ..., backlog : int = ...,
145
- ssl : _SSLContext = ..., reuse_address : Optional [bool ] = ..., reuse_port : Optional [bool ] = ...,
146
- ssl_handshake_timeout : Optional [float ] = ..., start_serving : bool = ...) -> Generator [Any , None , AbstractServer ]: ...
136
+ async def create_server (self , protocol_factory : _ProtocolFactory , host : None = ..., port : None = ..., * ,
137
+ family : int = ..., flags : int = ..., sock : socket = ..., backlog : int = ...,
138
+ ssl : _SSLContext = ..., reuse_address : Optional [bool ] = ..., reuse_port : Optional [bool ] = ...,
139
+ ssl_handshake_timeout : Optional [float ] = ..., start_serving : bool = ...) -> AbstractServer : ...
147
140
@abstractmethod
148
- @coroutine
149
- def create_unix_connection (self , protocol_factory : _ProtocolFactory , path : str , * , ssl : _SSLContext = ...,
150
- sock : Optional [socket ] = ..., server_hostname : str = ...,
151
- ssl_handshake_timeout : Optional [float ]) -> Generator [Any , None , _TransProtPair ]: ...
141
+ async def create_unix_connection (self , protocol_factory : _ProtocolFactory , path : str , * , ssl : _SSLContext = ...,
142
+ sock : Optional [socket ] = ..., server_hostname : str = ...,
143
+ ssl_handshake_timeout : Optional [float ]) -> _TransProtPair : ...
152
144
@abstractmethod
153
- @coroutine
154
- def create_unix_server (self , protocol_factory : _ProtocolFactory , path : str , * , sock : Optional [socket ] = ...,
155
- backlog : int = ..., ssl : _SSLContext = ..., ssl_handshake_timeout : Optional [float ] = ...,
156
- start_serving : bool = ...) -> Generator [Any , None , AbstractServer ]: ...
145
+ async def create_unix_server (self , protocol_factory : _ProtocolFactory , path : str , * , sock : Optional [socket ] = ...,
146
+ backlog : int = ..., ssl : _SSLContext = ..., ssl_handshake_timeout : Optional [float ] = ...,
147
+ start_serving : bool = ...) -> AbstractServer : ...
157
148
@abstractmethod
158
- @coroutine
159
- def connect_accepted_socket (self , protocol_factory : _ProtocolFactory , sock : socket , * , ssl : _SSLContext = ...,
160
- ssl_handshake_timeout : Optional [float ] = ...) -> Generator [Any , None , _TransProtPair ]: ...
149
+ async def connect_accepted_socket (self , protocol_factory : _ProtocolFactory , sock : socket , * , ssl : _SSLContext = ...,
150
+ ssl_handshake_timeout : Optional [float ] = ...) -> _TransProtPair : ...
161
151
@abstractmethod
162
- @coroutine
163
- def sendfile (self , transport : BaseTransport , file : IO [bytes ], offset : int = ..., count : Optional [int ] = ..., * ,
164
- fallback : bool = ...) -> Generator [Any , None , int ]: ...
152
+ async def sendfile (self , transport : BaseTransport , file : IO [bytes ], offset : int = ..., count : Optional [int ] = ..., * ,
153
+ fallback : bool = ...) -> int : ...
165
154
@abstractmethod
166
- @coroutine
167
- def start_tls (self , transport : BaseTransport , protocol : BaseProtocol , sslcontext : ssl .SSLContext , * ,
168
- server_side : bool = ..., server_hostname : Optional [str ] = ..., ssl_handshake_timeout : Optional [float ] = ...
169
- ) -> Generator [Any , None , BaseTransport ]: ...
155
+ async def start_tls (self , transport : BaseTransport , protocol : BaseProtocol , sslcontext : ssl .SSLContext , * ,
156
+ server_side : bool = ..., server_hostname : Optional [str ] = ...,
157
+ ssl_handshake_timeout : Optional [float ] = ...) -> BaseTransport : ...
170
158
else :
171
159
@overload
172
160
@abstractmethod
@@ -244,20 +232,15 @@ class AbstractEventLoop(metaclass=ABCMeta):
244
232
# Completion based I/O methods returning Futures prior to 3.7
245
233
if sys .version_info >= (3 , 7 ):
246
234
@abstractmethod
247
- @coroutine
248
- def sock_recv (self , sock : socket , nbytes : int ) -> Generator [Any , None , bytes ]: ...
235
+ async def sock_recv (self , sock : socket , nbytes : int ) -> bytes : ...
249
236
@abstractmethod
250
- @coroutine
251
- def sock_recv_into (self , sock : socket , buf : bytearray ) -> Generator [Any , None , int ]: ...
237
+ async def sock_recv_into (self , sock : socket , buf : bytearray ) -> int : ...
252
238
@abstractmethod
253
- @coroutine
254
- def sock_sendall (self , sock : socket , data : bytes ) -> Generator [Any , None , None ]: ...
239
+ async def sock_sendall (self , sock : socket , data : bytes ) -> None : ...
255
240
@abstractmethod
256
- @coroutine
257
- def sock_connect (self , sock : socket , address : _Address ) -> Generator [Any , None , None ]: ...
241
+ async def sock_connect (self , sock : socket , address : _Address ) -> None : ...
258
242
@abstractmethod
259
- @coroutine
260
- def sock_accept (self , sock : socket ) -> Generator [Any , None , Tuple [socket , _RetAddress ]]: ...
243
+ async def sock_accept (self , sock : socket ) -> Tuple [socket , _RetAddress ]: ...
261
244
else :
262
245
@abstractmethod
263
246
def sock_recv (self , sock : socket , nbytes : int ) -> Future [bytes ]: ...
0 commit comments