How to use the snoop.formatting.ForceWhiteTerminal256Formatter function in snoop

To help you get started, we’ve selected a few snoop examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexmojaki / snoop / snoop / formatting.py View on Github external
return result


class NeutralMonokaiStyle(MonokaiStyle):
    """
    Monokai style that is somewhat readable on both dark and light backgrounds
    by replacing 'white' styles with no style so that the terminal can automatically
    use the appropriate foreground color.
    """
    styles = {
        k: '' if v == '#f8f8f2' else v
        for k, v in MonokaiStyle.styles.items()
    }


formatters = ArgDefaultDict(lambda style: ForceWhiteTerminal256Formatter(style=style))


def raw_highlight(code, style):
    return highlight(code, lexer, formatters[style])


cached_highlight = lru_cache(maxsize=1024)(raw_highlight)


class Event(object):
    def __init__(self, frame_info, event, arg, depth, line_no=None):
        self.frame_info = frame_info
        self.frame = frame = frame_info.frame
        self.source = frame_info.source
        self.last_line_no = frame_info.last_line_no
        self.comprehension_type = frame_info.comprehension_type
github alexmojaki / snoop / snoop / formatting.py View on Github external
return result


class NeutralMonokaiStyle(MonokaiStyle):
    """
    Monokai style that is somewhat readable on both dark and light backgrounds
    by replacing 'white' styles with no style so that the terminal can automatically
    use the appropriate foreground color.
    """
    styles = {
        k: '' if v == '#f8f8f2' else v
        for k, v in MonokaiStyle.styles.items()
    }


formatters = ArgDefaultDict(lambda style: ForceWhiteTerminal256Formatter(style=style))


def raw_highlight(code, style):
    return highlight(code, lexer, formatters[style])


cached_highlight = lru_cache(maxsize=1024)(raw_highlight)


class Event(object):
    def __init__(self, frame_info, event, arg, depth, line_no=None):
        self.frame_info = frame_info
        self.frame = frame = frame_info.frame
        self.source = frame_info.source
        self.last_line_no = frame_info.last_line_no
        self.comprehension_type = frame_info.comprehension_type
github alexmojaki / snoop / snoop / formatting.py View on Github external
def _closest_color(self, r, g, b):
        result = super(ForceWhiteTerminal256Formatter, self)._closest_color(r, g, b)
        if result == 15:
            result += 6 ** 3
        return result
github alexmojaki / snoop / snoop / formatting.py View on Github external
def _closest_color(self, r, g, b):
        result = super(ForceWhiteTerminal256Formatter, self)._closest_color(r, g, b)
        if result == 15:
            result += 6 ** 3
        return result