mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
termios: Fix type of tcgetattr and tcsetattr attributes (#4662)
Returning a union from tcgetattr forces the caller to use isinstance or a type: ignore comment if they modify the returned list. Return List[Any] instead. The cc field has ints at cc[termios.VTIME] and cc[termios.VMIN] if lflag & termios.ICANON is zero. Change _Attr to allow this. Fixes #4661
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from _typeshed import FileDescriptorLike
|
||||
from typing import List, Union
|
||||
from typing import Any, List, Union
|
||||
|
||||
_Attr = List[Union[int, List[bytes]]]
|
||||
_Attr = List[Union[int, List[Union[bytes, int]]]]
|
||||
|
||||
# TODO constants not really documented
|
||||
B0: int
|
||||
@@ -236,7 +236,7 @@ VWERASE: int
|
||||
XCASE: int
|
||||
XTABS: int
|
||||
|
||||
def tcgetattr(fd: FileDescriptorLike) -> _Attr: ...
|
||||
def tcgetattr(fd: FileDescriptorLike) -> List[Any]: ...
|
||||
def tcsetattr(fd: FileDescriptorLike, when: int, attributes: _Attr) -> None: ...
|
||||
def tcsendbreak(fd: FileDescriptorLike, duration: int) -> None: ...
|
||||
def tcdrain(fd: FileDescriptorLike) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user