Because of the optimization, the rule for empty states is missing
        A check takes place live
        Args:
            stateid (int): The state identifier
        Returns:
            bool: A true or false response
359958
def _check_self_to_empty(self, stateid):
        
        x_term = stateid.rfind('@')
        y_term = stateid.rfind('A')
        if y_term > x_term:
            x_term = y_term
        ids = stateid[x_term + 1:].split(',')
        if len(ids) < 2:
            return 0
        if ids[0] == ids[1]:
            #    print 'empty'
            return 1
        return 0
155368
protected function setCountryState($state_id)
    {
        $this->data_state = array();

        if (is_numeric($state_id)) {

            $this->data_state = $this->state->get($state_id);

            if (empty($this->data_state)) {
                $this->outputHttpStatus(404);
            }
        }
    }
747835
def _prior_running_states(jid):
    '''
    
    '''

    ret = []
    active = __salt__['saltutil.is_running']('state.*')
    for data in active:
        try:
            data_jid = int(data['jid'])
        except ValueError:
            continue
        if data_jid < int(jid):
            ret.append(data)
    return ret
159598
def get_state_string(self, add_colour=True):
        '''

        '''
        with self._mutex:
            if self.state == self.INACTIVE:
                result = 'Inactive', ['bold', 'blue']
            elif self.state == self.ACTIVE:
                result = 'Active', ['bold', 'green']
            elif self.state == self.ERROR:
                result = 'Error', ['bold', 'white', 'bgred']
            elif self.state == self.UNKNOWN:
                result = 'Unknown', ['bold', 'red']
            elif self.state == self.CREATED:
                result = 'Created', ['reset']
        if add_colour:
            return utils.build_attr_string(result[1], supported=add_colour) + \
                    result[0] + utils.build_attr_string('reset', supported=add_colour)
        else:
            return result[0]
1342697
def grok_state(self, obj):
        """"""
        if 'state' in obj:
            my_state = obj['state'].lower()
            if my_state != 'absent' and my_state != 'present':
                raise aomi_excep \
                    .Validation('state must be either "absent" or "present"')

        self.present = obj.get('state', 'present').lower() == 'present'
716523
def state(args = {})
      return :available if koji_state(args) == :available

      state = distgit_state(args)
      return :needs_repo   if state == :missing_repo
      return :needs_branch if state == :missing_branch
      return :needs_spec   if state == :missing_spec
      return :needs_build  if state == :available
      return :needs_update
    end
1240608
def _check_state(self):
        
        if(self.grid is not None and
           self.configs.configs is not None and
           self.assignments['forward_model'] is not None):
            self.can_model = True

        if(self.grid is not None and
           self.assignments['measurements'] is not None):
            self.can_invert = True
685556
public synchronized void checkState(State requiredState) throws IllegalStateException {
        if (requiredState != currentState) {
            throw new IllegalStateException(String.format(Locale.US,
                    "Expected state %s, but in state %s", requiredState, currentState));
        }
    }
250798
public boolean isState(Class<? extends State> state)
    {
        if (current != null)
        {
            return current.getClass().equals(state);
        }
        return false;
    }
1205046
def guard_rollback_to_receive(analysis_request):
    
    skipped = 0
    valid_states = ['unassigned', 'assigned']
    skip_states = ['retracted', 'rejected']
    analyses = analysis_request.getAnalyses()
    for analysis in analyses:
        analysis = api.get_object(analysis)
        status = api.get_workflow_status_of(analysis)
        if status in valid_states:
            return True
        elif status in skip_states:
            skipped += 1
    return len(analyses) == skipped
412857
def is_valid(self, *states):
        """"""

        # if no state is specified, fallback to the base Form's is_valid
        if not states:
            return super(StateValidatorFormMixin, self).is_valid()

        return all(self.state_validators[state].is_valid(self)
                   for state in states)
957011
public boolean containsSubflowState(final Flow flow, final String stateId) {
        if (containsFlowState(flow, stateId)) {
            return getState(flow, stateId, SubflowState.class) != null;
        }
        return false;
    }
267197
def _check_state(self):
        
        if self._transaction_id is None:
            raise ValueError("Transaction is not begun")

        if self.committed is not None:
            raise ValueError("Transaction is already committed")

        if self._rolled_back:
            raise ValueError("Transaction is already rolled back")
954960
def can_query_state_for_block(self, block_identifier: BlockSpecification) -> bool:
        
        latest_block_number = self.block_number()
        preconditions_block = self.web3.eth.getBlock(block_identifier)
        preconditions_block_number = int(preconditions_block['number'])
        difference = latest_block_number - preconditions_block_number
        return difference < constants.NO_STATE_QUERY_AFTER_BLOCKS
1083404
def update_item_state(item_id, state)
      state = ( state ? 'complete' : 'incomplete' ) unless state.is_a?(String)
      client.put(
          "/cards/#{card_id}/checkItem/#{item_id}",
          state: state
      )
    end
1331312
public function delete($state_id, $check = true)
    {
        $result = null;
        $this->hook->attach('state.delete.before', $state_id, $check, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        if ($check && !$this->canDelete($state_id)) {
            return false;
        }

        $result = (bool) $this->db->delete('state', array('state_id' => $state_id));

        if ($result) {
            $this->db->delete('city', array('state_id' => $state_id));
        }

        $this->hook->attach('state.delete.after', $state_id, $check, $result, $this);
        return (bool) $result;
    }
454014
def state(self, state):
        
        allowed_values = ["draft", "scheduled", "allocatingquota", "allocatedquota", "quotaallocationfailed", "checkingmanifest", "checkedmanifest", "devicefetch", "devicecopy", "devicecheck", "publishing", "deploying", "deployed", "manifestremoved", "expired", "stopping", "autostopped", "userstopped", "conflict"]
        if state not in allowed_values:
            raise ValueError(
                "Invalid value for `state` ({0}), must be one of {1}"
                .format(state, allowed_values)
            )

        self._state = state