def get_transition(cls, source_state, target_state): cls.check_transition(source_state, target_state) for trans in cls.transitions: for source in trans.source: if source.name == source_state and trans.target.name == target_state: return trans.name raise ForbiddenTransition()
def __check_transition_between_states_exist(cls, source_state, target_state): for trans in cls.transitions: for source in trans.source: if source.name == source_state and trans.target.name == target_state: return raise ForbiddenTransition()
def __check_state_exists(cls, state): if state not in cls.states: raise ForbiddenTransition()