diff --git a/stdlib/2and3/asyncore.pyi b/stdlib/2and3/asyncore.pyi index 983db7dcf..a5126ccb3 100644 --- a/stdlib/2and3/asyncore.pyi +++ b/stdlib/2and3/asyncore.pyi @@ -2,10 +2,11 @@ from typing import Tuple, Union, Optional, Any, Dict, overload import os import select -import socket import sys import time import warnings +from socket import SocketType +from typing import Optional from errno import (EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, ENOTCONN, ESHUTDOWN, EINTR, EISCONN, EBADF, ECONNABORTED, @@ -38,19 +39,20 @@ class dispatcher: connecting = ... # type: bool closing = ... # type: bool ignore_log_types = ... # type: frozenset[str] + socket = ... # type: Optional[SocketType] # undocumented - def __init__(self, sock: Optional[socket.socket] = ..., map: _maptype = ...) -> None: ... + def __init__(self, sock: Optional[SocketType] = ..., map: _maptype = ...) -> None: ... def add_channel(self, map: _maptype = ...) -> None: ... def del_channel(self, map: _maptype = ...) -> None: ... def create_socket(self, family: int, type: int) -> None: ... - def set_socket(self, sock: socket.socket, map: _maptype = ...) -> None: ... + def set_socket(self, sock: SocketType, map: _maptype = ...) -> None: ... def set_reuse_addr(self) -> None: ... def readable(self) -> bool: ... def writable(self) -> bool: ... def listen(self, backlog: int) -> None: ... def bind(self, address: Union[tuple, str]) -> None: ... def connect(self, address: Union[tuple, str]) -> None: ... - def accept(self) -> Optional[Tuple[socket.socket, Any]]: ... + def accept(self) -> Optional[Tuple[SocketType, Any]]: ... def send(self, data: bytes) -> int: ... def recv(self, buffer_size: int) -> bytes: ... def close(self) -> None: ... @@ -108,7 +110,7 @@ class dispatcher: def shutdown(self, how: int) -> None: ... class dispatcher_with_send(dispatcher): - def __init__(self, sock: socket.socket = ..., map: _maptype = ...) -> None: ... + def __init__(self, sock: SocketType = ..., map: _maptype = ...) -> None: ... def initiate_send(self) -> None: ... def handle_write(self) -> None: ... # incompatible signature: