Must check if rule actually exists before proceeding with load.
182712
def _load_11_6(self, **kwargs):
        """"""
        if self._check_existence_by_collection(self._meta_data['container'],
                                               kwargs['name']):
            return super(Rule, self)._load(**kwargs)
        msg = 'The application resource named, {}, does not exist on the ' \
              'device.'.format(kwargs['name'])
        raise NonExtantFirewallRule(msg)
657602
function shouldUnloadPage(index, rangeLength) {

        // within page load range?
        if (indexInRange(index, rangeLength)) {
            return false;
        }

        // is it visible?
        if (pageIsVisible(index)) {
            return false;
        }

        return true;
    }
150796
function _check(err, id) {
        updateProgress(1);
        if (err) {
            alert('Failed to load ' + id + ': ' + err);
        }
        loadc++;
        if (itemc == loadc) callback();
    }
682462
def check_for_upload_create(self, relative_path=None):
        """"""
        for f in os.listdir(
            path_join(
                self.local_path, relative_path) if relative_path else self.local_path
        ):
            self.node_check_for_upload_create(relative_path, f)
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
368906
def should_ignore_rule(self, rule):
        
        return rule.id in self.config.ignore or rule.name in self.config.ignore
1270959
def should_we_load(kls):
    
    # we don't load abstract classes
    if kls.__name__.endswith("AbstractCheck"):
        return False
    # and we only load checks
    if not kls.__name__.endswith("Check"):
        return False
    mro = kls.__mro__
    # and the class needs to be a child of AbstractCheck
    for m in mro:
        if m.__name__ == "AbstractCheck":
            return True
    return False
1338421
public static function exist($name)
    {
        $name = ucfirst($name);

        /*
         * If it was checked before negatively - direct return.
         */
        if (in_array($name, self::$_unavailableModules)) {
            return false;
        }

        /*
         * Check if it was already loaded.
         */
        if (isset(self::$_loadedModules[$name])) {
            return true;
        }

        /*
         * Or the file exists.
         */
        if (file_exists(self::getModulePath().$name.'.php')) {
            return true;
        } else {
            self::$_unavailableModules[] = $name;
        }

        /*
         * Module does not exist.
         */

        return false;
    }
502465
boolean containsRule( Rule rule ) {
        for( int i = state.stackIdx - 1; i >= 0; i-- ) {
            if( rule == state.stack.get( i ).mixin ) {
                return true;
            }
        }
        return false;
    }
485524
def check_existence(to_check, name, config_key=None, relative_to=None,
                    allow_undefined=False, allow_not_existing=False,
                    base_key='releaser'):
    """"""
    if allow_undefined and (to_check is None or to_check.lower() == 'none'):
        print("{: <14} -> {}UNDEFINED{}".format(name, WARNING_COLOR,
                                                RESET_COLOR))
        return
    else:
        if config_key is None:
            config_key = "{}.{}".format(base_key, name)
        my_check = Path(to_check).resolve()
        if my_check.exists() and relative_to is not None:
            printed_path = str(my_check.relative_to(relative_to))
            if printed_path != '.':
                printed_path = '.' + os.sep + printed_path
        else:
            printed_path = str(my_check)
        if my_check.exists() or allow_not_existing:
            print("{: <14} -> {}".format(name, printed_path))
            return
        else:
            raise FileNotFoundError("[{}ERROR{}] '{}', as given, doesn't "
                                    "exist. For configuration key '{}', was "
                                    "given: {}".format(ERROR_COLOR, RESET_COLOR,
                                                       name, config_key,
                                                       to_check))
1173533
function load() {
		var newRules = Rules.rules;
		Object.keys(newRules).forEach(function(ruleId) {
			define(ruleId, newRules[ruleId]);
		});
	}
781291
def matches(filter, message, valid_paths, rule_cache, config):
    

    if not filter['rules']:
        return False

    for rule in filter['rules']:
        fn = rule['fn']
        negated = rule['negated']
        arguments = rule['arguments']
        rule_cache_key = rule['cache_key']

        try:
            if rule_cache_key not in rule_cache:
                value = fn(config, message, **arguments)
                if negated:
                    value = not value
                rule_cache[rule_cache_key] =  value

            if not rule_cache[rule_cache_key]:
                return False
        except Exception as e:
            log.exception(e)
            # If something throws an exception then we do *not* have a match.
            return False

    # Then all rules matched on this filter..
    return True
279686
function (rule, value) {
    if (Rules.isImplicit(rule.name)) {
      return true;
    }

    return this.getRule('required').validate(value);
  }
621409
def exists(name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    try:
        elb = conn.get_all_load_balancers(load_balancer_names=[name])
        if elb:
            return True
        else:
            log.debug('The load balancer does not exist in region %s', region)
            return False
    except boto.exception.BotoServerError as error:
        log.warning(error)
        return False
1195311
def exists(self, relpath):
    """"""
    if self.isignored(self._append_slash_if_dir_path(relpath)):
      return False
    return self._exists_raw(relpath)
75677
function isLoadNeeded(newProps, oldProps) {
        return newProps.entityType !== oldProps.entityType || newProps.entityId !== oldProps.entityId || newProps.entityCode !== oldProps.entityCode;
      }
91446
def load(self, rule_type, quiet = False):
        
        if self.filename and os.path.exists(self.filename):
            try:
                with open(self.filename, 'rt') as f:
                    ruleset = json.load(f)
                    self.about = ruleset['about'] if 'about' in ruleset else ''
                    self.rules = {}
                    for filename in ruleset['rules']:
                        self.rules[filename] = []
                        for rule in ruleset['rules'][filename]:
                            self.handle_rule_versions(filename, rule_type, rule)
            except Exception as e:
                printException(e)
                printError('Error: ruleset file %s contains malformed JSON.' % self.filename)
                self.rules = []
                self.about = ''
        else:
            self.rules = []
            if not quiet:
                printError('Error: the file %s does not exist.' % self.filename)