<commit_before>from flow.configuration.inject.settings import InjectedSettings

import injector


INJECTOR = injector.Injector()


def initialize_injector(settings, command_class):
    add_modules(INJECTOR, InjectedSettings(settings),
            *command_class.injector_modules)

    return INJECTOR

def add_modules(inj, *modules):
    for module in modules:
        if isinstance(module, type):
            module = module()

        module(inj.binder)

def reset_injector():
    global INJECTOR
    INJECTOR = injector.Injector()<commit_msg>make command_class optional for initialize_injector<commit_after>from flow.configuration.inject.settings import InjectedSettings

import injector


INJECTOR = injector.Injector()


def initialize_injector(settings, command_class=None):
    if command_class:
        args = command_class.injector_modules
    else:
        args = []

    add_modules(INJECTOR, InjectedSettings(settings), *args)

    return INJECTOR

def add_modules(inj, *modules):
    for module in modules:
        if isinstance(module, type):
            module = module()

        module(inj.binder)

def reset_injector():
    global INJECTOR
    INJECTOR = injector.Injector()
{'fraction_non_alphanumeric': 0.08137583892617449, 'fraction_numerical': 0.0, 'mean_word_length': 3.7154150197628457, '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': '2874820', 'n_tokens_mistral': 356, 'n_tokens_neox': 342, 'n_words': 79}