<commit_before># coding=utf-8
__author__ = '<NAME>'

import string


class EmptyStringFormatter(string.Formatter):
    """
    EmptyStringFormatter - The same as the normal string formatter, except
    this one replaces missing tokens with empty strings.

    Use this just like you would a normal formatter. For example:

    >>> formatter = EmptyStringFormatter()
    >>> formatter.format("... {RED} {YELLOW} ...", RED="red")
    '... red  ...'
    """

    def get_value(self, key, args, kwargs):
        try:
            if hasattr(key, "__mod__"):
                return args[key]
            else:
                return kwargs[key]
        except:
            return ""<commit_msg>Made the empty string formatter only catch KeyError and IndexError.<commit_after># coding=utf-8
__author__ = '<NAME>'

import string


class EmptyStringFormatter(string.Formatter):
    """
    EmptyStringFormatter - The same as the normal string formatter, except
    this one replaces missing tokens with empty strings.

    Use this just like you would a normal formatter. For example:

    >>> formatter = EmptyStringFormatter()
    >>> formatter.format("... {RED} {YELLOW} ...", RED="red")
    '... red  ...'
    """

    def get_value(self, key, args, kwargs):
        try:
            if hasattr(key, "__mod__"):
                return args[key]
            else:
                return kwargs[key]
        except [KeyError, IndexError]:
            return ""
{'fraction_non_alphanumeric': 0.1169993117687543, 'fraction_numerical': 0.0013764624913971094, 'mean_word_length': 2.2970521541950113, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '301609', 'n_tokens_mistral': 410, 'n_tokens_neox': 390, 'n_words': 129}