mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Unify file descriptor definitions (#3584)
The _types module can house any common type defintions used throughout the rest of typeshed to keep defintions in sync. First candidate is file descriptors where anything with `fileno()` method is accepted. There were several different implementations in various files that can be unified.
This commit is contained in:
committed by
Rebecca Chen
parent
1651348a08
commit
955e9c7da4
@@ -1,8 +1,8 @@
|
||||
# Stubs for termios
|
||||
|
||||
from typing import IO, List, Union
|
||||
from _types import FileDescriptorLike
|
||||
|
||||
_FD = Union[int, IO[str]]
|
||||
_Attr = List[Union[int, List[bytes]]]
|
||||
|
||||
# TODO constants not really documented
|
||||
@@ -238,11 +238,11 @@ VWERASE: int
|
||||
XCASE: int
|
||||
XTABS: int
|
||||
|
||||
def tcgetattr(fd: _FD) -> _Attr: ...
|
||||
def tcsetattr(fd: _FD, when: int, attributes: _Attr) -> None: ...
|
||||
def tcsendbreak(fd: _FD, duration: int) -> None: ...
|
||||
def tcdrain(fd: _FD) -> None: ...
|
||||
def tcflush(fd: _FD, queue: int) -> None: ...
|
||||
def tcflow(fd: _FD, action: int) -> None: ...
|
||||
def tcgetattr(fd: FileDescriptorLike) -> _Attr: ...
|
||||
def tcsetattr(fd: FileDescriptorLike, when: int, attributes: _Attr) -> None: ...
|
||||
def tcsendbreak(fd: FileDescriptorLike, duration: int) -> None: ...
|
||||
def tcdrain(fd: FileDescriptorLike) -> None: ...
|
||||
def tcflush(fd: FileDescriptorLike, queue: int) -> None: ...
|
||||
def tcflow(fd: FileDescriptorLike, action: int) -> None: ...
|
||||
|
||||
class error(Exception): ...
|
||||
|
||||
Reference in New Issue
Block a user