This commit is contained in:
Marcell Vazquez-Chanlatte 2018-09-18 23:19:58 -07:00
parent 25dfee86b0
commit 1b18efadfa
7 changed files with 7 additions and 15 deletions

View file

@ -1,11 +1,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from collections import deque, namedtuple from collections import deque
from functools import lru_cache
from typing import Union, NamedTuple from typing import Union, NamedTuple
import attr import attr
import funcy as fn import funcy as fn
from lenses import lens, bind from lenses import bind
import mtl import mtl
@ -90,7 +89,7 @@ def _set_symbols(node, val):
return val.get(node.id, node) return val.get(node.id, node)
elif hasattr(node, 'args'): elif hasattr(node, 'args'):
return node.evolve(args=children) return node.evolve(args=children)
elif hasattr(node, 'arg'): elif hasattr(node, 'arg'):
return node.evolve(arg=children[0]) return node.evolve(arg=children[0])
return node return node
@ -129,8 +128,6 @@ def ast_class(cls):
if not hasattr(cls, "children"): if not hasattr(cls, "children"):
cls.children = property(lambda _: ()) cls.children = property(lambda _: ())
return attr.s(frozen=True, auto_attribs=True, repr=False, slots=True)(cls) return attr.s(frozen=True, auto_attribs=True, repr=False, slots=True)(cls)

View file

@ -20,8 +20,6 @@ def negate_trace(x):
def pointwise_sat(phi, dt=0.1): def pointwise_sat(phi, dt=0.1):
ap_names = [z.id for z in phi.atomic_predicates]
def _eval_mtl(x, t=0): def _eval_mtl(x, t=0):
return bool(eval_mtl(phi, dt)(x)[t]) return bool(eval_mtl(phi, dt)(x)[t])

View file

@ -1,5 +1,4 @@
import mtl import mtl
from mtl.hypothesis import MetricTemporalLogicStrategy
import hypothesis.strategies as st import hypothesis.strategies as st
from hypothesis import given from hypothesis import given
@ -13,4 +12,3 @@ def test_params1(a, b, c):
phi2 = phi[{'a': a, 'b': b}] phi2 = phi[{'a': a, 'b': b}]
assert phi2.params == set() assert phi2.params == set()
assert phi2 == mtl.parse(f'G[{a}, {b}](x)') assert phi2 == mtl.parse(f'G[{a}, {b}](x)')

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from hypothesis import event, given from hypothesis import given
from traces import TimeSeries from traces import TimeSeries
import mtl import mtl
@ -19,7 +19,7 @@ TS = {
def test_stablizing_repr(phi): def test_stablizing_repr(phi):
for _ in range(10): for _ in range(10):
phi, phi2 = mtl.parse(str(phi)), phi phi, phi2 = mtl.parse(str(phi)), phi
assert phi == phi2 assert phi == phi2

View file

@ -2,7 +2,6 @@ import mtl
from mtl.hypothesis import MetricTemporalLogicStrategy from mtl.hypothesis import MetricTemporalLogicStrategy
from hypothesis import given from hypothesis import given
from pytest import raises
CONTEXT = { CONTEXT = {
'ap1': mtl.parse('x'), 'ap1': mtl.parse('x'),
@ -13,6 +12,7 @@ CONTEXT = {
} }
APS = set(CONTEXT.keys()) APS = set(CONTEXT.keys())
def test_inline_context_rigid(): def test_inline_context_rigid():
phi = mtl.parse('G ap1') phi = mtl.parse('G ap1')
assert phi[CONTEXT] == mtl.parse('G x') assert phi[CONTEXT] == mtl.parse('G x')

View file

@ -4,7 +4,6 @@ from math import isfinite
import traces import traces
import numpy as np import numpy as np
from lenses import bind
import mtl.ast import mtl.ast
from mtl.ast import (And, F, G, Interval, Neg, Or, Next, Until, from mtl.ast import (And, F, G, Interval, Neg, Or, Next, Until,

View file

@ -1,11 +1,11 @@
-e git://github.com/mvcisback/hypothesis-cfg@master#egg=hypothesis-cfg -e git://github.com/mvcisback/hypothesis-cfg@master#egg=hypothesis-cfg
-e git://github.com/mvcisback/multidim-threshold@master#egg=multidim-threshold
bitarray==0.8.1 bitarray==0.8.1
funcy==1.9.1 funcy==1.9.1
lenses==0.4.0 lenses==0.4.0
parsimonious==0.7.0 parsimonious==0.7.0
traces==0.3.1 traces==0.3.1
hypothesis==3.32.1 hypothesis==3.32.1
numpy==1.15.0
pytest==3.2.3 pytest==3.2.3
pytest-bpdb==0.1.4 pytest-bpdb==0.1.4