def _priority_class_from_spec(spec): if spec['template'] not in PRIORITY_CLASS_MAP.keys(): raise InvalidRuleException("Unknown template: %s" % (spec['kind'])) pc = PRIORITY_CLASS_MAP[spec['template']] if spec['scope'] == 'device': pc += len(PRIORITY_CLASS_MAP) return pc
def _priority_class_from_spec(spec): if spec['template'] not in PRIORITY_CLASS_MAP.keys(): raise InvalidRuleException("Unknown template: %s" % (spec['template'])) pc = PRIORITY_CLASS_MAP[spec['template']] return pc
def _add_empty_priority_class_arrays(d): for pc in PRIORITY_CLASS_MAP.keys(): d[pc] = [] return d
def _add_empty_priority_class_arrays(d: Dict[str, list]) -> Dict[str, list]: for pc in PRIORITY_CLASS_MAP.keys(): d[pc] = [] return d
def _priority_class_from_spec(spec: RuleSpec) -> int: if spec.template not in PRIORITY_CLASS_MAP.keys(): raise InvalidRuleException("Unknown template: %s" % (spec.template)) pc = PRIORITY_CLASS_MAP[spec.template] return pc