<commit_before>import re


class AttrDict(object):
    "A case-insensitive attribute accessible dict-like object"
    def __init__(self, name, *args, **kwargs):
        for key, value in dict(*args, **kwargs).iteritems():
            if not isinstance(key, basestring) or not key:
                raise TypeError('attribute names must be non-empty strings')
            if key[0].isdigit():
                raise ValueError('attribute names cannot begin with a number')
            _key = re.sub(r'[^\w\d_]+', ' ', re.sub(r'[\s-]+', '_', key.upper()))
            self.__dict__[_key] = value

    def __repr__(self):
        return u'<AttrDict: %s>' % self.name

    def __getattr__(self, key):
        _key = key.upper()
        if _key not in self.__dict__:
            raise AttributeError("AttrDict object has not attribute '{0}'".format(key))
        return self.__dict__[_key]

    def __contains__(self, key):
        return self.__dict__.__contains__(key.upper())

    def __iter__(self):
        return self.__dict__.__iter__()
<commit_msg>Add missing assignment of name in constructor<commit_after>import re


class AttrDict(object):
    "A case-insensitive attribute accessible dict-like object"
    def __init__(self, name, *args, **kwargs):
        self.name = name

        for key, value in dict(*args, **kwargs).iteritems():
            if not isinstance(key, basestring) or not key:
                raise TypeError('attribute names must be non-empty strings')
            if key[0].isdigit():
                raise ValueError('attribute names cannot begin with a number')
            _key = re.sub(r'[^\w\d_]+', ' ', re.sub(r'[\s-]+', '_', key.upper()))
            self.__dict__[_key] = value

    def __repr__(self):
        return u'<AttrDict: %s>' % self.name

    def __getattr__(self, key):
        _key = key.upper()
        if _key not in self.__dict__:
            raise AttributeError("AttrDict object has not attribute '{0}'".format(key))
        return self.__dict__[_key]

    def __contains__(self, key):
        return self.__dict__.__contains__(key.upper())

    def __iter__(self):
        return self.__dict__.__iter__()

{'fraction_non_alphanumeric': 0.12987012987012986, 'fraction_numerical': 0.0018552875695732839, 'mean_word_length': 2.5594059405940595, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6237199', 'n_tokens_mistral': 633, 'n_tokens_neox': 619, 'n_words': 180}