<commit_before>from lib.config.modules import modules
from lib.config.roles import roles


class Module:
    name = None
    configurations = None
    roles_needed = None

    def __init__(self, module_string):
        if module_string in modules:
            self.name = module_string
            self.configurations = modules[module_string]

    def is_offensive(self):
        return self.configurations['character'] == 1

    def is_balanced(self):
        return self.configurations['character'] == 2

    def is_defensive(self):
        return self.configurations['character'] == 4

    def get_roles_needed(self):
        if self.roles_needed is None:
            self.roles_needed = {}
            i = 0
            for role in roles:
                print(role['name'], self.configurations['roles'][i])
                self.roles_needed[role['name']] = self.configurations['roles'][i]
                i += 1
        return self.roles_needed<commit_msg>first applicability check<commit_after>from lib.config.modules import modules
from lib.config.roles import roles


class Module:
    name = None
    configurations = None
    roles_needed = None

    def __init__(self, module_string):
        if module_string in modules:
            self.name = module_string
            self.configurations = modules[module_string]

    def is_offensive(self):
        return self.configurations['character'] == 1

    def is_balanced(self):
        return self.configurations['character'] == 2

    def is_defensive(self):
        return self.configurations['character'] == 4

    def get_roles_needed(self):
        if self.roles_needed is None:
            self.roles_needed = {}
            i = 0
            for role in roles:
                print(role['name'], self.configurations['roles'][i])
                self.roles_needed[role['name']] = self.configurations['roles'][i]
                i += 1
        return self.roles_needed

    def is_applicable_to_team(self, team):
        self.is_applicable_to_list(team.get_players_per_role())

    def is_applicable_to_list(self, player_list):
        needed = self.get_roles_needed()
        for role in self.get_roles_needed():
            if role not in player_list or needed[role] <player_list[role]:
                return False
        return True

{'fraction_non_alphanumeric': 0.09461805555555555, 'fraction_numerical': 0.004340277777777778, 'mean_word_length': 2.419881305637982, 'pattern_counts': {'":': 0, '<': 4, '<?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': '2930643', 'n_tokens_mistral': 687, 'n_tokens_neox': 640, 'n_words': 152}