本文整理汇总了Python中sequencer.dgm.model.RuleSet.get_rules_graph方法的典型用法代码示例。如果您正苦于以下问题:Python RuleSet.get_rules_graph方法的具体用法?Python RuleSet.get_rules_graph怎么用?Python RuleSet.get_rules_graph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sequencer.dgm.model.RuleSet
的用法示例。
在下文中一共展示了RuleSet.get_rules_graph方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ruleset_field_empty
# 需要导入模块: from sequencer.dgm.model import RuleSet [as 别名]
# 或者: from sequencer.dgm.model.RuleSet import get_rules_graph [as 别名]
def test_ruleset_field_empty(self):
ruleset = RuleSet(set())
self.assertTrue(ruleset.name is None)
self.assertEquals(ruleset.rules, set())
graph = ruleset.get_rules_graph()
self.assertTrue(graph is not None)
self.assertEquals(len(graph.edges()), 0)
self.assertEquals(len(graph.nodes()), 0)
示例2: test_ruleset_field_single
# 需要导入模块: from sequencer.dgm.model import RuleSet [as 别名]
# 或者: from sequencer.dgm.model.RuleSet import get_rules_graph [as 别名]
def test_ruleset_field_single(self):
rules = set()
rules.add(tools.create_rule(self.__class__.__name__,
"ruleset_field_single"))
ruleset = RuleSet(rules)
self.assertEquals(ruleset.name, self.__class__.__name__)
self.assertEquals(ruleset.rules, rules)
graph = ruleset.get_rules_graph()
self.assertTrue(graph is not None)
self.assertEquals(len(graph.edges()), 0)
self.assertEquals(len(graph.nodes()), 1)
self.assertTrue(graph.has_node("ruleset_field_single"))
示例3: test_ruleset_dependencies
# 需要导入模块: from sequencer.dgm.model import RuleSet [as 别名]
# 或者: from sequencer.dgm.model.RuleSet import get_rules_graph [as 别名]
def test_ruleset_dependencies(self):
rules = set()
rules.add(tools.create_rule(self.__class__.__name__,
"ruleset_dependencies"))
rules.add(tools.create_rule(self.__class__.__name__,
"ruleset_dependencies2",
dependson=["ruleset_dependencies"]))
ruleset = RuleSet(rules)
self.assertEquals(ruleset.name, self.__class__.__name__)
self.assertEquals(ruleset.rules, rules)
graph = ruleset.get_rules_graph()
self.assertTrue(graph is not None)
self.assertEquals(len(graph.edges()), 1)
self.assertTrue(graph.has_edge(("ruleset_dependencies2",
"ruleset_dependencies")))
示例4: graphrules
# 需要导入模块: from sequencer.dgm.model import RuleSet [as 别名]
# 或者: from sequencer.dgm.model.RuleSet import get_rules_graph [as 别名]
def graphrules(db, config, args):
"""
This action fetch the rules from the DB sequencer table and call
the DGM stage for the computation of the related graph.
This graph is then given to the user in the DOT format.
"""
usage = "Usage: %prog [global_options] " + GRAPHRULES_ACTION_NAME + \
" [action_options] ruleset"
doc = GRAPHRULES_DOC + \
" The graph is given in DOT format."
parser = optparse.OptionParser(usage, description=doc)
add_options_to(parser, ['--out'], config)
(options, action_args) = parser.parse_args(args)
if len(action_args) != 1:
parser.error(GRAPHRULES_ACTION_NAME + ": ruleSet is missing.")
req_ruleset = action_args[0]
rules = db.get_rules_for(req_ruleset)
ruleset = RuleSet(rules.values())
write_graph_to(ruleset.get_rules_graph(), options.out)