<commit_before>from copy import copy

from preparation.resources.Resource import names_registered, resource_by_name
from hb_res.storage import get_storage


def rebuild_from_resource(resource_name: str):
    resource = resource_by_name(resource_name)()
    out_storage = get_storage(resource_name.replace('Resource', ''))
    out_storage.clear()
    for explanation in resource:
        r = copy(explanation)
        for functor in resource.modifiers:
            if r is None:
                break
            r = functor(r)
        if r is not None:
            out_storage.add_entry(r)
    out_storage.close()


def rebuild_all():
    map(rebuild_from_resource, names_registered())<commit_msg>And some more in build-assets<commit_after>from copy import copy

from preparation.resources.Resource import names_registered, resource_by_name
from hb_res.storage import get_storage


def rebuild_from_resource(resource_name: str):
    resource = resource_by_name(resource_name)()
    out_storage = get_storage(resource_name.replace('Resource', ''))
    out_storage.clear()
    for explanation in resource:
        r = copy(explanation)
        for functor in resource.modifiers:
            if r is None:
                break
            r = functor(r)
        if r is not None:
            out_storage.add_entry(r)
    out_storage.close()


def rebuild_all():
    for name in names_registered():
        rebuild_from_resource(name)
{'fraction_non_alphanumeric': 0.07756813417190776, 'fraction_numerical': 0.0, 'mean_word_length': 3.103151862464183, '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': '226478', 'n_tokens_mistral': 420, 'n_tokens_neox': 399, 'n_words': 104}