<commit_before>from functools import wraps


def cached_property(f):
    name = f.__name__
    @property
    @wraps(f)
    def inner(self):
        if not hasattr(self, "_property_cache"):
            self._property_cache = {}
        if name not in self._property_cache:
            self._property_cache[name] = f(self)
        return self._property_cache[name]
    return inner


class Constant():
    def __init__(self, x):
        self.x = x

    def __repr__(self):
        return self.x<commit_msg>Make it easier to define constants<commit_after>from functools import wraps


def cached_property(f):
    name = f.__name__
    @property
    @wraps(f)
    def inner(self):
        if not hasattr(self, "_property_cache"):
            self._property_cache = {}
        if name not in self._property_cache:
            self._property_cache[name] = f(self)
        return self._property_cache[name]
    return inner


class Constant():
    def __init__(self, x):
        self.x = x

    def __repr__(self):
        return self.x


def constants(namespace, names):
    for name in names:
        namespace[name] = Constant(name)
{'fraction_non_alphanumeric': 0.09574468085106383, 'fraction_numerical': 0.0, 'mean_word_length': 2.484567901234568, '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': '3557100', 'n_tokens_mistral': 346, 'n_tokens_neox': 340, 'n_words': 91}