-def _remove_negative_kv(k, v):
- if k.startswith('no-') or k.startswith('no_'):
- return k[3:], not v
- return k,v
-
-def _remove_negative_k(k):
- return _remove_negative_kv(k, None)[0]
-
-
-def _tty_width():
- s = struct.pack("HHHH", 0, 0, 0, 0)
- try:
- import fcntl, termios
- s = fcntl.ioctl(sys.stderr.fileno(), termios.TIOCGWINSZ, s)
- except (IOError, ImportError):
- return _atoi(os.environ.get('WIDTH')) or 70
- (ysize,xsize,ypix,xpix) = struct.unpack('HHHH', s)
- return xsize or 70
+if not fcntl and termios:
+ def _tty_width():
+ return 70
+else:
+ def _tty_width():
+ s = struct.pack("HHHH", 0, 0, 0, 0)
+ try:
+ s = fcntl.ioctl(sys.stderr.fileno(), termios.TIOCGWINSZ, s)
+ except IOError:
+ return 70
+ ysize, xsize, ypix, xpix = struct.unpack('HHHH', s)
+ return xsize or 70