| 29 | |
| 30 | |
| 31 | class TermState: |
| 32 | def __init__(self, attrs: list[int | list[bytes]]) -> None: |
| 33 | self.iflag = cast(int, attrs[0]) |
| 34 | self.oflag = cast(int, attrs[1]) |
| 35 | self.cflag = cast(int, attrs[2]) |
| 36 | self.lflag = cast(int, attrs[3]) |
| 37 | self.ispeed = cast(int, attrs[4]) |
| 38 | self.ospeed = cast(int, attrs[5]) |
| 39 | self.cc = cast(list[bytes], attrs[6]) |
| 40 | |
| 41 | def as_list(self) -> list[int | list[bytes]]: |
| 42 | return [ |
| 43 | self.iflag, |
| 44 | self.oflag, |
| 45 | self.cflag, |
| 46 | self.lflag, |
| 47 | self.ispeed, |
| 48 | self.ospeed, |
| 49 | # Always return a copy of the control characters list to ensure |
| 50 | # there are not any additional references to self.cc |
| 51 | self.cc[:], |
| 52 | ] |
| 53 | |
| 54 | def copy(self) -> "TermState": |
| 55 | return self.__class__(self.as_list()) |
| 56 | |
| 57 | |
| 58 | def tcgetattr(fd: int) -> TermState: |
no outgoing calls
no test coverage detected
searching dependent graphs…