Пример #1
0
 def __pnmlload__ (cls, tree) :
     """
     >>> t = Action('a', True, [Value(1), Variable('x')]).__pnmldump__()
     >>> Action.__pnmlload__(t)
     Action('a', True, [Value(1), Variable('x')])
     """
     params = [Tree.to_obj(child) for child in tree.children]
     return cls(tree["name"], tree["send"] == "True", params)
Пример #2
0
 def __pnmlload__(cls, tree):
     """
     >>> t = Action('a', True, [Value(1), Variable('x')]).__pnmldump__()
     >>> Action.__pnmlload__(t)
     Action('a', True, [Value(1), Variable('x')])
     """
     params = [Tree.to_obj(child) for child in tree.children]
     return cls(tree["name"], tree["send"] == "True", params)
Пример #3
0
 def __pnmlload__ (cls, tree) :
     """
     >>> m = MultiAction([Action('a', True, [Variable('x')]),
     ...                  Action('b', False, [Variable('y'), Value(2)])])
     >>> t = Transition('t', actions=m).__pnmldump__()
     >>> Transition.__pnmlload__(t).actions
     MultiAction([Action('a', True, [Variable('x')]),
                  Action('b', False, [Variable('y'), Value(2)])])
     """
     result = new_instance(cls, module.Transition.__pnmlload__(tree))
     result.actions = Tree.to_obj(tree.child(MultiAction.__pnmltag__))
     return result
Пример #4
0
 def __pnmlload__(cls, tree):
     """
     >>> m = MultiAction([Action('a', True, [Variable('x')]),
     ...                  Action('b', False, [Variable('y'), Value(2)])])
     >>> t = Transition('t', actions=m).__pnmldump__()
     >>> Transition.__pnmlload__(t).actions
     MultiAction([Action('a', True, [Variable('x')]),
                  Action('b', False, [Variable('y'), Value(2)])])
     """
     result = new_instance(cls, module.Transition.__pnmlload__(tree))
     result.actions = Tree.to_obj(tree.child(MultiAction.__pnmltag__))
     return result