Improved annotations for select.select() (#1080)

This commit is contained in:
Nikhil Marathe
2017-03-23 10:30:48 -07:00
committed by Guido van Rossum
parent fa104ea456
commit 7e05d47b81
2 changed files with 14 additions and 7 deletions

View File

@@ -2,7 +2,7 @@
# NOTE: These are incomplete!
from typing import Any, Tuple, List, Sequence
from typing import Any, Tuple, List, Sequence, TypeVar
class error(Exception): ...
@@ -21,7 +21,10 @@ class poll:
def unregister(self, fd: Any) -> None: ...
def poll(self, timeout: int = ...) -> List[Tuple[int, int]]: ...
def select(rlist: Sequence, wlist: Sequence, xlist: Sequence,
timeout: float = ...) -> Tuple[List[Any],
List[Any],
List[Any]]: ...
# Not the canonical naming choices, but these map to the select arguments. We
# need 3 because nothing in select prevents the read set from being socket
# objects and the write set from being file descriptors.
_R = TypeVar("_R")
_W = TypeVar("_W")
_X = TypeVar("_X")
def select(rlist: Sequence[_R], wlist: Sequence[_W], xlist: Sequence[_X], timeout: float = ...) -> Tuple[List[_R], List[_W], List[_X]]: ...