def _pty_size():
 from fabric.state import win32
 if (not win32):
  import fcntl
  import termios
  import struct
 (default_rows, default_cols) = (24, 80)
 (rows, cols) = (default_rows, default_cols)
 if ((not win32) and isatty(sys.stdout)):
  fmt = 'HH'
  buffer = struct.pack(fmt, 0, 0)
  try:
   result = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, buffer)
   (rows, cols) = struct.unpack(fmt, result)
   if (rows == 0):
    rows = default_rows
   if (cols == 0):
    cols = default_cols
  except AttributeError:
   pass
 return (rows, cols)

def _pty_size ( ) : from fabric . state import win32 if ( not win32 ) : import fcntl import termios import struct ( default_rows , default_cols ) = ( 24 , 80 ) ( rows , cols ) = ( default_rows , default_cols ) if ( ( not win32 ) and isatty ( sys . stdout ) ) : fmt = 'HH' buffer = struct . pack ( fmt , 0 , 0 ) try : result = fcntl . ioctl ( sys . stdout . fileno ( ) , termios . TIOCGWINSZ , buffer ) ( rows , cols ) = struct . unpack ( fmt , result ) if ( rows == 0 ) : rows = default_rows if ( cols == 0 ) : cols = default_cols except AttributeError : pass return ( rows , cols )
obtain tuple for sizing a pty on the remote end .