Searches and return the transition model with the given in the given container state model

        :param transition_id: The transition id to be searched
        :return: The model of the transition or None if it is not found
555104
def get_transition_m(self, transition_id):
        
        for transition_m in self.transitions:
            if transition_m.transition.transition_id == transition_id:
                return transition_m
        return None
750768
def transition_allowed(self, initial_state, target_state):
        # type: (str, str) -> bool
        """"""
        assert initial_state in self._allowed, \
            "%s is not in %s" % (initial_state, list(self._allowed))
        return target_state in self._allowed[initial_state]
127535
def get_state_model_class_for_state(state):
    
    from rafcon.gui.models.state import StateModel
    from rafcon.gui.models.container_state import ContainerStateModel
    from rafcon.gui.models.library_state import LibraryStateModel
    if isinstance(state, ContainerState):
        return ContainerStateModel
    elif isinstance(state, LibraryState):
        return LibraryStateModel
    elif isinstance(state, State):
        return StateModel
    else:
        logger.warning("There is not model for state of type {0} {1}".format(type(state), state))
        return None
193141
def get_widget_class_from_id(id):
    

    res = id.split('-')
    try:
        model_cls = apps.get_model(res[1], res[2])
    except:
        model_cls = None
    return model_cls
839470
def get_possible_combos_for_transition(trans, model, self_model, is_external=False):
        
        from_state_combo = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING)
        from_outcome_combo = Gtk.ListStore(GObject.TYPE_STRING)
        to_state_combo = Gtk.ListStore(GObject.TYPE_STRING)
        to_outcome_combo = Gtk.ListStore(GObject.TYPE_STRING)

        trans_dict = model.state.transitions

        # get from state
        if trans is None:
            from_state = None
        elif trans.from_state is not None:
            from_state = model.state.states[trans.from_state]
        else:
            from_state = model.state if is_external else self_model.state

        # collect all free from-outcome-combo and from_state which are still valid -> filter all outcome already in use
        free_from_outcomes_dict = {}
        for state in model.state.states.values():
            from_o_combo = state.outcomes.values()
            # print([o.outcome_id for o in from_o_combo], state_model.state.state_id)
            for transition in trans_dict.values():
                # print(transition, [[o.outcome_id == transition.from_outcome, transition.from_state == state_model.state.state_id] for o in from_o_combo])
                from_o_combo = [o for o in from_o_combo if not (o.outcome_id == transition.from_outcome and
                                                     transition.from_state == state.state_id)]
                # print([o.outcome_id for o in from_o_combo])
            if len(from_o_combo) > 0:
                free_from_outcomes_dict[state.state_id] = from_o_combo
        # check if parent has start_state
        if model.state.start_state_id is None:
            free_from_outcomes_dict[model.state.state_id] = [None]

        # for from-state-combo use all states with free outcomes and from_state
        combined_states = [model.state] if is_external else [self_model.state]
        combined_states.extend(model.state.states.values())
        free_from_states = [state for state in combined_states if state.state_id in free_from_outcomes_dict]

        if trans is None:
            return None, None, None, None, free_from_states, free_from_outcomes_dict

        def append_from_state_combo(possible_state):
            if possible_state.state_id == self_model.state.state_id:
                from_state_combo.append(['self.' + possible_state.state_id, possible_state.state_id])
            elif is_external and from_state.state_id == model.state.state_id:
                from_state_combo.append(['parent.' + possible_state.state_id, possible_state.state_id])
            else:
                from_state_combo.append([possible_state.name + '.' + possible_state.state_id, possible_state.state_id])

        append_from_state_combo(from_state)
        for state in free_from_states:
            if from_state is not state:
                append_from_state_combo(state)

        # for from-outcome-combo collect all combos for actual transition
        # -> actual outcome + free outcomes of actual from_state.state_id
        if trans is not None:
            if trans.from_outcome is None:
                from_outcome_combo.append(["None"])
            else:
                outcome = from_state.outcomes[trans.from_outcome]
                from_outcome_combo.append([outcome.name + "." + str(outcome.outcome_id)])
            for outcome in free_from_outcomes_dict.get(from_state.state_id, []):
                if outcome is None:
                    from_outcome_combo.append(["None"])
                else:
                    from_outcome_combo.append([outcome.name + "." + str(outcome.outcome_id)])

        # get to state
        if trans.to_state == model.state.state_id:
            to_state = model.state if is_external else self_model.state
        else:
            to_state = model.state.states[trans.to_state]

        # for to-state-combo filter from_state -> first actual to_state + other optional states
        def generate_to_state_combo(possible_state):
            if possible_state.state_id == self_model.state.state_id:
                to_state_combo.append(["self." + possible_state.state_id])
            elif is_external and possible_state.state_id == model.state.state_id:
                to_state_combo.append(['parent.' + possible_state.state_id])
            else:
                to_state_combo.append([possible_state.name + '.' + possible_state.state_id])

        to_states = [model.state] if is_external else [self_model.state]
        to_states.extend(model.state.states.values())
        generate_to_state_combo(to_state)
        for state in to_states:
            if not to_state.state_id == state.state_id:
                generate_to_state_combo(state)

        # for to-outcome-combo use parent combos -> first actual outcome + other outcome
        def append_to_outcome_combo(possible_outcome):
            if is_external:
                to_outcome_combo.append(['parent.' + possible_outcome.name + "." + str(possible_outcome.outcome_id)])
            else:
                to_outcome_combo.append(['self.' + possible_outcome.name + "." + str(possible_outcome.outcome_id)])

        if trans.to_outcome is not None:
            append_to_outcome_combo(model.state.outcomes[trans.to_outcome])
        for outcome in model.state.outcomes.values():
            if not (trans.to_outcome == outcome.outcome_id and trans.to_state == model.state.state_id):
                append_to_outcome_combo(outcome)

        return from_state_combo, from_outcome_combo, to_state_combo, to_outcome_combo, free_from_states, free_from_outcomes_dict
