<commit_before>import yaml


def from_config(config):
    config = dict(config)  # shallow copy
    return config.pop('class').from_config(config)


def from_yaml(yaml_string):
    config = yaml.load(yaml_string)
    return from_config(config)


class ConfigObject:
    def get_config(self):
        return dict(class_name=self.__class__.__name__)

    @classmethod
    def from_config(cls, config):
        # TODO pop class?
        return cls(**config)

    def to_yaml(self, *args, **kwargs):
        config = self.get_config()
        return yaml.dump(config, *args, **kwargs)<commit_msg>Fix ConfigObject to use class instead of class_name. Pass infinite width when dumping to yaml.<commit_after>import yaml


def from_config(config):
    config = dict(config)  # shallow copy
    return config.pop('class').from_config(config)


def from_yaml(yaml_string):
    config = yaml.load(yaml_string)
    return from_config(config)


class ConfigObject:
    def get_config(self):
        return {'class': self.__class__}

    @classmethod
    def from_config(cls, config):
        # TODO pop class?
        return cls(**config)

    def to_yaml(self, *args, width=float('inf'), **kwargs):
        config = self.get_config()
        return yaml.dump(config, *args, width=width, **kwargs)
{'fraction_non_alphanumeric': 0.11301636788776305, 'fraction_numerical': 0.0, 'mean_word_length': 3.5052631578947366, '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': '7342771', 'n_tokens_mistral': 402, 'n_tokens_neox': 382, 'n_words': 98}