| 21 | |
| 22 | |
| 23 | class TermState: |
| 24 | def __init__(self, tuples): |
| 25 | ( |
| 26 | self.iflag, |
| 27 | self.oflag, |
| 28 | self.cflag, |
| 29 | self.lflag, |
| 30 | self.ispeed, |
| 31 | self.ospeed, |
| 32 | self.cc, |
| 33 | ) = tuples |
| 34 | |
| 35 | def as_list(self): |
| 36 | return [ |
| 37 | self.iflag, |
| 38 | self.oflag, |
| 39 | self.cflag, |
| 40 | self.lflag, |
| 41 | self.ispeed, |
| 42 | self.ospeed, |
| 43 | # Always return a copy of the control characters list to ensure |
| 44 | # there are not any additional references to self.cc |
| 45 | self.cc[:], |
| 46 | ] |
| 47 | |
| 48 | def copy(self): |
| 49 | return self.__class__(self.as_list()) |
| 50 | |
| 51 | |
| 52 | def tcgetattr(fd): |