예제 #1
0
def write_mask_rule(fp, media, rule):
    prefix = media + ':'
    rule_func = getRule(rule,
                        globals=globals(),
                        default_module='maskgen.mask_rules')
    fp.write('*%s%s*: %s\n\n' %
             (prefix, rule,
              get_function_doc(rule_func) if rule_func is not None else 'NA'))
예제 #2
0
def write_graph_rule(fp, rule):
    if rule.startswith('donor:'):
        prefix = '[DONOR]:'
        rule = rule[6:]
    else:
        prefix = ''
    rule_func = getRule(rule,
                        globals=globals(),
                        default_module='maskgen.graph_rules')
    fp.write('*%s%s*: %s\n\n' %
             (prefix, rule,
              get_function_doc(rule_func) if rule_func is not None else 'NA'))
예제 #3
0
 def set_rules(self, op, ruleNames):
     strippedRuleNames = [
         r[r.find(':') + 1:] for r in ruleNames if len(r) > 0
     ]
     designations = [r[:r.find(':')] for r in ruleNames if len(r) > 0]
     rules = [
         getRule(name,
                 globals=globals(),
                 default_module='maskgen.graph_rules')
         for name in strippedRuleNames
     ]
     self.rules[op] = [rule for rule in rules if rule is not None]
     self.edge_mod_rules[op] = [
         rules[i] for i in range(len(rules))
         if rules[i] is not None and designations[i] != 'donor'
     ]
예제 #4
0
def write_analysis(fp, rule):
    rule_func = getRule(rule, globals=globals())
    fp.write(
        '*%s*: %s\n' %
        (rule, get_function_doc(rule_func) if rule_func is not None else 'NA'))