Alter the way a successful state run is determined
329797
def _run_check_cmd(self, low_data):
        '''
        
        '''
        ret = {'result': False}
        cmd_opts = {}
        if 'shell' in self.opts['grains']:
            cmd_opts['shell'] = self.opts['grains'].get('shell')
        for entry in low_data['check_cmd']:
            cmd = self.functions['cmd.retcode'](
                entry, ignore_retcode=True, python_shell=True, **cmd_opts)
            log.debug('Last command return code: %s', cmd)
            if cmd == 0 and ret['result'] is False:
                ret.update({'comment': 'check_cmd determined the state succeeded', 'result': True})
            elif cmd != 0:
                ret.update({'comment': 'check_cmd determined the state failed', 'result': False})
                return ret
        return ret
1154764
def state_machine_success():
    """"""
    from furious.async import Async
    from furious.context import get_current_async

    result = get_current_async().result

    if result == 'ALPHA':
        logging.info('Inserting continuation for state %s.', result)
        return Async(target=complex_state_generator_alpha, args=[result])

    elif result == 'BRAVO':
        logging.info('Inserting continuation for state %s.', result)
        return Async(target=complex_state_generator_bravo, args=[result])

    logging.info('Done working, stop now.')
98266
def reset(self):
        """"""
        for alternative in self.alternatives:
            alternative.reset()
        self.reset_winner()
        self.increment_version()
305244
def change_state(self, state):
        """"""
        if state is not self.state:
            if self.debug:
                self.print_debug(b'state => ' + STATE_NAMES[state].encode())
            if self.state is STATE_NOT_STARTED:
                self.read_in_state_not_started = b''
            self.state = state
392696
private void setState(IState toState)
    {
        // We want to make sure state changes happen purely on the "home" thread,
        // for the sake of sanity and avoiding many obscure race-condition bugs.
        if (Thread.currentThread() == this.homeThread)
        {
            // We are on the home thread, so safe to proceed:
            if (this.state != toState)
            {
                System.out.println(getName() + " enter state: " + toState);
                TCPUtils.Log(Level.INFO, "======== " + getName() + " enter state: " + toState + " ========");
                this.state = toState;
                onPreStateChange(toState);
                onStateChange();
            }
        }
        else
        {
            // We are not on the home thread; queue this state transition
            // so that the home thread can act on it.
            queueStateChange(toState);
        }
    }
613558
def set_(self, state):
    """"""
    if not self.can_be_(state):
        state = self._meta['translator'].translate(state)
        raise TransitionError(
            "Cannot transit from '{actual_value}' to '{value}'."
            .format(actual_value=self.actual_state.value, value=state.value)
        )

    self.force_set(state)
791032
def setVisible(self, state):
        
        super(XLineEdit, self).setVisible(state)
        
        self.adjustStyleSheet()
        self.adjustTextMargins()
789241
function matchesState(state, desiredState) {
  if (desiredState === 'all') {
    return true;
  }
  if (desiredState[0] === '!') {
    return state !== desiredState.substring(1);
  }
  return state === desiredState;
}
561562
def running_state(self, running_state):
        
        allowed_values = ["ONGOING", "PENDING", "ENDED"]  # noqa: E501
        if running_state not in allowed_values:
            raise ValueError(
                "Invalid value for `running_state` ({0}), must be one of {1}"  # noqa: E501
                .format(running_state, allowed_values)
            )

        self._running_state = running_state
138868
def successful(self):
        """"""
        status = self.status
        assert status >= COMPLETED, "status is %s" % status
        return (self.status == COMPLETED)
600216
def set_result(self, result):
        
        with self.__condition:
            self.__result = result
            self.__state = FINISHED
            self.__condition.notify_all()
        self._invoke_callbacks()
660237
@Override
	protected void finalizeEvalMat() {
		int V = States.values().length;
		for(int v = 0; v < V; ++v){
			if(v != States.S.ordinal())
				_evalMat.set(_sParam.getRangeEnd(), _lParam.getRangeEnd(), v, 0);
		}
	}
699089
private function setStates()
    {
        $appID = App::getCurrentID();
        $complementID = self::getCurrentID();

        if (! is_null($this->states)) {
            $states = $this->getStatesFromFile();

            if ($this->stateChanged($states)) {
                $file = $this->getStatesFilePath();
                $states[$appID][$complementID] = $this->states;
                Json::arrayToFile($states, $file);
                Hook::doAction('Eliasis/Complement/after_set_states', $states);
            }
        }
    }
309723
def check_result(running, recurse=False, highstate=None):
    '''
    
    '''
    if not isinstance(running, dict):
        return False

    if not running:
        return False

    ret = True
    for state_id, state_result in six.iteritems(running):
        expected_type = dict
        # The __extend__ state is a list
        if "__extend__" == state_id:
            expected_type = list
        if not recurse and not isinstance(state_result, expected_type):
            ret = False
        if ret and isinstance(state_result, dict):
            result = state_result.get('result', _empty)
            if result is False:
                ret = False
            # only override return value if we are not already failed
            elif result is _empty and isinstance(state_result, dict) and ret:
                ret = check_result(
                    state_result, recurse=True, highstate=highstate)
        # if we detect a fail, check for onfail requisites
        if not ret:
            # ret can be None in case of no onfail reqs, recast it to bool
            ret = bool(check_onfail_requisites(state_id, state_result,
                                               running, highstate))
        # return as soon as we got a failure
        if not ret:
            break
    return ret
892517
def set_secondary_state(self, value):
        """"""
        if value not in (_STATE_RUNNING, _STATE_SHUTDOWN, _STATE_FORCED_SHUTDOWN):
            raise ValueError(
                "State {!r} is invalid - needs to be one of _STATE_RUNNING, _STATE_SHUTDOWN, or _STATE_FORCED_SHUTDOWN".format(
                    value)
                )
        if self.manager is None:
            raise RuntimeError("Manager not started")
        self.manager.set_state(value)
787391
synchronized void statusUpdate(State runState, 
                                 float progress,
                                 String state, 
                                 Phase phase,
                                 long finishTime) {
    setRunState(runState);
    setProgress(progress);
    setStateString(state);
    setPhase(phase);
    if (finishTime > 0) {
      setFinishTime(finishTime); 
    }
  }
343063
void changeState(State state) {

        m_state = state;
        switch (state) {
            case validationRunning:
                m_cancelButton.setEnabled(false);
                m_okButton.setEnabled(false);
                clearValidationError();
                break;
            case validationFailed:
                m_okButton.setEnabled(false);
                m_cancelButton.setEnabled(true);
                break;
            case validationUnknown:
            default:
                m_cancelButton.setEnabled(true);
                m_okButton.setEnabled(true);
                clearValidationError();
                break;

        }
    }