Creates a new POP state (type - 2) with the same transitions.
        The POPed symbol is the unique number of the state.
        Args:
            trans (dict): Transition dictionary
        Returns:
            Int: The state identifier
355024
def _generate_state(self, trans):
        
        state = PDAState()
        state.id = self.nextstate()
        state.type = 2
        state.sym = state.id
        state.trans = trans.copy()
        self.toadd.append(state)
        return state.id
429975
private void closeTransition(final ADTTransition<I, O> transition) {

        if (!transition.needsSifting()) {
            return;
        }

        final Word<I> accessSequence = transition.getSource().getAccessSequence();
        final I symbol = transition.getInput();

        this.oracle.reset();
        for (final I i : accessSequence) {
            this.oracle.query(i);
        }

        transition.setOutput(this.oracle.query(symbol));

        final Word<I> longPrefix = accessSequence.append(symbol);
        final ADTNode<ADTState<I, O>, I, O> finalNode =
                this.adt.sift(this.oracle, longPrefix, transition.getSiftNode());

        assert ADTUtil.isLeafNode(finalNode);

        final ADTState<I, O> targetState;

        // new state discovered while sifting
        if (finalNode.getHypothesisState() == null) {
            targetState = this.hypothesis.addState();
            targetState.setAccessSequence(longPrefix);

            finalNode.setHypothesisState(targetState);
            transition.setIsSpanningTreeEdge(true);

            this.observationTree.addState(targetState, longPrefix, transition.getOutput());

            for (final I i : this.alphabet) {
                this.openTransitions.add(this.hypothesis.createOpenTransition(targetState, i, this.adt.getRoot()));
            }
        } else {
            targetState = finalNode.getHypothesisState();
        }

        transition.setTarget(targetState);
    }
100695
def dotransition(accountable, transition_id):
    
    t = accountable.issue_do_transition(transition_id)
    if t.status_code == 204:
        click.secho(
            'Successfully transitioned {}'.format(accountable.issue_key),
            fg='green'
        )
142677
def fmt_transition(t):
    """"""
    return "Transition({} {} {})".format(
        fmt_mechanism(t.cause_indices, t.node_labels),
        ARROW_RIGHT,
        fmt_mechanism(t.effect_indices, t.node_labels))
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
87831
static TransitionResolver of(
        GapResolver gapResolver,
        OverlapResolver overlapResolver
    ) {

        int key = gapResolver.ordinal() * 2 + overlapResolver.ordinal();
        return INSTANCES.get(Integer.valueOf(key));

    }
200469
def check_transition_id(self, transition_id):
        
        if transition_id is not None:
            if transition_id in self._transitions.keys():
                raise AttributeError("The transition id %s already exists. Cannot add transition!", transition_id)
        else:
            transition_id = generate_transition_id()
            while transition_id in self._transitions.keys():
                transition_id = generate_transition_id()
        return transition_id
709581
def append_transition(self, symbol, targetset):
        """"""
        if symbol in self.transitions:
            return
        self.transitions[symbol] = targetset
721790
def create_transition(oracle, method='trn'):
    """"""
    mat, hist, n = _create_trn_mat_symbolic(oracle, method)
    return mat, hist, n
1240526
def change_state_id(self, state_id=None):
        
        old_state_id = self.state_id
        super(ContainerState, self).change_state_id(state_id)
        # Use private variables to change ids to prevent validity checks
        # change id in all transitions
        for transition in self.transitions.values():
            if transition.from_state == old_state_id:
                transition._from_state = self.state_id
            if transition.to_state == old_state_id:
                transition._to_state = self.state_id

        # change id in all data_flows
        for data_flow in self.data_flows.values():
            if data_flow.from_state == old_state_id:
                data_flow._from_state = self.state_id
            if data_flow.to_state == old_state_id:
                data_flow._to_state = self.state_id
1045327
public int getTransitionSelectivity()
    {
        int count = 0;
        for (Transition<DFAState<T>> t : transitions.values())
        {
            CharRange range = t.getCondition();
            count += range.getTo()-range.getFrom();
        }
        return count/transitions.size();
    }
934446
private void updateTransitions(List<Long> transList,
                                   AbstractWordBasedDTNode<I, Boolean, StateInfo<I, Boolean>> oldDtTarget) { // TODO: replace with primitive specialization
        int numTrans = transList.size();

        final List<Word<I>> transAs = new ArrayList<>(numTrans);

        for (int i = 0; i < numTrans; i++) {
            long encodedTrans = transList.get(i);

            int sourceState = (int) (encodedTrans >> StateInfo.INTEGER_WORD_WIDTH);
            int transIdx = (int) (encodedTrans);

            StateInfo<I, Boolean> sourceInfo = stateInfos.get(sourceState);
            I symbol = alphabet.getSymbol(transIdx);

            transAs.add(sourceInfo.accessSequence.append(symbol));
        }

        final List<StateInfo<I, Boolean>> succs = sift(Collections.nCopies(numTrans, oldDtTarget), transAs);

        for (int i = 0; i < numTrans; i++) {
            long encodedTrans = transList.get(i);

            int sourceState = (int) (encodedTrans >> StateInfo.INTEGER_WORD_WIDTH);
            int transIdx = (int) (encodedTrans);

            setTransition(sourceState, transIdx, succs.get(i));
        }
    }
841004
def get_next_del_state(self, state, ret):
        
        if ret:
            if state == fw_const.INIT_STATE:
                return state
            else:
                return state - 1
        else:
            return state
729181
def _transitionerFromInstance(oself, symbol, automaton):
    
    transitioner = getattr(oself, symbol, None)
    if transitioner is None:
        transitioner = Transitioner(
            automaton,
            automaton.initialState,
        )
        setattr(oself, symbol, transitioner)
    return transitioner
717882
def state_transition(
        target_state: Optional[TargetTransferState],
        state_change: StateChange,
        channel_state: NettingChannelState,
        pseudo_random_generator: random.Random,
        block_number: BlockNumber,
) -> TransitionResult[TargetTransferState]:
    
    # pylint: disable=too-many-branches,unidiomatic-typecheck

    iteration = TransitionResult(target_state, list())
    if type(state_change) == ActionInitTarget:
        assert isinstance(state_change, ActionInitTarget), MYPY_ANNOTATION
        if target_state is None:
            iteration = handle_inittarget(
                state_change,
                channel_state,
                pseudo_random_generator,
                block_number,
            )
    elif type(state_change) == Block:
        assert isinstance(state_change, Block), MYPY_ANNOTATION
        assert state_change.block_number == block_number
        assert target_state, 'Block state changes should be accompanied by a valid target state'

        iteration = handle_block(
            target_state=target_state,
            channel_state=channel_state,
            block_number=state_change.block_number,
            block_hash=state_change.block_hash,
        )
    elif type(state_change) == ReceiveSecretReveal:
        assert isinstance(state_change, ReceiveSecretReveal), MYPY_ANNOTATION
        assert target_state, 'ReceiveSecretReveal should be accompanied by a valid target state'
        iteration = handle_offchain_secretreveal(
            target_state=target_state,
            state_change=state_change,
            channel_state=channel_state,
            pseudo_random_generator=pseudo_random_generator,
            block_number=block_number,
        )
    elif type(state_change) == ContractReceiveSecretReveal:
        assert isinstance(state_change, ContractReceiveSecretReveal), MYPY_ANNOTATION
        msg = 'ContractReceiveSecretReveal should be accompanied by a valid target state'
        assert target_state, msg
        iteration = handle_onchain_secretreveal(
            target_state,
            state_change,
            channel_state,
        )
    elif type(state_change) == ReceiveUnlock:
        assert isinstance(state_change, ReceiveUnlock), MYPY_ANNOTATION
        assert target_state, 'ReceiveUnlock should be accompanied by a valid target state'
        iteration = handle_unlock(
            target_state=target_state,
            state_change=state_change,
            channel_state=channel_state,
        )
    elif type(state_change) == ReceiveLockExpired:
        assert isinstance(state_change, ReceiveLockExpired), MYPY_ANNOTATION
        assert target_state, 'ReceiveLockExpired should be accompanied by a valid target state'
        iteration = handle_lock_expired(
            target_state=target_state,
            state_change=state_change,
            channel_state=channel_state,
            block_number=block_number,
        )

    sanity_check(
        old_state=target_state,
        new_state=iteration.new_state,
        channel_state=channel_state,
    )

    return iteration
519453
def transition_function(self, qi, u):
        
        try:
            return self.transition[qi][u]
        except KeyError:
            if u in self.alphabet:
                try:
                    return self.transition[qi]['*']
                except KeyError:
                    return None
            return None
171422
def event(from_states=None, to_state=None):
    
    from_states_tuple = (from_states, ) if isinstance(from_states, State) else tuple(from_states or [])
    if not len(from_states_tuple) >= 1:
        raise ValueError()
    if not all(isinstance(state, State) for state in from_states_tuple):
        raise TypeError()
    if not isinstance(to_state, State):
        raise TypeError()

    def wrapper(wrapped):

        @functools.wraps(wrapped)
        def transition(instance, *a, **kw):
            if instance.current_state not in from_states_tuple:
                raise InvalidStateTransition()
            try:
                result = wrapped(instance, *a, **kw)
            except Exception as error:
                error_handlers = getattr(instance, '___pystatemachine_transition_failure_handlers', [])
                for error_handler in error_handlers:
                    error_handler(instance, wrapped, instance.current_state, to_state, error)
                if not error_handlers:
                    raise error
            else:
                StateInfo.set_current_state(instance, to_state)
                return result

        return transition

    return wrapper