Show the number of translation missing with colorization
498276
def translation_missing_icon(translation)
      missing_translations = translation.missing_translations
      color_id = (missing_translations.size.to_f/translation.translations.size.to_f*5).ceil-1
      if missing_translations.size == 0
        content_tag 'span', '', :class => 'glyphicon glyphicon-ok greentext',
                    :title => 'This key has been translated in all languages', :rel => 'tooltip'
      else
        content_tag 'span', "(#{missing_translations.size})", :class => "color-range-#{color_id} bold",
                    :title => missing_translations.keys.join(','), :rel => 'tooltip'
      end
    end
1100358
def count_missing(self, axis=None):
        
        b = self.is_missing()
        return np.sum(b, axis=axis)
526362
def translate(usercodes, rgb_mode=False):
    
    for code in usercodes:
        code = code.strip().lower()
        if code.isalpha() and (code in codes['fore']):
            # Basic color name.
            yield translate_basic(code)
        else:
            if ',' in code:
                try:
                    r, g, b = (int(c.strip()) for c in code.split(','))
                except (TypeError, ValueError):
                    raise InvalidColr(code)
                code = (r, g, b)

            colorcode = ColorCode(code, rgb_mode=rgb_mode)

            if disabled():
                yield str(colorcode)
            yield colorcode.example()
1153376
def compute_group_colors(self):
        """"""
        seen = set()
        self.group_label_color = [
            x for x in self.node_colors if not (x in seen or seen.add(x))
        ]
694022
function colorErrors(stdLine) {
  // lazy load chalk
  if (chalk === undefined) {
    chalk = require("chalk");
  }

  return colorErrorPatterns.reduce((op, pattern) => {
    const matches = pattern.exec(op);

    if (matches !== null && matches.length > 0) {
      op = op.replace(pattern, chalk.red(matches[0]));
    }

    return op;
  }, stdLine);
}
935959
def _token_counts_from_generator(generator, max_chars, reserved_tokens):
  """"""
  reserved_tokens = list(reserved_tokens) + [_UNDERSCORE_REPLACEMENT]
  tokenizer = text_encoder.Tokenizer(
      alphanum_only=False, reserved_tokens=reserved_tokens)
  num_chars = 0
  token_counts = collections.defaultdict(int)
  for s in generator:
    s = tf.compat.as_text(s)
    if max_chars and (num_chars + len(s)) >= max_chars:
      s = s[:(max_chars - num_chars)]
    tokens = tokenizer.tokenize(s)
    tokens = _prepare_tokens_for_encode(tokens)
    for t in tokens:
      token_counts[t] += 1
    if max_chars:
      num_chars += len(s)
      if num_chars > max_chars:
        break
  return token_counts
1367004
def maybe_colored(msg, color, opt):
    """"""
    if opt.monochrome:
        return msg

    return colored(msg, color)
394459
function Colorizer() {
    "use strict";
    /*eslint no-multi-spaces:0*/
    var options    = { bold: 1, underscore: 4, blink: 5, reverse: 7, conceal: 8 };
    var foreground = { black: 30, red: 31, green: 32, yellow: 33, blue: 34, magenta: 35, cyan: 36, white: 37 };
    var background = { black: 40, red: 41, green: 42, yellow: 43, blue: 44, magenta: 45, cyan: 46, white: 47 };
    var styles     = {
        'ERROR':     { bg: 'red', fg: 'white', bold: true },
        'INFO':      { fg: 'green', bold: true },
        'TRACE':     { fg: 'green', bold: true },
        'PARAMETER': { fg: 'cyan' },
        'COMMENT':   { fg: 'yellow' },
        'WARNING':   { fg: 'red', bold: true },
        'GREEN_BAR': { fg: 'white', bg: 'green', bold: true },
        'RED_BAR':   { fg: 'white', bg: 'red', bold: true },
        'INFO_BAR':  { bg: 'cyan', fg: 'white', bold: true },
        'WARN_BAR':  { bg: 'yellow', fg: 'white', bold: true },
        'SKIP':      { fg: 'magenta', bold: true },
        'SKIP_BAR':  { bg: 'magenta', fg: 'white', bold: true }
    };

    /**
     * Adds a style to provided text.
     *
     * @param   String  text
     * @param   String  styleName
     * @return  String
     */
    this.colorize = function colorize(text, styleName, pad) {
        if ((fs.isWindows() && (!env['ANSICON'] && env['ConEmuANSI'] !== 'ON')) || !(styleName in styles)) {
            return text;
        }
        return this.format(text, styles[styleName], pad);
    };

    /**
     * Formats a text using a style declaration object.
     *
     * @param  String  text
     * @param  Object  style
     * @return String
     */
    this.format = function format(text, style, pad) {
        if ((fs.isWindows() && (!env['ANSICON'] && env['ConEmuANSI'] !== 'ON')) || !utils.isObject(style)) {
            return text;
        }
        var codes = [];
        if (style.fg && foreground[style.fg]) {
            codes.push(foreground[style.fg]);
        }
        if (style.bg && background[style.bg]) {
            codes.push(background[style.bg]);
        }
        for (var option in options) {
            if (option in style && style[option] === true) {
                codes.push(options[option]);
            }
        }
        // pad
        if (typeof pad === "number" && text.length < pad) {
            text += new Array(pad - text.length + 1).join(' ');
        }
        return "\u001b[" + codes.join(';') + 'm' + text + "\u001b[0m";
    };
}
1361875
def _get_colored_output(self, script):
        
        return bitcoin.core.CTxOut(self._dust_amount, bitcoin.core.CScript(script))
