third_party/blink/tools/blinkpy/common/system/platform_info.py
def terminal_width(self):
        """Returns sys.maxint if the width cannot be determined."""
        try:
            if self.is_win():
                # From http://code.activestate.com/recipes/440694-determine-size-of-console-window-on-windows/
                from ctypes import windll, create_string_buffer
                handle = windll.kernel32.GetStdHandle(-12)  # -12 == stderr
                # 22 == sizeof(console_screen_buffer_info)
                console_screen_buffer_info = create_string_buffer(22)
                if windll.kernel32.GetConsoleScreenBufferInfo(
                        handle, console_screen_buffer_info):
                    import struct
                    _, _, _, _, _, left, _, right, _, _, _ = struct.unpack(
                        'hhhhHhhhhhh', console_screen_buffer_info.raw)
                    # Note that we return 1 less than the width since writing into the rightmost column
                    # automatically performs a line feed.
                    return right - left
                return sys.maxsize
            else:
                import fcntl
                import struct
                import termios
                packed = fcntl.ioctl(sys.stderr.fileno(), termios.TIOCGWINSZ,
                                     '\0' * 8)
                _, columns, _, _ = struct.unpack('HHHH', packed)
                return columns
        except Exception:  # pylint: disable=broad-except
            return sys.maxsize
Returns sys.maxint if the width cannot be determined.
Returns sys.maxint if the width cannot be determined.
Returns sys . maxint if the width cannot be determined .
def terminal_width(self):
        try:
            if self.is_win():
                from ctypes import windll, create_string_buffer
                handle = windll.kernel32.GetStdHandle(-12)  
                console_screen_buffer_info = create_string_buffer(22)
                if windll.kernel32.GetConsoleScreenBufferInfo(
                        handle, console_screen_buffer_info):
                    import struct
                    _, _, _, _, _, left, _, right, _, _, _ = struct.unpack(
                        'hhhhHhhhhhh', console_screen_buffer_info.raw)
                    return right - left
                return sys.maxsize
            else:
                import fcntl
                import struct
                import termios
                packed = fcntl.ioctl(sys.stderr.fileno(), termios.TIOCGWINSZ,
                                     '\0' * 8)
                _, columns, _, _ = struct.unpack('HHHH', packed)
                return columns
        except Exception:  
            return sys.maxsize
def terminal_width ( self ) : try : if self . is_win ( ) : from ctypes import windll , create_string_buffer handle = windll . kernel32 . GetStdHandle ( - 12 ) console_screen_buffer_info = create_string_buffer ( 22 ) if windll . kernel32 . GetConsoleScreenBufferInfo ( handle , console_screen_buffer_info ) : import struct _ , _ , _ , _ , _ , left , _ , right , _ , _ , _ = struct . unpack ( 'hhhhHhhhhhh' , console_screen_buffer_info . raw ) return right - left return sys . maxsize else : import fcntl import struct import termios packed = fcntl . ioctl ( sys . stderr . fileno ( ) , termios . TIOCGWINSZ , '\0' * 8 ) _ , columns , _ , _ = struct . unpack ( 'HHHH' , packed ) return columns except Exception : return sys . maxsize
Returns sys.maxint if the width cannot be determined.
Returns sys . maxint if the width cannot be determined .
"""Returns sys.maxint if the width cannot be determined.""" # From http://code.activestate.com/recipes/440694-determine-size-of-console-window-on-windows/ # -12 == stderr # 22 == sizeof(console_screen_buffer_info) # Note that we return 1 less than the width since writing into the rightmost column # automatically performs a line feed. # pylint: disable=broad-except
self