Skip to content

Commit 0e26c1f

Browse files
JelleZijlstramatthiaskramm
authored andcommitted
asyncio: fix several types (#1450)
Fixes #1447
1 parent 6368baf commit 0e26c1f

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

stdlib/3.4/asyncio/events.pyi

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import selectors
12
from socket import socket
23
import ssl
34
import sys
@@ -124,7 +125,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
124125
@abstractmethod
125126
@coroutine
126127
def create_datagram_endpoint(self, protocol_factory: _ProtocolFactory,
127-
local_addr: str = ..., remote_addr: str = ..., *,
128+
local_addr: Optional[Tuple[str, int]] = ..., remote_addr: Optional[Tuple[str, int]] = ..., *,
128129
family: int = ..., proto: int = ..., flags: int = ...,
129130
reuse_address: Optional[bool] = ..., reuse_port: Optional[bool] = ...,
130131
allow_broadcast: Optional[bool] = ...,
@@ -146,17 +147,17 @@ class AbstractEventLoop(metaclass=ABCMeta):
146147
**kwargs: Any) -> Generator[Any, None, _TransProtPair]: ...
147148
@abstractmethod
148149
@coroutine
149-
def subprocess_exec(self, protocol_factory: _ProtocolFactory, *args: List[Any], stdin: Any = ...,
150+
def subprocess_exec(self, protocol_factory: _ProtocolFactory, *args: Any, stdin: Any = ...,
150151
stdout: Any = ..., stderr: Any = ...,
151152
**kwargs: Any) -> Generator[Any, None, _TransProtPair]: ...
152153
@abstractmethod
153-
def add_reader(self, fd: int, callback: Callable[..., Any], *args: List[Any]) -> None: ...
154+
def add_reader(self, fd: selectors._FileObject, callback: Callable[..., Any], *args: Any) -> None: ...
154155
@abstractmethod
155-
def remove_reader(self, fd: int) -> None: ...
156+
def remove_reader(self, fd: selectors._FileObject) -> None: ...
156157
@abstractmethod
157-
def add_writer(self, fd: int, callback: Callable[..., Any], *args: List[Any]) -> None: ...
158+
def add_writer(self, fd: selectors._FileObject, callback: Callable[..., Any], *args: Any) -> None: ...
158159
@abstractmethod
159-
def remove_writer(self, fd: int) -> None: ...
160+
def remove_writer(self, fd: selectors._FileObject) -> None: ...
160161
# Completion based I/O methods returning Futures.
161162
@abstractmethod
162163
@coroutine
@@ -172,7 +173,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
172173
def sock_accept(self, sock: socket) -> Generator[Any, None, Tuple[socket, Any]]: ...
173174
# Signal handling.
174175
@abstractmethod
175-
def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: List[Any]) -> None: ...
176+
def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: Any) -> None: ...
176177
@abstractmethod
177178
def remove_signal_handler(self, sig: int) -> None: ...
178179
# Error handlers.

stdlib/3.4/asyncio/transports.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Dict, Any, TypeVar, Mapping, List
1+
from typing import Dict, Any, TypeVar, Mapping, List, Optional, Tuple
22

33
__all__: List[str]
44

@@ -26,7 +26,7 @@ class WriteTransport(BaseTransport):
2626
class Transport(ReadTransport, WriteTransport): ...
2727

2828
class DatagramTransport(BaseTransport):
29-
def sendto(self, data: Any, addr: str = ...) -> None: ...
29+
def sendto(self, data: Any, addr: Optional[Tuple[str, int]] = ...) -> None: ...
3030
def abort(self) -> None: ...
3131

3232
class SubprocessTransport(BaseTransport):

0 commit comments

Comments
 (0)