<commit_before>from pprint import saferepr

class row(object):
    def __init__(self, desc, data):
        object.__init__(self)
        self.__data = dict(zip([x[0] for x in desc], data))

    def __getitem__(self, key):
        return self.__data[key]

    def __getattr__(self, key):
        try:
            return self.__data[key]
        except KeyError:
            raise AttributeError

    def __repr__(self):
        return "row(%s)" % saferepr(self.__data)
<commit_msg>Handle integer indices<commit_after>from pprint import saferepr

class row(object):
    def __init__(self, desc, data):
        object.__init__(self)
        self.__rawdata = data
        self.__data = dict(zip([x[0] for x in desc], data))

    def __getitem__(self, key):
        try:
            return self.__data[key]
        except KeyError:
            try:
                return self.__rawdata[key]
            except KeyError:
                raise KeyError, key

    def __getattr__(self, key):
        try:
            return self.__data[key]
        except KeyError:
            raise AttributeError

    def __repr__(self):
        return "row(%s)" % saferepr(self.__data)

{'fraction_non_alphanumeric': 0.09948542024013722, 'fraction_numerical': 0.0017152658662092624, 'mean_word_length': 2.0954907161803713, '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': '5746767', 'n_tokens_mistral': 346, 'n_tokens_neox': 337, 'n_words': 91}