python: better bindings for testing automata
* src/taalgos/dotty.cc, src/taalgos/dotty.hh: Add an interface similar to that of tgba/dotty.hh, even if we have to ignore most options. * src/taalgos/tgba2ta.cc, src/taalgos/tgba2ta.hh: Add an option to display the intermediate automaton with explicit stuttering transitions, for the purpose of making demonstrations. * src/tgba/tgbagraph.hh: Tweak the file so that SWIG can read it. * wrap/python/spot.py: Add wrappers for testing automata. * wrap/python/spot_impl.i: Fix support for atomic_prop_collect_as_bdd, and include a few more files. * wrap/python/tests/testingaut.ipynb: New file. * wrap/python/tests/Makefile.am: Add it.
This commit is contained in:
parent
7bb183b929
commit
16204e8e61
9 changed files with 796 additions and 31 deletions
|
|
@ -46,6 +46,7 @@ def _render_automaton_as_svg(a, opt=None):
|
|||
return _ostream_to_svg(ostr)
|
||||
|
||||
tgba._repr_svg_ = _render_automaton_as_svg
|
||||
ta._repr_svg_ = _render_automaton_as_svg
|
||||
|
||||
def _render_formula_as_svg(a):
|
||||
# Load the SVG function only if we need it. This way the bindings
|
||||
|
|
@ -56,13 +57,14 @@ def _render_formula_as_svg(a):
|
|||
dotty(ostr, a)
|
||||
return SVG(_ostream_to_svg(ostr))
|
||||
|
||||
def _render_tgba_as_svg(a, opt=None):
|
||||
def _return_automaton_as_svg(a, opt=None):
|
||||
# Load the SVG function only if we need it. This way the bindings
|
||||
# can still be used outside of IPython if IPython is not
|
||||
# installed.
|
||||
from IPython.display import SVG
|
||||
return SVG(_render_automaton_as_svg(a, opt))
|
||||
tgba.show = _render_tgba_as_svg
|
||||
tgba.show = _return_automaton_as_svg
|
||||
ta.show = _return_automaton_as_svg
|
||||
|
||||
def _formula_str_ctor(self, str):
|
||||
self.this = parse_formula(str)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue