<commit_before>class dict2(dict):
    def __setattr__(self, name, value):
        self[name] = value

    def __getattr__(self, name):
        return self.setdefault(name, dict2())<commit_msg>Adding conversion functions for dict2.<commit_after>class dict2(dict):
    def __setattr__(self, name, value):
        self[name] = value

    def __getattr__(self, name):
        return self.setdefault(name, dict2())

    @classmethod
    def from_dict(cls, val):
        if isinstance(val, dict):
            res = cls()
            for k, v in val.items():
                res[k] = cls.from_dict(v)
            return res
        elif isinstance(val, list):
            res = []
            for item in val:
                res.append(cls.from_dict(item))
            return res
        else:
            return val

    def to_dict(self, val=None):
        val = val or self
        if isinstance(val, dict2):
            res = dict()
            for k, v in val.items():
                res[k] = self.to_dict(v)
            return res
        elif isinstance(val, list):
            res = []
            for item in val:
                res.append(self.to_dict(item))
            return res
        else:
            return val

    def __repr__(self):
        return 'dict2(%s)' % super(dict2, self).__repr__()
{'fraction_non_alphanumeric': 0.10779816513761468, 'fraction_numerical': 0.0061162079510703364, 'mean_word_length': 1.6551724137931034, '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': '6387632', 'n_tokens_mistral': 386, 'n_tokens_neox': 377, 'n_words': 104}