Python voluptuous.Extra() Examples
The following are 1
code examples of voluptuous.Extra().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
voluptuous
, or try the search function
.
Example #1
Source File: policy.py From nmeta with Apache License 2.0 | 5 votes |
def __init__(self, tc_rules, policy, policy_snippet): """ Initialise the TCCondition Class Passed a TCRules class instance, a Policy class instance and a snippet of tc policy for a condition """ self.policy = policy self.logger = policy.logger self.yaml = policy_snippet self.classifiers = [] #*** Check the correctness of the tc condition: validate(self.logger, self.yaml, TC_CONDITION_SCHEMA, 'tc_rule_condition') for classifier in self.yaml['classifiers_list']: #*** Validate classifier: validate(self.logger, classifier, TC_CLASSIFIER_SCHEMA, 'tc_classifier') #*** Extra validation for location_src: policy_attr = next(iter(classifier)) policy_value = classifier[policy_attr] if policy_attr == 'location_src': validate_location(self.logger, policy_value, policy) self.classifiers.append(classifier) #*** Accumulate deduplicated custom classifier names: if 'custom' in classifier: custlist = tc_rules.custom_classifiers if classifier['custom'] not in custlist: custlist.append(classifier['custom']) self.match_type = self.yaml['match_type']