python: change postprocess to take an optional formula

Doing so also work around some differences between Swig 3.0.2 and 3.0.7
observed on our build farm.

* wrap/python/spot.py: Here.
* wrap/python/spot_impl.i: Recognize None as a null formula
on input.
This commit is contained in:
Alexandre Duret-Lutz 2015-10-23 19:01:02 +02:00
parent 84f9be9e8e
commit 337925c94a
2 changed files with 24 additions and 2 deletions

View file

@ -588,7 +588,7 @@ def translate(formula, *args):
formula.translate = translate
def postprocess(automaton, *args):
def postprocess(automaton, *args, formula=None):
"""Post process an automaton.
This applies a number of simlification algorithms, depending on
@ -607,12 +607,16 @@ def postprocess(automaton, *args):
(or 'SBAcc' for short)
The default corresponds to 'generic', 'small' and 'high'.
If a formula denoted by this automaton is known, pass it to as the
optional `formula` argument; it can help some algorithms by
providing an easy way to complement the automaton.
"""
p = postprocessor()
if type(automaton) == str:
automaton = globals()['automaton'](automaton)
_postproc_translate_options(p, postprocessor.Generic, *args)
return p.run(automaton)
return p.run(automaton, formula)
twa.postprocess = postprocess