# Path: fabulous/utils.py
# def memoize(function):
#     def _memoize(*args):
#     def __init__(self, bgcolor='black'):
#     def termfd(self):
#     def dimensions(self):
#     def width(self):
#     def height(self):
#     def _get_bgcolor(self):
#     def _set_bgcolor(self, color):
# def pil_check():
# class TerminalInfo(object):


import sys
import logging
from fabulous import utils

    Logging transiently means that verbose logging messages like DEBUG
    will only appear on the last line of your terminal for a short
    period of time and important messages like WARNING will scroll
    like normal text.

    This allows you to log lots of messages without the important
    stuff getting drowned out.

    This module integrates with the standard Python logging module.
    """

    def __init__(self, strm=sys.stderr, level=logging.WARNING):
        logging.StreamHandler.__init__(self, strm)
        if isinstance(level, int):
            self.levelno = level
        else:
            self.levelno = logging._levelNames[level]
        self.need_cr = False
        self.last = ""
        self.parent = logging.StreamHandler

    def close(self):
        if self.need_cr:
            self.stream.write("\n")
            self.need_cr = False
        self.parent.close(self)

    def write(self, data):
        if self.need_cr:

# Path: fabulous/utils.py
# def memoize(function):
#     def _memoize(*args):
#     def __init__(self, bgcolor='black'):
#     def termfd(self):
#     def dimensions(self):
#     def width(self):
#     def height(self):
#     def _get_bgcolor(self):
#     def _set_bgcolor(self, color):
# def pil_check():
# class TerminalInfo(object):


# Path: fabulous/logs.py
import sys
import logging
from fabulous import utils


    Logging transiently means that verbose logging messages like DEBUG
    will only appear on the last line of your terminal for a short
    period of time and important messages like WARNING will scroll
    like normal text.

    This allows you to log lots of messages without the important
    stuff getting drowned out.

    This module integrates with the standard Python logging module.
    """

    def __init__(self, strm=sys.stderr, level=logging.WARNING):
        logging.StreamHandler.__init__(self, strm)
        if isinstance(level, int):
            self.levelno = level
        else:
            self.levelno = logging._levelNames[level]
        self.need_cr = False
        self.last = ""
        self.parent = logging.StreamHandler

    def close(self):
        if self.need_cr:
            self.stream.write("\n")
            self.need_cr = False
        self.parent.close(self)

    def write(self, data):
        if self.need_cr:

            width = max(min(utils.term.width, len(self.last)), len(data))