Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reverted] Improved annotations for select.select() #1080

Merged
merged 2 commits into from
Mar 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions stdlib/2/select.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Stubs for the 'select' module."""

from typing import Any, Optional, Tuple, Iterable, List
from typing import Any, Optional, Tuple, Iterable, List, Sequence, TypeVar

EPOLLERR = ... # type: int
EPOLLET = ... # type: int
Expand Down Expand Up @@ -66,7 +66,11 @@ POLLWRBAND = ... # type: int
POLLWRNORM = ... # type: int

def poll() -> epoll: ...
def select(rlist, wlist, xlist, timeout: float = None) -> Tuple[List, List, List]: ...

_R = TypeVar("_R")
_W = TypeVar("_W")
_X = TypeVar("_X")
def select(rlist: Sequence[_R], wlist: Sequence[_W], xlist: Sequence[_X], timeout: float = None) -> Tuple[List[_R], List[_W], List[_X]]: ...

class error(Exception): ...

Expand Down
13 changes: 8 additions & 5 deletions stdlib/3/select.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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): ...

Expand All @@ -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]]: ...