MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _screen_shape_linux

Function _screen_shape_linux

pager_lib/tqdm/utils.py:333–349  ·  view source on GitHub ↗
(fp)

Source from the content-addressed store, hash-verified

331
332
333def _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
352def _environ_cols_wrapper(): # pragma: no cover

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected