Is this a valid state transition?
541041
def state_transition_is_valid( nameop ):
    
    assert '__state_transition__' in nameop, "Not tagged with @state_transition"
    assert nameop['__state_transition__'], "BUG: @state_transition tagged False"
    assert '__history_id_key__' in nameop, "Missing __history_id_key__"
    history_id_key = nameop['__history_id_key__']
    assert history_id_key in ["name", "namespace_id"], "Invalid history ID key '%s'" % history_id_key
    assert '__table__' in nameop, "Missing __table__"
    assert '__always_set__' in nameop, "No always-set fields given"
    assert '__account_payment_info__' in nameop, 'No account payment information present'

    return True
1108545
def is_transition_allowed(analyses, transition_id):
    
    if not analyses:
        return True
    if not isinstance(analyses, list):
        return is_transition_allowed([analyses], transition_id)
    for analysis in analyses:
        if not wf.isTransitionAllowed(analysis, transition_id):
            return False
    return True
747684
public boolean containsTransition(final TransitionableState state, final String transition) {
        if (state == null) {
            LOGGER.error("State is not configured correctly and cannot be null.");
            return false;
        }
        return state.getTransition(transition) != null;
    }
1246650
private void doRunningStateChange(RunningState newState) {
    RunningState oldState = null;
    JobExecutionStateListener stateListener = null;
    this.changeLock.lock();
    try {
      // verify transition
      if (null == this.runningState) {
        Preconditions.checkState(RunningState.PENDING == newState);
      }
      else {
        Preconditions.checkState(EXPECTED_PRE_TRANSITION_STATES.get(newState).contains(this.runningState),
            "unexpected state transition " + this.runningState + " --> " + newState);
      }

      oldState = this.runningState;
      this.runningState = newState;
      if (this.listener.isPresent()) {
        stateListener = this.listener.get();
      }
      this.runningStateChanged.signalAll();
    }
    finally {
      this.changeLock.unlock();
    }
    if (null != stateListener) {
      stateListener.onStatusChange(this, oldState, newState);
    }
  }
141355
def transitionStates(self,state):
        
        newstates,rates         = self.transition(state)              
        newindices              = self.getStateIndex(newstates)
        return newindices,rates
1256655
def _transition(self, nxt, cur=None, since=None):
        '''
        
        '''
        self.transition_intervals[(cur, nxt)].tick()
        if since:
            self.state_durations[cur].end(since)
1298858
protected final synchronized void transitionState(OperationState newState) {
    getLogger().debug("Transitioned state from %s to %s", state, newState);
    state = newState;
    // Discard our buffer when we no longer need it.
    if(state != OperationState.WRITE_QUEUED
        && state != OperationState.WRITING) {
      cmd = null;
    }
    if (state == OperationState.COMPLETE) {
      callback.complete();
    }
  }
294194
private boolean toNextState(LifecycleState newState)
  {
    LifecycleState state;
    
    synchronized (this) {
      state = _state;
      
      if (newState.ordinal() <= state.ordinal()) {
        return false;
      }
      
      _state = newState;

      _lastChangeTime = CurrentTime.currentTime();
    }

    if (_log != null && _log.isLoggable(_lowLevel)) {
      _log.log(_lowLevel, newState + " " + _name);
    }

    notifyListeners(state, newState);

    return true;
  }
990552
public void updateState() {
        if (Thread.currentThread() == this.homeThread) {
            IState state = null;
            // Check the state queue to see if we need to carry out a transition:
            synchronized (this.stateQueue) {
                if (this.stateQueue.size() > 0) {
                    state = this.stateQueue.remove(0);
                }
            }
            if (state != null) {
                setState(state);   // Transition to the next state.
            }
        }
    }
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)
318682
def is_(self, state):
    """"""
    translator = self._meta['translator']
    state = translator.translate(state)
    return self.actual_state == state
846035
def state(self, new_state: bool):
    
    self._lutron.send(Lutron.OP_EXECUTE, Keypad._CMD_TYPE, self._keypad.id,
                      self.component_number, Led._ACTION_LED_STATE,
                      int(new_state))
    self._state = new_state
6253
function evaluateState(state, instance, message) {
    var result = false;
    // delegate to child regions first if a non-continuation
    if (message !== state) {
        state.regions.every(function (region) {
            var currentState = instance.getLastKnownState(region);
            if (currentState && evaluateState(currentState, instance, message)) {
                result = true;
                return isActive(state, instance); // NOTE: this just controls the every loop; also isActive is a litte costly so using sparingly
            }
            return true; // NOTE: this just controls the every loop
        });
    }
    // if a transition occured in a child region, check for completions
    if (result) {
        if ((message !== state) && isComplete(state, instance)) {
            evaluateState(state, instance, state);
        }
    }
    else {
        // otherwise look for a transition from this state
        var transitions = state.outgoing.filter(function (transition) { return transition.guard(message, instance); });
        if (transitions.length === 1) {
            // execute if a single transition was found
            result = traverse(transitions[0], instance, message);
        }
        else if (transitions.length > 1) {
            // error if multiple transitions evaluated true
            exports.console.error(state + ": multiple outbound transitions evaluated true for message " + message);
        }
    }
    return result;
}
640689
function (state, subPropKey, key, transitionCfg, done) {
        var el = this._el;
        var stateObj = subPropKey ? state[subPropKey] : state;
        var elObj = subPropKey ? el[subPropKey] : el;
        var availableProp = stateObj && (key in stateObj)
            && elObj && (key in elObj);

        var transitionAnimators = this._transitionAnimators;
        if (availableProp) {
            var obj = {};
            if (stateObj[key] === elObj[key]) {
                return 0;
            }
            obj[key] = stateObj[key];

            var animator = el.animate(subPropKey)
                .when(transitionCfg.duration, obj)
                .delay(transitionCfg.dealy)
                .done(function () {
                    var idx = zrUtil.indexOf(transitionAnimators, 1);
                    if (idx > 0) {
                        transitionAnimators.splice(idx, 1);
                    }
                    done();
                })
                .start(transitionCfg.easing);
            transitionAnimators.push(animator);

            return 1;
        }
        return 0;
    }
1113821
def addTransition(self, inState, inputSymbol, outState, outputSymbols):
        
        # keeping self._transitions in a flat list makes addTransition
        # O(n^2), but state machines don't tend to have hundreds of
        # transitions.
        for (anInState, anInputSymbol, anOutState, _) in self._transitions:
            if (anInState == inState and anInputSymbol == inputSymbol):
                raise ValueError(
                    "already have transition from {} via {}".format(inState, inputSymbol))
        self._transitions.add(
            (inState, inputSymbol, outState, tuple(outputSymbols))
        )
393410
function(leaveState, event, data) {
        // If `data` is a string, it is the destination state of the transition
        if (_.isString(data)) data = {enterState: data}
        else data = _.clone(data)

        if (leaveState !== ANY_STATE && !this._states.hasOwnProperty(leaveState))
          this.state(leaveState, {})

        if (!this._states.hasOwnProperty(data.enterState))
          this.state(data.enterState, {})

        if (!this._transitions.hasOwnProperty(leaveState))
          this._transitions[leaveState] = {}

        data.callbacks = this._collectMethods((data.callbacks || []))
        this._transitions[leaveState][event] = data
      }
142250
def islive(self, state):
		''''''
		reachable = [state]
		i = 0
		while i < len(reachable):
			current = reachable[i]
			if current in self.finals:
				return True
			if current in self.map:
				for symbol in self.map[current]:
					next = self.map[current][symbol]
					if next not in reachable:
						reachable.append(next)
			i += 1
		return False