<commit_before>from __future__ import print_function
from __future__ import division

from contextlib import contextmanager
from cStringIO import StringIO


class AttrDict(dict):
    __getattr__ = dict.__getitem__
    __setattr__ = dict.__setitem__
    __delattr__ = dict.__delitem__

    def __init__(self, arg=None):
        super(AttrDict, self).__init__()
        if isinstance(arg, dict):
            self.init_from_dict(arg)

    def init_from_dict(self, d):
        for k, v in d.iteritems():
            if isinstance(v, dict):<commit_msg>int keys converted to str in AttrDict initialization<commit_after>from __future__ import print_function
from __future__ import division

from contextlib import contextmanager
from cStringIO import StringIO


class AttrDict(dict):
    __getattr__ = dict.__getitem__
    __setattr__ = dict.__setitem__
    __delattr__ = dict.__delitem__

    def __init__(self, arg=None):
        super(AttrDict, self).__init__()
        if isinstance(arg, dict):
            self.init_from_dict(arg)

    def init_from_dict(self, d):
        for k, v in d.iteritems():
            if isinstance(k, int):
                k = str(k)  # Keys must be strings, not ints
            if isinstance(v, dict):
{'fraction_non_alphanumeric': 0.07729861676159479, 'fraction_numerical': 0.0, 'mean_word_length': 3.1, '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': '1952507', 'n_tokens_mistral': 373, 'n_tokens_neox': 364, 'n_words': 105}