1143630
def _get_global_color_table(colors):
    
    global_color_table = b''.join(c[0] for c in colors.most_common())
    full_table_size = 2**(1+int(get_color_table_size(len(colors)), 2))
    repeats = 3 * (full_table_size - len(colors))
    zeros = struct.pack('<{}x'.format(repeats))
    return global_color_table + zeros
1099088
def help(cls):
        """"""
        print("for named colors use :")
        for c in sorted(list(cls.colors.items())):
            print("{:10} {}".format(*c))
79905
@Override
    public int countMissing() {
        int count = 0;
        for (int i = 0; i < size(); i++) {
            if (TextColumnType.missingValueIndicator().equals(get(i))) {
                count++;
            }
        }
        return count;
    }
92482
def missing(self, *args, **kwds):
        """"""
        from functools import reduce

        indexer = kwds['indexer']
        freq = kwds['freq'] or generic.default_freq(**indexer)

        miss = (checks.missing_any(generic.select_time(da, **indexer), freq) for da in args)
        return reduce(np.logical_or, miss)
864275
def highlight_differences(s1, s2, color):
    """"""
    ls1, ls2 = len(s1), len(s2)

    diff_indices = [i for i, (a, b) in enumerate(zip(s1, s2)) if a != b]

    print(s1)

    if ls2 > ls1:
        colorise.cprint('_' * (ls2-ls1), fg=color)
    else:
        print()

    colorise.highlight(s2, indices=diff_indices, fg=color, end='')

    if ls1 > ls2:
        colorise.cprint('_' * (ls1-ls2), fg=color)
    else:
        print()
1068260
def gray2int(graystr):
    """"""
    num = bin2int(graystr)
    num ^= (num >> 8)
    num ^= (num >> 4)
    num ^= (num >> 2)
    num ^= (num >> 1)
    return num
982978
def demonstrate_colored_logging():
    """"""
    # Determine the available logging levels and order them by numeric value.
    decorated_levels = []
    defined_levels = coloredlogs.find_defined_levels()
    normalizer = coloredlogs.NameNormalizer()
    for name, level in defined_levels.items():
        if name != 'NOTSET':
            item = (level, normalizer.normalize_name(name))
            if item not in decorated_levels:
                decorated_levels.append(item)
    ordered_levels = sorted(decorated_levels)
    # Initialize colored output to the terminal, default to the most
    # verbose logging level but enable the user the customize it.
    coloredlogs.install(level=os.environ.get('COLOREDLOGS_LOG_LEVEL', ordered_levels[0][1]))
    # Print some examples with different timestamps.
    for level, name in ordered_levels:
        log_method = getattr(logger, name, None)
        if log_method:
            log_method("message with level %s (%i)", name, level)
            time.sleep(DEMO_DELAY)
1113808
def color_check(color):
    
    if isinstance(color, (tuple, list)):
        if all(map(lambda x: isinstance(x, int), color)):
            if all(map(lambda x: x < 256, color)):
                return list(color)
    if isinstance(color, str):
        color_lower = color.lower()
        if color_lower in TABLE_COLOR.keys():
            return TABLE_COLOR[color_lower]
    return [0, 0, 0]