flake8 fixes + unregister LinEq in boolean eval

This commit is contained in:
Marcell Vazquez-Chanlatte 2018-09-06 01:28:19 -07:00
parent d2cd678018
commit 5fd66cfd2c
4 changed files with 3 additions and 17 deletions

View file

@ -177,16 +177,6 @@ def eval_stl_ap(phi, _):
return _eval return _eval
@eval_stl.register(stl.LinEq)
def eval_stl_lineq(phi, _):
def _eval(x):
out = x[phi]
out.compact()
return out
return _eval
@eval_stl.register(type(stl.TOP)) @eval_stl.register(type(stl.TOP))
def eval_stl_top(_, _1): def eval_stl_top(_, _1):
return lambda *_: TRUE_TRACE return lambda *_: TRUE_TRACE

View file

@ -1,15 +1,14 @@
import operator as op
from functools import reduce, singledispatch from functools import reduce, singledispatch
from operator import and_, or_ from operator import and_, or_
import funcy as fn import funcy as fn
from bitarray import bitarray from bitarray import bitarray
from lenses import bind
import stl.ast import stl.ast
oo = float('inf') oo = float('inf')
def get_times(x, tau, lo, hi): def get_times(x, tau, lo, hi):
end = min(v.domain.end() for v in x.values()) end = min(v.domain.end() for v in x.values())

View file

@ -1,11 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# TODO: allow multiplication to be distributive
# TODO: support variables on both sides of ineq
import operator as op import operator as op
from functools import partialmethod, reduce from functools import partialmethod, reduce
from lenses import bind
from parsimonious import Grammar, NodeVisitor from parsimonious import Grammar, NodeVisitor
from stl import ast from stl import ast
from stl.utils import iff, implies, xor, timed_until from stl.utils import iff, implies, xor, timed_until

View file

@ -24,6 +24,7 @@ def test_identities(phi):
assert (phi | phi) | phi == phi | (phi | phi) assert (phi | phi) | phi == phi | (phi | phi)
assert ~~phi == phi assert ~~phi == phi
def test_walk(): def test_walk():
phi = stl.parse( phi = stl.parse(
'(([ ][0, 1] ap1 & < >[1,2] ap2) | (@ap1 U ap2))') '(([ ][0, 1] ap1 & < >[1,2] ap2) | (@ap1 U ap2))')