Test if this conversation is in the given state.
556484
def is_state(self, state):
        
        state = state.format(relation_name=self.relation_name)
        value = _get_flag_value(state)
        if not value:
            return False
        return self.key in value['conversations']
795676
function isUSAState (state, strict) {
    state = state && NODE_RATIFY.isString(state) ? _toTitleCase(state) : null;
    var topLevel = (US_STATE_CODE_TO_NAME[state] || US_STATE_NAME_TO_CODE[state]);

    if(strict) {
        return topLevel ? true : false;
    } else {
        return (US_INHABITED_TERRITORIES_CODE_TO_NAME[state] || US_INHABITED_TERRITORIES_NAME_TO_CODE[state] || topLevel) ? true : false;
    }
}
265709
def state(self):
        """"""
        response =  self.SOAPAction('GetSocketSettings', 'OPStatus', self.moduleParameters("1"))
        if response is None:
            return 'unknown'
        elif response.lower() == 'true':
            return ON
        elif response.lower() == 'false':
            return OFF
        else:
            _LOGGER.warning("Unknown state %s returned" % str(response.lower()))
            return 'unknown'
485172
def has_transition(self, state):
        
        if state in self.transitions:
            return True

        if '*' in self.transitions:
            return True

        if '+' in self.transitions and self.transitions['+'].target != state:
            return True

        return False
472968
def PushState(self, **_):
    """"""
    if self.verbose:
      logging.debug("Storing state %r", self.state)
    self.state_stack.append(self.state)
178350
void checkInternalConsistency() throws IllegalStateException {
		if (encryptionKey == null) {
			throw new IllegalStateException("Missing encryption key");
		}

		switch (state) {
			case LOGGED_IN:
				if (StringUtils.isNullOrEmpty(userId)) {
					throw new IllegalStateException("Missing user id");
				}
				break;
			case LOGGED_OUT:
				throw new IllegalStateException("Invalid conversation state: " + state);
			default:
				break;
		}
	}
114118
def is_state(self, entity_id, state):
        """"""
        return remote.is_state(self.api, entity_id, state)
809519
def state(self, state):
        """"""
        with self._lock:
            self._value = self._states.index(state)
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
86668
def toggle_state(self, state, active=TOGGLE, scope=None):
        
        self.conversation(scope).toggle_state(state, active)
180589
private void checkStatePlaying()
    {
        if (!reverse)
        {
            if (repeat)
            {
                state = AnimState.PLAYING;
                current = first;
            }
            else
            {
                state = AnimState.FINISHED;
            }
        }
        else
        {
            state = AnimState.REVERSING;
        }
    }
1092321
def check(self):
        """"""
        has_term = False

        if self.START_STATE not in self.states:
            raise SyntaxError('Undefined start rule')

        for state in self.states:
            for rule in self.states[state]:
                if rule is not None:
                    if rule[2] == self.TERM_STATE:
                        has_term = True
                    elif rule[2] not in self.states:
                        raise SyntaxError('Unexpected state: ' + rule[2])

        if not has_term:
            raise SyntaxError('Missed terminate state')
911655
function(state) {
            if (state == this.state) return;

            this.state = state;
            logging.log("state ", this.state);
            this.trigger("state", this.state);
        }
1068456
def verify_state(self):
        
        if self.state == SESSION_STATE.CONNECTING:
            self.state = SESSION_STATE.OPEN

            self.conn.connectionMade(self.conn_info)
1265380
private static boolean checkValidity(ClientSocket client, byte from, StateConnection expected)
    {
        return from >= 0 && client.getState() == expected;
    }
1317443
def _validate_state(state, valid_states):
    """"""
    if state in State:
        return state.name
    elif state in valid_states:
        return state
    else:
        raise Invalid('Invalid state')
530416
def can_be_(self, state):
    """"""
    translator = self._meta['translator']
    state = translator.translate(state)

    if self._meta['complete']:
        return True

    if self.actual_state is None:
        return True

    transitions = self._meta['transitions'][self.actual_state]
    return state in transitions