Moved MyYamlLexer into logger

now cmdline runs without pygments
master
Alexander Graf 4 years ago
parent ce9a9ec572
commit 9cb6962335

@ -53,7 +53,12 @@ def mapped(cls):
_model2schema[cls.Meta.model] = cls
return cls
class MyYamlLexer(YamlLexer):
class Logger:
""" helps with counting and colorizing
imported and exported data
"""
class MyYamlLexer(YamlLexer):
""" colorize yaml constants and integers """
def get_tokens(self, text, unfiltered=False):
for typ, value in super().get_tokens(text, unfiltered):
@ -76,11 +81,6 @@ class MyYamlLexer(YamlLexer):
typ = Token.Literal.Number.Integer
yield typ, value
class Logger:
""" helps with counting and colorizing
imported and exported data
"""
def __init__(self, want_color=None, can_color=False, debug=False, secrets=False):
self.lexer = 'yaml'
@ -323,7 +323,7 @@ class Logger:
return data
lexer = lexer or self.lexer
lexer = MyYamlLexer() if lexer == 'yaml' else get_lexer_by_name(lexer)
lexer = Logger.MyYamlLexer() if lexer == 'yaml' else get_lexer_by_name(lexer)
formatter = get_formatter_by_name(formatter or self.formatter, colorscheme=self.colorscheme)
if strip is None:
strip = self.strip

Loading…
Cancel
Save