rule : GUIDELINE
                | REGULATION
175306
def p_rule(self, rule):
        ''''''
        if len(rule[1]) == 4:
            # This is a guideline
            rule[0] = Guideline(rule[1][1], rule[1][2], rule[1][3])
        else:
            # This is a regulation
            indentsize = rule[1][0]
            number = rule[1][1]
            text = rule[1][2]
            parent = None

            # If we just "un"nested, shrink the current rule to our level
            if self.prev_indent > indentsize:
                self.current_rule = self.current_rule[0:indentsize+1]

            # We just added a nested level, the parent is the list's last elem
            if self.prev_indent < indentsize:
                parent = self.current_rule[-1]
            # Else, if we are nested the parent is the one before the last elem
            elif len(self.current_rule) > 1:
                parent = self.current_rule[-2]
            # Else if we are not nested, then we are a root rule and parent is none
            # (do nothing as parent is initialized to none)

            # Create the regulation node
            reg = Regulation(number, text, parent)

            # Let our parent knows he has a new child, if we don't have a parent
            # let's create an item in the article rules list
            if parent:
                parent.add_child(reg)
            else:
                rule[0] = reg

            # Unless we nested, pop and replace the last rule by ourself
            # If we added a nesting level, we just need to add ourself
            if self.prev_indent >= indentsize:
                self.current_rule.pop()
            self.current_rule.append(reg)
            self.prev_indent = indentsize
253727
def _process_rule(self, rule: dict, context: dict):
        
        if not rule or not self._shall_proceed(rule):
            return
        self.context.update(context)
        self.context.update(rule.get('context', {}))
        self.path = rule.get('path', None)
        self.source = rule.get('source', None)
        for entry in rule.get('documents', []):
            target, source = self._resolve_rule_document(entry)
            self.write(target, source)
        for entry in rule.get('preserve', []):
            target, source = self._resolve_rule_document(entry)
            self.write(target, source, preserve=True)
918709
def regulation(self, column=None, value=None, **kwargs):
        
        return self._resolve_call('RAD_REGULATION', column, value, **kwargs)
720890
public function collectRule(Rule $rule): void
    {
        $this->data['rule'] = [
            'id' => $rule->getId(),
        ];

        foreach ($rule->getTargets() as $target) {
            $this->data['rule']['targets'][] = [
                'type' => $target->getTargetType()::getType(),
                'value' => $this->formatVar($target->getValue()),
            ];
        }

        foreach ($rule->getConditions() as $condition) {
            $this->data['rule']['conditions'][] = [
                'type' => $condition->getConditionType()::getType(),
                'value' => $this->formatVar($condition->getValue()),
            ];
        }
    }
416483
public function setRule($rule, $route)
    {
        $this->rule[$route->getDomain()][$rule][$route->getMethod()] = $route;
    }
543040
def relevant_rules_for_match(self, action, subject):
        """"""
        matches = []
        for rule in self.rules:
            rule.expanded_actions = self.expand_actions(rule.actions)
            if rule.is_relevant(action, subject):
                matches.append(rule)

        return self.optimize(matches[::-1])
80445
public void setRules(com.google.api.ads.admanager.axis.v201811.ProgressRule[] rules) {
        this.rules = rules;
    }
814027
def _format_rules_for_eos(self, rules):
        """"""
        in_rules = []
        eg_rules = []
        for rule in rules:
            protocol = rule.get('protocol')
            cidr = rule.get('remote_ip_prefix', 'any')
            min_port = rule.get('port_range_min')
            max_port = rule.get('port_range_max')
            direction = rule.get('direction')
            ethertype = rule.get('ethertype')
            if not self._supported_rule(protocol, ethertype):
                continue
            formatted_rule = self._format_rule(protocol, cidr, min_port,
                                               max_port, direction)
            if rule['direction'] == n_const.INGRESS_DIRECTION:
                in_rules.append(formatted_rule)
            elif rule['direction'] == n_const.EGRESS_DIRECTION:
                eg_rules.append(formatted_rule)
        return in_rules, eg_rules
383849
public function setupRules()
    {
        $this->rules->addMany([
            'number.status'   => new Rule(new RegexMatcher('/^HTTP\/.+\s(\d+)/')),
            'constant.status' => new Rule(new RegexMatcher('/^HTTP\/.+\s+\d+\s+(.+?)\R/')),

            'call.method' => new Rule(new RegexMatcher('/^(\w+).*HTTP\//')),
            'string.path' => new Rule(new RegexMatcher('/^\w+\s(.*?)\sHTTP\//')),

            'symbol.version' => new Rule(new RegexMatcher('/^.*(HTTP\/\S+)/')),

            'symbol.header' => new Rule(new RegexMatcher('/^([\w-]+:)/m')),
        ]);
    }
