@@ -21,7 +21,7 @@ _T = TypeVar('_T')
21
21
_Context = Dict [str , Any ]
22
22
_ExceptionHandler = Callable [[asyncio .AbstractEventLoop , _Context ], Any ]
23
23
_SSLContext = Union [bool , None , ssl .SSLContext ]
24
- _TransProtPair = Tuple [ asyncio . transports . BaseTransport , asyncio .protocols . BaseProtocol ]
24
+ _ProtocolT = TypeVar ( "_ProtocolT" , bound = asyncio .BaseProtocol )
25
25
26
26
class Loop :
27
27
def call_soon (
@@ -143,7 +143,7 @@ class Loop:
143
143
@overload
144
144
async def create_connection (
145
145
self ,
146
- protocol_factory : asyncio . events . _ProtocolFactory ,
146
+ protocol_factory : Callable [[], _ProtocolT ] ,
147
147
host : str = ...,
148
148
port : int = ...,
149
149
* ,
@@ -156,11 +156,11 @@ class Loop:
156
156
server_hostname : Optional [str ] = ...,
157
157
ssl_handshake_timeout : Optional [float ] = ...,
158
158
ssl_shutdown_timeout : Optional [float ] = ...,
159
- ) -> _TransProtPair : ...
159
+ ) -> tuple [ asyncio . BaseProtocol , _ProtocolT ] : ...
160
160
@overload
161
161
async def create_connection (
162
162
self ,
163
- protocol_factory : asyncio . events . _ProtocolFactory ,
163
+ protocol_factory : Callable [[], _ProtocolT ] ,
164
164
host : None = ...,
165
165
port : None = ...,
166
166
* ,
@@ -173,7 +173,7 @@ class Loop:
173
173
server_hostname : Optional [str ] = ...,
174
174
ssl_handshake_timeout : Optional [float ] = ...,
175
175
ssl_shutdown_timeout : Optional [float ] = ...,
176
- ) -> _TransProtPair : ...
176
+ ) -> tuple [ asyncio . BaseProtocol , _ProtocolT ] : ...
177
177
async def create_unix_server (
178
178
self ,
179
179
protocol_factory : asyncio .events ._ProtocolFactory ,
@@ -188,15 +188,15 @@ class Loop:
188
188
) -> asyncio .AbstractServer : ...
189
189
async def create_unix_connection (
190
190
self ,
191
- protocol_factory : asyncio . events . _ProtocolFactory ,
191
+ protocol_factory : Callable [[], _ProtocolT ] ,
192
192
path : Optional [str ] = ...,
193
193
* ,
194
194
ssl : _SSLContext = ...,
195
195
sock : Optional [socket ] = ...,
196
196
server_hostname : Optional [str ] = ...,
197
197
ssl_handshake_timeout : Optional [float ] = ...,
198
198
ssl_shutdown_timeout : Optional [float ] = ...,
199
- ) -> _TransProtPair : ...
199
+ ) -> tuple [ asyncio . BaseProtocol , _ProtocolT ] : ...
200
200
def default_exception_handler (self , context : _Context ) -> None : ...
201
201
def get_exception_handler (self ) -> Optional [_ExceptionHandler ]: ...
202
202
def set_exception_handler (self , handler : Optional [_ExceptionHandler ]) -> None : ...
@@ -212,49 +212,49 @@ class Loop:
212
212
async def sock_connect (self , sock : socket , address : _Address ) -> None : ...
213
213
async def connect_accepted_socket (
214
214
self ,
215
- protocol_factory : asyncio . events . _ProtocolFactory ,
215
+ protocol_factory : Callable [[], _ProtocolT ] ,
216
216
sock : socket ,
217
217
* ,
218
218
ssl : _SSLContext = ...,
219
219
ssl_handshake_timeout : Optional [float ] = ...,
220
220
ssl_shutdown_timeout : Optional [float ] = ...,
221
- ) -> _TransProtPair : ...
221
+ ) -> tuple [ asyncio . BaseProtocol , _ProtocolT ] : ...
222
222
async def run_in_executor (
223
223
self , executor : Any , func : Callable [..., _T ], * args : Any
224
224
) -> _T : ...
225
225
def set_default_executor (self , executor : Any ) -> None : ...
226
226
async def subprocess_shell (
227
227
self ,
228
- protocol_factory : asyncio . events . _ProtocolFactory ,
228
+ protocol_factory : Callable [[], _ProtocolT ] ,
229
229
cmd : Union [bytes , str ],
230
230
* ,
231
231
stdin : Any = ...,
232
232
stdout : Any = ...,
233
233
stderr : Any = ...,
234
234
** kwargs : Any ,
235
- ) -> _TransProtPair : ...
235
+ ) -> tuple [ asyncio . BaseProtocol , _ProtocolT ] : ...
236
236
async def subprocess_exec (
237
237
self ,
238
- protocol_factory : asyncio . events . _ProtocolFactory ,
238
+ protocol_factory : Callable [[], _ProtocolT ] ,
239
239
* args : Any ,
240
240
stdin : Any = ...,
241
241
stdout : Any = ...,
242
242
stderr : Any = ...,
243
243
** kwargs : Any ,
244
- ) -> _TransProtPair : ...
244
+ ) -> tuple [ asyncio . BaseProtocol , _ProtocolT ] : ...
245
245
async def connect_read_pipe (
246
- self , protocol_factory : asyncio . events . _ProtocolFactory , pipe : Any
247
- ) -> _TransProtPair : ...
246
+ self , protocol_factory : Callable [[], _ProtocolT ] , pipe : Any
247
+ ) -> tuple [ asyncio . BaseProtocol , _ProtocolT ] : ...
248
248
async def connect_write_pipe (
249
- self , protocol_factory : asyncio . events . _ProtocolFactory , pipe : Any
250
- ) -> _TransProtPair : ...
249
+ self , protocol_factory : Callable [[], _ProtocolT ] , pipe : Any
250
+ ) -> tuple [ asyncio . BaseProtocol , _ProtocolT ] : ...
251
251
def add_signal_handler (
252
252
self , sig : int , callback : Callable [..., Any ], * args : Any
253
253
) -> None : ...
254
254
def remove_signal_handler (self , sig : int ) -> bool : ...
255
255
async def create_datagram_endpoint (
256
256
self ,
257
- protocol_factory : asyncio . events . _ProtocolFactory ,
257
+ protocol_factory : Callable [[], _ProtocolT ] ,
258
258
local_addr : Optional [Tuple [str , int ]] = ...,
259
259
remote_addr : Optional [Tuple [str , int ]] = ...,
260
260
* ,
@@ -265,7 +265,7 @@ class Loop:
265
265
reuse_port : Optional [bool ] = ...,
266
266
allow_broadcast : Optional [bool ] = ...,
267
267
sock : Optional [socket ] = ...,
268
- ) -> _TransProtPair : ...
268
+ ) -> tuple [ asyncio . BaseProtocol , _ProtocolT ] : ...
269
269
async def shutdown_asyncgens (self ) -> None : ...
270
270
async def shutdown_default_executor (self ) -> None : ...
271
271
# Loop doesn't implement these, but since they are marked as abstract in typeshed,
0 commit comments