<commit_before>"""
Sets up the terminal color scheme.
"""

from django.utils import termcolors
import sys

def color_style():
    "Returns a Style object with the Django color scheme."
    if sys.platform == 'win32' or sys.platform == 'Pocket PC' or sys.platform.startswith('java') or not sys.stdout.isatty():
        return no_style()
    class dummy: pass
    style = dummy()
    style.ERROR = termcolors.make_style(fg='red', opts=('bold',))
    style.ERROR_OUTPUT = termcolors.make_style(fg='red', opts=('bold',))
    style.NOTICE = termcolors.make_style(fg='red')
    style.SQL_FIELD = termcolors.make_style(fg='green', opts=('bold',))
    style.SQL_COLTYPE = termcolors.make_style(fg='green')
    style.SQL_KEYWORD = termcolors.make_style(fg='yellow')
    style.SQL_TABLE = termcolors.make_style(opts=('bold',))
    return style

def no_style():
    "Returns a Style object that has no colors."
    class dummy:
        def __getattr__(self, attr):
            return lambda x: x
    return dummy()<commit_msg>Some Django coding style fixes.<commit_after>"""
Sets up the terminal color scheme.
"""

import sys

from django.utils import termcolors

def color_style():
    """Returns a Style object with the Django color scheme."""
    if (sys.platform == 'win32' or sys.platform == 'Pocket PC'
        or sys.platform.startswith('java') or not sys.stdout.isatty()):
        return no_style()
    class dummy: pass
    style = dummy()
    style.ERROR = termcolors.make_style(fg='red', opts=('bold',))
    style.ERROR_OUTPUT = termcolors.make_style(fg='red', opts=('bold',))
    style.NOTICE = termcolors.make_style(fg='red')
    style.SQL_FIELD = termcolors.make_style(fg='green', opts=('bold',))
    style.SQL_COLTYPE = termcolors.make_style(fg='green')
    style.SQL_KEYWORD = termcolors.make_style(fg='yellow')
    style.SQL_TABLE = termcolors.make_style(opts=('bold',))
    return style

def no_style():
    """Returns a Style object that has no colors."""
    class dummy:
        def __getattr__(self, attr):
            return lambda x: x
    return dummy()
{'fraction_non_alphanumeric': 0.13884857281083696, 'fraction_numerical': 0.0019351717464925011, 'mean_word_length': 3.7981438515081205, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4530281', 'n_tokens_mistral': 648, 'n_tokens_neox': 639, 'n_words': 169}