Transitions to a non-standard state

    Raises InvalidStateTransition if next_state is not allowed.

    :param prior_state: <str>
    :param next_state: <str>
    :return: <str>
559615
def transition(prior_state, next_state):
    
    if next_state not in STATES[prior_state][TRANSITION]:
        acceptable = STATES[prior_state][TRANSITION]
        err = "cannot {}->{} may only {}->{}".format(prior_state,
                                                     next_state,
                                                     prior_state,
                                                     acceptable)
        raise InvalidStateTransition(err)
    return next_state
815403
private void resiftAffectedTransitions(final Set<ADTNode<ADTState<I, O>, I, O>> states,
                                           final ADTNode<ADTState<I, O>, I, O> finalizedADS) {

        for (final ADTNode<ADTState<I, O>, I, O> state : states) {

            final List<ADTTransition<I, O>> transitionsToRefine = state.getHypothesisState()
                                                                       .getIncomingTransitions()
                                                                       .stream()
                                                                       .filter(x -> !x.isSpanningTreeEdge())
                                                                       .collect(Collectors.toList());

            for (final ADTTransition<I, O> trans : transitionsToRefine) {
                trans.setTarget(null);
                trans.setSiftNode(finalizedADS);
                this.openTransitions.add(trans);
            }
        }
    }
1056946
public Transition<S> getTransition(S fromState, T transition){
		Transition<S> transitionDef = transitions.get(new DoubleValueBean<S, T>(fromState, transition));
		if (transitionDef == null){
			throw new IllegalArgumentException("Transition '" + transition + "' from state '" + fromState + "' has not been defined.");
		}
		return transitionDef;
	}
113669
public synchronized void checkState(State... requiredStates) throws IllegalStateException {
        for (State requiredState : requiredStates) {
            if (requiredState.equals(currentState)) {
                return;
            }
        }
        throw new IllegalStateException(String.format(Locale.US,
                "Expected states %s, but in state %s", Lists.newArrayList(requiredStates), currentState));
    }
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)
391652
def switch(self, first, second):
        """"""
        allowed_states = ['queued', 'stashed']
        if first in self.queue and second in self.queue \
                and self.queue[first]['status'] in allowed_states\
                and self.queue[second]['status'] in allowed_states:

            tmp = self.queue[second].copy()
            self.queue[second] = self.queue[first].copy()
            self.queue[first] = tmp
            self.write()
            return True
        return False
1066170
public void setTransitions(int state,
                               int inputIdx,
                               Collection<? extends Integer> successors) { // TODO: replace by primitive specialization
        int transIdx = toMemoryIndex(state, inputIdx);
        //TIntSet succs = transitions[transIdx];
        Set<Integer> succs = transitions[transIdx]; // TODO: replace by primitive specialization
        if (succs == null) {
            //succs = new TIntHashSet(successors);
            succs = Sets.newHashSetWithExpectedSize(successors.size()); // TODO: replace by primitive specialization
            transitions[transIdx] = succs;
        } else {
            succs.clear();
        }
        succs.addAll(successors);
    }
931859
def __bad_transition(self, state):
        
        statemsg = ""
        oldState = self.stateNames[ self.get_state() ]
        newState = self.stateNames[ state ]
        msg = "Invalid state transition (%s -> %s)" \
              " for breakpoint at address %s"
        msg = msg % (oldState, newState, HexDump.address(self.get_address()))
        raise AssertionError(msg)
874185
def state(self, state=vanilla.message.NoState):
        
        return vanilla.message.State(self, state=state)
248743
public void queueStateChange(IState state)
    {
        synchronized(this.stateQueue)
        {
            if (this.stateQueue.size() != 0)
            {
                // The queue is only a method for ensuring the transition is carried out on the correct thread - transitions should
                // never happen so quickly that we end up with more than one state in the queue.
                System.out.println("STATE ERROR - multiple states in the queue.");
            }
            this.stateQueue.add(state);
            System.out.println(getName() + " request state: " + state);
            TCPUtils.Log(Level.INFO, "-------- " + getName() + " request state: " + state + " --------");
        }
    }
1004119
def levels_to_accepting_states(self) -> dict:
        """"""

        res = {accepting_state: 0 for accepting_state in self._accepting_states}
        level = 0

        # least fixpoint
        z_current, z_next = set(), set()
        z_next = set(self._accepting_states)

        while z_current != z_next:
            level += 1
            z_current = z_next
            z_next = copy(z_current)
            for state in self._transition_function:
                for action in self._transition_function[state]:
                    if state in z_current:
                        continue
                    next_state = self._transition_function[state][action]
                    if next_state in z_current:
                        z_next.add(state)
                        res[state] = level
                        break

        z_current = z_next
        for failure_state in filter(lambda x: x not in z_current, self._states):
            res[failure_state] = -1

        return res
121443
def _do_mstep(self, stats):
        
        # The ``np.where`` calls guard against updating forbidden states
        # or transitions in e.g. a left-right HMM.
        if 's' in self.params:
            startprob_ = self.startprob_prior - 1.0 + stats['start']
            self.startprob_ = np.where(self.startprob_ == 0.0,
                                       self.startprob_, startprob_)
            normalize(self.startprob_)
        if 't' in self.params:
            transmat_ = self.transmat_prior - 1.0 + stats['trans']
            self.transmat_ = np.where(self.transmat_ == 0.0,
                                      self.transmat_, transmat_)
            normalize(self.transmat_, axis=1)
1215967
def validate_valid_transition(enum, from_value, to_value):
    
    validate_available_choice(enum, to_value)
    if hasattr(enum, '_transitions') and not enum.is_valid_transition(from_value, to_value):
        message = _(six.text_type('{enum} can not go from "{from_value}" to "{to_value}"'))
        raise InvalidStatusOperationError(message.format(
            enum=enum.__name__,
            from_value=enum.name(from_value),
            to_value=enum.name(to_value) or to_value
        ))
1256655
def _transition(self, nxt, cur=None, since=None):
        '''
        
        '''
        self.transition_intervals[(cur, nxt)].tick()
        if since:
            self.state_durations[cur].end(since)
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]
1285315
def convertToTransitionDict(self,transitions):
          
        states,rates = transitions
        rateDict = defaultdict(float)
        if states.shape[1] == 1:
            for idx,state in enumerate(states):
                rateDict[int(state)] += rates[idx]
        else:
            for idx,state in enumerate(states):
                rateDict[tuple(state)] += rates[idx]        
        return rateDict
249850
private void transition(final CallState nextState, final SipPacket msg) {
        final CallState previousState = this.currentState;
        this.currentState = nextState;
        if (previousState != nextState) {
            // don't add the same transition twice
            this.callTransitions.add(nextState);
        }
        if (logger.isInfoEnabled()) {
            logger.info("[{}] {} -> {} Event: {}", this.callId, previousState, this.currentState, msg.getInitialLine());
        }
    }