<commit_before>#!/usr/bin/env python
# encoding: utf-8
"""IMPORTANT - COLOUR SUPPORT IS CURRENTLY EXTREMELY EXPERIMENTAL.  THE API MAY CHANGE, AND NO DEFAULT
WIDGETS CURRENTLY TAKE ADVANTAGE OF THEME SUPPORT AT ALL."""
import curses
import widget
import GlobalOptions

def disableColor():
	GlobalOptions.DISABLE_ALL_COLORS = True

def enableColor():
	GlobalOptions.DISABLE_ALL_COLORS = False

class ThemeManager(object):
    _colors_to_define = ( 
     ('BLACK_WHITE',      curses.COLOR_BLACK,      curses.COLOR_WHITE),
     ('BLUE_BLACK',       curses.COLOR_BLUE,       curses.COLOR_BLACK),
     ('CYAN_BLACK',       curses.COLOR_CYAN,       curses.COLOR_BLACK),
     ('GREEN_BLACK',      curses.COLOR_GREEN,      curses.COLOR_BLACK),
     ('MAGENTA_BLACK',    curses.COLOR_MAGENTA,    curses.COLOR_BLACK),
     ('RED_BLACK',        curses.COLOR_RED,        curses.COLOR_BLACK),
     ('YELLOW_BLACK',     curses.COLOR_YELLOW,     curses.COLOR_BLACK),
    )
    
    default_colors = {
        'DEFAULT'     : 'WHITE_BLACK',
        'FORMDEFAULT' : 'WHITE_BLACK',
        'NO_EDIT'     : 'BLUE_BLACK',
        'STANDOUT'    : 'CYAN_BLACK',
        'LABEL'       : 'GREEN_BLACK',
        'LABELBOLD'   : 'WHITE_BLACK',
        'CONTROL'     : 'YELLOW_BLACK',
    }
    def __init__(self):
        self._max_pairs = curses.COLOR_PAIRS - 1
        self._defined_pairs = {}
        self._names         = {}
        self.initialize_pairs()
        self.initialize_names()
        
    def findPair(self, caller, request='DEFAULT'):
        if not curses.has_colors() or GlobalOptions.DISABLE_ALL_COLORS:
            return False
<commit_msg>Fixed bug that stopped npyscreen working on BW terminals.<commit_after>#!/usr/bin/env python
# encoding: utf-8
"""IMPORTANT - COLOUR SUPPORT IS CURRENTLY EXTREMELY EXPERIMENTAL.  THE API MAY CHANGE, AND NO DEFAULT
WIDGETS CURRENTLY TAKE ADVANTAGE OF THEME SUPPORT AT ALL."""
import curses
import widget
import GlobalOptions

def disableColor():
	GlobalOptions.DISABLE_ALL_COLORS = True

def enableColor():
	GlobalOptions.DISABLE_ALL_COLORS = False

class ThemeManager(object):
    _colors_to_define = ( 
     ('BLACK_WHITE',      curses.COLOR_BLACK,      curses.COLOR_WHITE),
     ('BLUE_BLACK',       curses.COLOR_BLUE,       curses.COLOR_BLACK),
     ('CYAN_BLACK',       curses.COLOR_CYAN,       curses.COLOR_BLACK),
     ('GREEN_BLACK',      curses.COLOR_GREEN,      curses.COLOR_BLACK),
     ('MAGENTA_BLACK',    curses.COLOR_MAGENTA,    curses.COLOR_BLACK),
     ('RED_BLACK',        curses.COLOR_RED,        curses.COLOR_BLACK),
     ('YELLOW_BLACK',     curses.COLOR_YELLOW,     curses.COLOR_BLACK),
    )
    
    default_colors = {
        'DEFAULT'     : 'WHITE_BLACK',
        'FORMDEFAULT' : 'WHITE_BLACK',
        'NO_EDIT'     : 'BLUE_BLACK',
        'STANDOUT'    : 'CYAN_BLACK',
        'LABEL'       : 'GREEN_BLACK',
        'LABELBOLD'   : 'WHITE_BLACK',
        'CONTROL'     : 'YELLOW_BLACK',
    }
    def __init__(self):
        self._max_pairs = curses.COLOR_PAIRS - 1
        self._defined_pairs = {}
        self._names         = {}
        if curses.has_colors():
            self.initialize_pairs()
            self.initialize_names()
        
    def findPair(self, caller, request='DEFAULT'):
        if not curses.has_colors() or GlobalOptions.DISABLE_ALL_COLORS:
            return False

{'fraction_non_alphanumeric': 0.10816448152562574, 'fraction_numerical': 0.0011918951132300357, 'mean_word_length': 2.582710779082177, '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': '1650178', 'n_tokens_mistral': 1169, 'n_tokens_neox': 1144, 'n_words': 210}