@@ -39,8 +39,10 @@ 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
- async def start_serving (self ) -> None : ...
43
- async def serve_forever (self ) -> None : ...
42
+ @coroutine
43
+ def start_serving (self ) -> Generator [Any , None , None ]: ...
44
+ @coroutine
45
+ def serve_forever (self ) -> Generator [Any , None , None ]: ...
44
46
@coroutine
45
47
def wait_closed (self ) -> Generator [Any , None , None ]: ...
46
48
@@ -111,50 +113,60 @@ class AbstractEventLoop(metaclass=ABCMeta):
111
113
def getnameinfo (self , sockaddr : tuple , flags : int = ...) -> Generator [Any , None , Tuple [str , int ]]: ...
112
114
if sys .version_info >= (3 , 7 ):
113
115
@abstractmethod
114
- async def sock_sendfile (self , sock : socket , file : IO [bytes ], offset : int = ..., count : Optional [int ] = ..., * ,
115
- fallback : bool = ...) -> int : ...
116
+ @coroutine
117
+ def sock_sendfile (self , sock : socket , file : IO [bytes ], offset : int = ..., count : Optional [int ] = ..., * ,
118
+ fallback : bool = ...) -> Generator [Any , None , int ]: ...
116
119
@overload
117
120
@abstractmethod
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 : ...
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 ]: ...
122
126
@overload
123
127
@abstractmethod
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 : ...
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 ]: ...
128
133
@overload
129
134
@abstractmethod
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 : ...
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 ]: ...
134
140
@overload
135
141
@abstractmethod
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 : ...
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 ]: ...
140
147
@abstractmethod
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 : ...
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 ]: ...
144
152
@abstractmethod
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 : ...
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 ]: ...
148
157
@abstractmethod
149
- async def connect_accepted_socket (self , protocol_factory : _ProtocolFactory , sock : socket , * , ssl : _SSLContext = ...,
150
- ssl_handshake_timeout : Optional [float ] = ...) -> _TransProtPair : ...
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 ]: ...
151
161
@abstractmethod
152
- async def sendfile (self , transport : BaseTransport , file : IO [bytes ], offset : int = ..., count : Optional [int ] = ..., * ,
153
- fallback : bool = ...) -> int : ...
162
+ @coroutine
163
+ def sendfile (self , transport : BaseTransport , file : IO [bytes ], offset : int = ..., count : Optional [int ] = ..., * ,
164
+ fallback : bool = ...) -> Generator [Any , None , int ]: ...
154
165
@abstractmethod
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 : ...
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 ]: ...
158
170
else :
159
171
@overload
160
172
@abstractmethod
@@ -232,15 +244,20 @@ class AbstractEventLoop(metaclass=ABCMeta):
232
244
# Completion based I/O methods returning Futures prior to 3.7
233
245
if sys .version_info >= (3 , 7 ):
234
246
@abstractmethod
235
- async def sock_recv (self , sock : socket , nbytes : int ) -> bytes : ...
247
+ @coroutine
248
+ def sock_recv (self , sock : socket , nbytes : int ) -> Generator [Any , None , bytes ]: ...
236
249
@abstractmethod
237
- async def sock_recv_into (self , sock : socket , buf : bytearray ) -> int : ...
250
+ @coroutine
251
+ def sock_recv_into (self , sock : socket , buf : bytearray ) -> Generator [Any , None , int ]: ...
238
252
@abstractmethod
239
- async def sock_sendall (self , sock : socket , data : bytes ) -> None : ...
253
+ @coroutine
254
+ def sock_sendall (self , sock : socket , data : bytes ) -> Generator [Any , None , None ]: ...
240
255
@abstractmethod
241
- async def sock_connect (self , sock : socket , address : _Address ) -> None : ...
256
+ @coroutine
257
+ def sock_connect (self , sock : socket , address : _Address ) -> Generator [Any , None , None ]: ...
242
258
@abstractmethod
243
- async def sock_accept (self , sock : socket ) -> Tuple [socket , _RetAddress ]: ...
259
+ @coroutine
260
+ def sock_accept (self , sock : socket ) -> Generator [Any , None , Tuple [socket , _RetAddress ]]: ...
244
261
else :
245
262
@abstractmethod
246
263
def sock_recv (self , sock : socket , nbytes : int ) -> Future [bytes ]: ...
0 commit comments