<commit_before>from synergine.core.exceptions import NotConcernedEvent
from synergine.core.simulation.mechanism.Mechanism import Mechanism


class Event():

    concern = None
    _each_cycle = 1

    def __init__(self, actions):
        self._actions = actions
        self._mechanism = Mechanism

    def get_mechanism_class(self):
        return self._mechanism

    @classmethod
    def get_each_cycle(cls):
        return cls._each_cycle

    def observe(self, object_id, context, parameters={}):
        active_actions = []
        try:
            parameters = self._prepare(object_id, context, parameters)
            for action in self._actions:
                action_object = action(object_id, parameters)
                action_object.prepare(context)
                active_actions.append(action_object)
        except NotConcernedEvent:
            pass  # Object not concerned by this event

        return active_actions

    def _prepare(self, object_id, context, parameters={}):
        raise NotImplementedError()<commit_msg>Event::_prepare return parameters by default<commit_after>from synergine.core.exceptions import NotConcernedEvent
from synergine.core.simulation.mechanism.Mechanism import Mechanism


class Event():

    concern = None
    _each_cycle = 1

    def __init__(self, actions):
        self._actions = actions
        self._mechanism = Mechanism

    def get_mechanism_class(self):
        return self._mechanism

    @classmethod
    def get_each_cycle(cls):
        return cls._each_cycle

    def observe(self, object_id, context, parameters={}):
        active_actions = []
        try:
            parameters = self._prepare(object_id, context, parameters)
            for action in self._actions:
                action_object = action(object_id, parameters)
                action_object.prepare(context)
                active_actions.append(action_object)
        except NotConcernedEvent:
            pass  # Object not concerned by this event

        return active_actions

    def _prepare(self, object_id, context, parameters={}):
        return parameters
{'fraction_non_alphanumeric': 0.07112375533428165, 'fraction_numerical': 0.000948316737790422, 'mean_word_length': 2.631669535283993, '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': '797829', 'n_tokens_mistral': 581, 'n_tokens_neox': 549, 'n_words': 139}