Check if parameter is unit rule.
    :param rule: Object to check.
    :return: True if is parameter unit rule, false otherwise.
507648
def _is_unit(rule):
    # type: (Type[Rule]) -> bool
    
    return len(rule.left) == 1 and len(rule.right) == 1 and \
           isclass(rule.fromSymbol) and isclass(rule.toSymbol) and \
           issubclass(rule.fromSymbol, Nonterminal) and issubclass(rule.toSymbol, Nonterminal)
601245
def parse(self, rule: str):
        

        # Empty rule means always accept
        if not rule:
            return checks.TrueCheck()

        for token, value in self._parse_tokenize(rule):
            self._shift(token, value)

        try:
            return self.result
        except ValueError:
            LOG.exception('Failed to understand rule %r', rule)
            # Fail closed
            return checks.FalseCheck()
1144699
private boolean isAnomaly(Instance instance, Rule rule) {
		//AMRUles is equipped with anomaly detection. If on, compute the anomaly value. 			
		boolean isAnomaly = false;	
		if (this.noAnomalyDetectionOption.isSet() == false){
			if (rule.getInstancesSeen() >= this.anomalyNumInstThresholdOption.getValue()) {
				isAnomaly = rule.isAnomaly(instance, 
						this.univariateAnomalyprobabilityThresholdOption.getValue(),
						this.multivariateAnomalyProbabilityThresholdOption.getValue(),
						this.anomalyNumInstThresholdOption.getValue());
			}
		}
		return isAnomaly;
	}
918721
def unary_operation(self, rule, right, **kwargs):
        
        return self.evaluate_unop(rule.operation, right, **kwargs)
49586
def applyRule( self ):
        
        widget = self.queryBuilderWidget()
        if ( not widget ):
            return
        
        rule = widget.findRule(self.uiTermDDL.currentText())
        self.setCurrentRule(rule)
1289033
def is_valid_int_param(param):
    
    if param is None:
        return False
    try:
        param = int(param)
        if param < 0:
            return False
    except (TypeError, ValueError):
        return False
    return True
592775
def is_matching_rule(self, request):
		""""""
		# First, if in DEBUG mode and with django-debug-toolbar, we skip
		#   this entire process.
		if settings.DEBUG and request.path.startswith("/__debug__"):
			return True

		# Second we check against matches
		match = resolve(request.path, getattr(request, "urlconf", settings.ROOT_URLCONF))
		if "({0})".format(match.app_name) in EXEMPT:
			return True

		if "[{0}]".format(match.namespace) in EXEMPT:
			return True

		if "{0}:{1}".format(match.namespace, match.url_name) in EXEMPT:
			return True

		if match.url_name in EXEMPT:
			return True

		# Third, we check wildcards:
		for exempt in [x for x in EXEMPT if x.startswith("fn:")]:
			exempt = exempt.replace("fn:", "")
			if fnmatch.fnmatch(request.path, exempt):
				return True

		return False
530377
def is_match(self, command):
        
        if command.output is None and self.requires_output:
            return False

        try:
            with logs.debug_time(u'Trying rule: {};'.format(self.name)):
                if self.match(command):
                    return True
        except Exception:
            logs.rule_failed(self, sys.exc_info())
279686
function (rule, value) {
    if (Rules.isImplicit(rule.name)) {
      return true;
    }

    return this.getRule('required').validate(value);
  }
500179
function isMatchRule(req, pathname, rule) {
  if (typeof rule === 'string') {
    return pathname.indexOf(rule) > -1;
  } else if (rule instanceof RegExp) {
    return rule.test(pathname);
  } else if (typeof rule === 'function') {
    return rule(pathname, req);
  }
}
679424
protected function checkRuleCorrect($rule)
    {
        if (!isset($rule->value)) {
            // We will assume a missing value for the rule is to be interpreted as empty.
            $rule->value = null;
        }
        if (!isset($rule->id, $rule->field, $rule->type, $rule->input, $rule->operator)) {
            return false;
        }
        if (!isset($this->operators[$rule->operator])) {
            return false;
        }

        return true;
    }
366405
public static boolean validate(
		BiMap<Character, ObfuscationOperationRule<Character, Character>> rules)
	{
		Set<Character> keySet = rules.keySet();
		for (Entry<Character, ObfuscationOperationRule<Character, Character>> entry : rules
			.entrySet())
		{
			ObfuscationOperationRule<Character, Character> value = entry.getValue();
			Character operatedCharacter = Operation.operate(value.getCharacter(),
				value.getOperation());
			if (keySet.contains(operatedCharacter))
			{
				return false;
			}
		}
		return true;
	}
1292936
def integer(self, rule, **kwargs):
        
        rule.value = int(rule.value)
        return rule
97469
def can(self, action, subject, **conditions):
        
        for rule in self.relevant_rules_for_match(action, subject):
            if rule.matches_conditions(action, subject, **conditions):
                return rule.base_behavior
        return False
1324299
def is_unit_or_unitstring(value):
    """"""
    if is_unit(value)[0]:
        return True, value
    try:
        unit = units.Unit(value)
    except:
        return False, value
    else:
        return True, unit
486246
def store_rule(self, rule_id, rule):
        
        if rule_id not in self.rules:
            self.rules[rule_id] = rule
            self.rule_cnt += 1
1034472
def parse_iscsiname(rule):
    '''
    
    '''
    parser = argparse.ArgumentParser()
    rules = shlex.split(rule)
    rules.pop(0)
    #parser.add_argument('iqn')

    args = clean_args(vars(parser.parse_args(rules)))
    parser = None
    return args