370656
function processRule(rule) {
    if (typeof rule !== 'function' && typeof rule !== 'string') {
        OBLIGATIONS.precondition(Array.isArray(rule) && rule[0] || rule.name, 'Validator name must be specified.');
    }
    var __result;
    main: {
        if (typeof rule === 'string') {
            __result = exports.create(rule);
            break main;
        } else if (typeof rule === 'function') {
            __result = new exports.Validator({ validate: rule });
            break main;
        } else if (Array.isArray(rule)) {
            __result = exports.create.apply(exports, rule);
            break main;
        } else {
            __result = exports.create(rule.name, rule);
            break main;
        }
    }
    OBLIGATIONS.postcondition(__result instanceof exports.Validator);
    return __result;
}
560347
public void setRules(RuleProvider provider, List<Rule> rules)
    {
        providersToRules.put(provider, rules);
    }
1012954
function(rules) {
      var normalizedRules = {};
      _.each(rules, function(rule) {
        _.each(rule.apiGroups, function(apiGroup) {
          if (!normalizedRules[apiGroup]) {
            normalizedRules[apiGroup] = {};
          }
          _.each(rule.resources, function(resource) {
            normalizedRules[apiGroup][resource] = rule.verbs;
          });
        });
      });
      return normalizedRules;
    }
85117
def list_lbaas_l7rules(self, l7policy, retrieve_all=True, **_params):
        """"""
        return self.list('rules', self.lbaas_l7rules_path % l7policy,
                         retrieve_all, **_params)
64438
function setRuleModel (roles, rule, rules, origRule) {
    // allow/deny is last element of rule
    var allow = rule.pop()
    // blanket rule for all models
    if (rule.length === 0) {
        // create role access rule map
        if (!rules.allow) {
            rules.allow = {}
        }
        // set rule for each role
        _.each(roles, role => {
            rules.allow[role] = allow
        })
        // break
        return
    }

    // model name is first clause of rule
    var model = rule.shift()
    // create map of models
    if (!rules.model) {
        rules.model = {}
    }
    // create entry for model
    if (!rules.model[model]) {
        rules.model[model] = {}
    }

    // blanket rule for single model
    if (rule.length === 0) {
        // create role access rule map
        if (!rules.model[model].allow) {
            rules.model[model].allow = {}
        }
        // set rule for each role
        _.each(roles, role => {
            rules.model[model].allow[role] = allow
        })
        // break
        return
    }

    // action follows model name
    var action = rule.shift()
    // create map of actions
    if (!rules.model[model].action) {
        rules.model[model].action = {}
    }
    // create entry for action
    if (!rules.model[model].action[action]) {
        rules.model[model].action[action] = {}
    }

    // create action does not have any options
    if (action === 'create') {
        // there should be no more rule clauses
        if (rule.length === 0) {
            // create role access rule map
            if (!rules.model[model].action[action].allow) {
                rules.model[model].action[action].allow = {}
            }
            // set rule for each role
            _.each(roles, role => {
                rules.model[model].action[action].allow[role] = allow
            })
            // break
            return
        }
        else {
            throw new Error('invalid rule '+origRule)
        }
    }
    // all other actions apply to existing model instances and can
    // apply either to any instance or to instances owned by session
    else {
        // if there are two rule clauses then next is a state
        if (rule.length === 2) {
            var state = rule.shift()
            // create map of states
            if (!rules.model[model].action[action].state) {
                rules.model[model].action[action].state = {}
            }
            // create entry for state
            if (!rules.model[model].action[action].state[state]) {
                rules.model[model].action[action].state[state] = {}
            }
            // own/any clause follows state
            rules = rules.model[model].action[action].state[state]
        }
        // otherwise own/any clause follows action
        else {
            rules = rules.model[model].action[action]
        }
        // there must be one additional rule clause
        if (rule.length === 1) {
            var scope = rule.shift()
            // scope must be own or any
            assert.ok(scope === 'own' || scope === 'any', 'invalid rule '+origRule)
            // create map for scope
            if (!rules[scope]) {
                rules[scope] = {}
            }
            // create role access rule map
            if (!rules[scope].allow) {
                rules[scope].allow = {}
            }
            // set rule for each role
            _.each(roles, role => {
                rules[scope].allow[role] = allow
            })
        }
        else {
            throw new Error('invalid rule '+origRule)
        }
    }
}
1056108
def enforce(self, rule, target, creds, exc=None, *args, **kwargs):
        """"""

        self.load_rules()

        if isinstance(rule, checks.BaseCheck):
            result = rule(target, creds, self, rule)
        elif not self.rules:
            # No rules means we're going to fail closed.
            result = False
        else:
            try:
                # Evaluate the rule
                result = self.rules[rule](target, creds, self, rule)
            except KeyError:
                LOG.debug('Rule [%s] does not exist', rule)
                # If the rule doesn't exist, fail closed
                result = False

        if self.raise_error and not result:
            if exc:
                raise exc(*args, **kwargs)
            else:
                raise PolicyNotAuthorized(rule, target, creds)

        return result
90492
def _get_guidelines(self):
        
        return tuple([self._getitem__guidelines(i) for
                     i in range(self._len__guidelines())])
984147
public function setRule($rule)
	{
		if(null === $rule)
		{
			$rule = Dispatch::module() . '/' . Dispatch::control() . '/' . Dispatch::action();
		}
		$this->rule = $rule;
	}