209402
def validate_state_transition(self, user, start_state, end_state, **kwargs):
        
        if start_state == end_state:
            raise Return(True)

        transitions = self.state_transitions.get(start_state, [])

        approved_transitions = []
        can_approve = yield self.can_approve(user, **kwargs)
        if can_approve:
            approved_transitions = self.approval_state_transitions.get(start_state, [])

        if end_state not in transitions and end_state not in approved_transitions:
            raise Return(False)

        raise Return(True)
216156
def match_transition(name, from_state)
      find(name).find { |trans| trans.matches?(from_state) }
    end
180458
def is_valid_transition(self, source: str, dest: str) -> bool:
        
        if dest not in self._states or source not in self._states:
            raise NotValidState
        elif dest not in self._transitions[source]:
            raise NotValidTransition
        return True
531746
def _load_transition_models(self):
        
        self.transitions = []
        for transition in self.state.transitions.values():
            self._add_model(self.transitions, transition, TransitionModel)
297048
def _resource(self, resource_id):
        
        resource = self.__model__.query.get(resource_id)
        if not resource:
            raise NotFoundException()
        return resource
416266
public Set<Integer> getTransitions(int state, int inputIdx) { // TODO: replace by primitive specialization
        Set<Integer> transition = transitions[toMemoryIndex(state, inputIdx)];

        return transition == null ? Collections.emptySet() : transition;
    }
696837
def transition_to!(new_state)
      from_state = current
      self.state = new_state
      self.initial_state = new_state if from_state == DEFAULT_STATE
      true
    rescue Exception => e
      catch_error(e) || raise_transition_error(e)
    end
1052792
public function getTransitionStatusIds($transitionName)
    {
        $temp = explode(self::STATUS_SEPARATOR, $transitionName);

        $statuses['from'] = $temp[0];
        $statuses['to'] = $temp[1];

        return $statuses;
    }
1325559
def container_by_id(self, id):
        
        if not id:
            return None
        return next((container for container in self.containers(all=True)
                     if container['Id'] == id), None)
1041864
private function getTransition(TransitionalStateInterface $state, EventInterface $event): TransitionInterface
    {
        return $this->transitionMap[$state->getStateId()][$event->getEventId()];
    }
314070
def get_all_transitions(self, instance_cls):
        
        transitions = self.transitions[instance_cls]

        for name, transition in transitions.items():
            meta = transition._django_fsm

            for transition in meta.transitions.values():
                yield transition
969265
def transition(self, state, message=""):
        
        with self.changes_squashed:
            initial_state = self.state.value
            if self.state_set.transition_allowed(
                    initial_state=initial_state, target_state=state):
                self.log.debug(
                    "%s: Transitioning from %s to %s",
                    self.mri, initial_state, state)
                if state == ss.DISABLED:
                    alarm = Alarm.invalid("Disabled")
                elif state == ss.FAULT:
                    alarm = Alarm.major(message)
                else:
                    alarm = Alarm()
                self.update_health(self, HealthInfo(alarm))
                self.state.set_value(state)
                self.state.set_alarm(alarm)
                for child, writeable in self._children_writeable[state].items():
                    if isinstance(child, AttributeModel):
                        child.meta.set_writeable(writeable)
                    elif isinstance(child, MethodModel):
                        child.set_writeable(writeable)
            else:
                raise TypeError("Cannot transition from %s to %s" %
                                (initial_state, state))