@staticmethod
    def width(fallback=79):

        width = fallback

        # Determine current terminal width, if possible.
        if sys.stdout.isatty():
            try:
                # Use terminal control codes if possible.
                import fcntl, termios, struct
                width = struct.unpack(b'hh', fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234'))[1] - 1

            except:
                # Fall back on environment variables.
                try:
                    width = int(os.environ['COLUMNS']) - 1
                except:
                    # TODO: Fall back on curses, then ANSI.
                    pass

        return width
Return the width of the current terminal, or the fallback value.
dataset/ETHPy150Open marrow/script/marrow/script/core.py/Parser.width