Skip to content
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
9 changes: 5 additions & 4 deletions stdlib/2and3/select.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import sys
from typing import Any, Optional, Sequence, Tuple, Iterable, List, Union
from typing import Any, Iterable, List, Optional, Protocol, Sequence, Tuple, Union

# When we have protocols, this should change to a protocol with a fileno method
# See https://docs.python.org/3/c-api/file.html#c.PyObject_AsFileDescriptor
_FileDescriptor = Union[int, Any]
class _HasFileno(Protocol):
def fileno(self) -> int: ...

_FileDescriptor = Union[int, _HasFileno]

EPOLLERR: int
EPOLLET: int
Expand Down
10 changes: 4 additions & 6 deletions stdlib/3/selectors.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Stubs for selector
# See https://docs.python.org/3/library/selectors.html

from typing import Any, List, NamedTuple, Mapping, Tuple, Optional, Union
from abc import ABCMeta, abstractmethod
import socket
from typing import Any, List, Mapping, NamedTuple, Optional, Protocol, Tuple, Union

class _HasFileno(Protocol):
def fileno(self) -> int: ...

# Type aliases added mainly to preserve some context
#
# See https://github.com/python/typeshed/issues/482
# for details regarding how _FileObject is typed.
_FileObject = Union[int, socket.socket]
_FileObject = Union[int, _HasFileno]
_FileDescriptor = int
_EventMask = int

Expand Down