Exemplo n.º 1
0
 def _evaluate(self, machine, item):
     if callable(item):
         return item(machine)
     else:
         guard = getattr(machine, item)
         if callable(guard):
             guard = guard()
         return guard
Exemplo n.º 2
0
 def _evaluate(self, machine, item):
     if callable(item):
         return item(machine)
     else:
         guard = getattr(machine, item)
         if callable(guard):
             guard = guard()
         return guard
Exemplo n.º 3
0
 def __init__(self):
     self._bring_definitions_to_object_level()
     self._inject_into_parts()
     self._validate_machine_definitions()
     if callable(self.initial_state):
         self.initial_state = self.initial_state()
     self._current_state_object = self._state_by_name(self.initial_state)
     self._current_state_object.run_enter(self)
     self._create_state_getters()
Exemplo n.º 4
0
 def __init__(self):
     self._bring_definitions_to_object_level()
     self._inject_into_parts()
     self._validate_machine_definitions()
     if callable(self.initial_state):
         self.initial_state = self.initial_state()
     self._current_state_object = self._state_by_name(self.initial_state)
     self._current_state_object.run_enter(self)
     self._create_state_getters()
Exemplo n.º 5
0
 def __init__(self):
     if callable(self.initial_state):
         self.initial_state = self.initial_state()
     self.set_initial_state(self.initial_state)
Exemplo n.º 6
0
 def _run_action(self, action, *args, **kwargs):
     if callable(action):
         self._try_to_run_with_args(action, self.machine, *args, **kwargs)
     else:
         self._try_to_run_with_args(getattr(self.machine, action), *args, **kwargs)
Exemplo n.º 7
0
 def _run_action(self, action, *args, **kwargs):
     if callable(action):
         self._try_to_run_with_args(action, self.machine, *args, **kwargs)
     else:
         self._try_to_run_with_args(getattr(self.machine, action), *args,
                                    **kwargs)