(fp)
| 331 | |
| 332 | |
| 333 | def _screen_shape_linux(fp): # pragma: no cover |
| 334 | |
| 335 | try: |
| 336 | from array import array |
| 337 | from fcntl import ioctl |
| 338 | from termios import TIOCGWINSZ |
| 339 | except ImportError: |
| 340 | return None, None |
| 341 | else: |
| 342 | try: |
| 343 | rows, cols = array('h', ioctl(fp, TIOCGWINSZ, '\0' * 8))[:2] |
| 344 | return cols, rows |
| 345 | except Exception: |
| 346 | try: |
| 347 | return [int(os.environ[i]) - 1 for i in ("COLUMNS", "LINES")] |
| 348 | except (KeyError, ValueError): |
| 349 | return None, None |
| 350 | |
| 351 | |
| 352 | def _environ_cols_wrapper(): # pragma: no cover |
nothing calls this directly
no outgoing calls
no test coverage detected