python: allow spot.formula(spot.formula(...))

* python/spot/__init__.py: Recognize if the input is already a
formula.
* tests/python/formulas.ipynb: Test this.
This commit is contained in:
Alexandre Duret-Lutz 2017-12-22 17:18:36 +01:00
parent 3b4335d243
commit 31ccab026b
2 changed files with 71 additions and 38 deletions

View file

@ -166,7 +166,10 @@ class twa:
class formula:
def __init__(self, str):
"""Parse the given string to create a formula."""
self.this = parse_formula(str)
if type(str) == formula:
self.this = str
else:
self.this = parse_formula(str)
def show_ast(self):
"""Display the syntax tree of the formula."""