From 1b18efadfab9f2225a57a7a4784438163a52af34 Mon Sep 17 00:00:00 2001 From: Marcell Vazquez-Chanlatte Date: Tue, 18 Sep 2018 23:19:58 -0700 Subject: [PATCH] flake8 --- mtl/ast.py | 9 +++------ mtl/boolean_eval.py | 2 -- mtl/test_params.py | 2 -- mtl/test_parser.py | 4 ++-- mtl/test_utils.py | 2 +- mtl/utils.py | 1 - requirements.txt | 2 +- 7 files changed, 7 insertions(+), 15 deletions(-) diff --git a/mtl/ast.py b/mtl/ast.py index 86514fe..57eb39a 100644 --- a/mtl/ast.py +++ b/mtl/ast.py @@ -1,11 +1,10 @@ # -*- coding: utf-8 -*- -from collections import deque, namedtuple -from functools import lru_cache +from collections import deque from typing import Union, NamedTuple import attr import funcy as fn -from lenses import lens, bind +from lenses import bind import mtl @@ -90,7 +89,7 @@ def _set_symbols(node, val): return val.get(node.id, node) elif hasattr(node, 'args'): return node.evolve(args=children) - elif hasattr(node, 'arg'): + elif hasattr(node, 'arg'): return node.evolve(arg=children[0]) return node @@ -129,8 +128,6 @@ def ast_class(cls): if not hasattr(cls, "children"): cls.children = property(lambda _: ()) - - return attr.s(frozen=True, auto_attribs=True, repr=False, slots=True)(cls) diff --git a/mtl/boolean_eval.py b/mtl/boolean_eval.py index 8157452..c51e392 100644 --- a/mtl/boolean_eval.py +++ b/mtl/boolean_eval.py @@ -20,8 +20,6 @@ def negate_trace(x): def pointwise_sat(phi, dt=0.1): - ap_names = [z.id for z in phi.atomic_predicates] - def _eval_mtl(x, t=0): return bool(eval_mtl(phi, dt)(x)[t]) diff --git a/mtl/test_params.py b/mtl/test_params.py index d2ecad0..c53cfa2 100644 --- a/mtl/test_params.py +++ b/mtl/test_params.py @@ -1,5 +1,4 @@ import mtl -from mtl.hypothesis import MetricTemporalLogicStrategy import hypothesis.strategies as st from hypothesis import given @@ -13,4 +12,3 @@ def test_params1(a, b, c): phi2 = phi[{'a': a, 'b': b}] assert phi2.params == set() assert phi2 == mtl.parse(f'G[{a}, {b}](x)') - diff --git a/mtl/test_parser.py b/mtl/test_parser.py index fb85fb8..821d536 100644 --- a/mtl/test_parser.py +++ b/mtl/test_parser.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from hypothesis import event, given +from hypothesis import given from traces import TimeSeries import mtl @@ -19,7 +19,7 @@ TS = { def test_stablizing_repr(phi): for _ in range(10): phi, phi2 = mtl.parse(str(phi)), phi - + assert phi == phi2 diff --git a/mtl/test_utils.py b/mtl/test_utils.py index 7764746..dc7ed80 100644 --- a/mtl/test_utils.py +++ b/mtl/test_utils.py @@ -2,7 +2,6 @@ import mtl from mtl.hypothesis import MetricTemporalLogicStrategy from hypothesis import given -from pytest import raises CONTEXT = { 'ap1': mtl.parse('x'), @@ -13,6 +12,7 @@ CONTEXT = { } APS = set(CONTEXT.keys()) + def test_inline_context_rigid(): phi = mtl.parse('G ap1') assert phi[CONTEXT] == mtl.parse('G x') diff --git a/mtl/utils.py b/mtl/utils.py index 2660721..383b4ca 100644 --- a/mtl/utils.py +++ b/mtl/utils.py @@ -4,7 +4,6 @@ from math import isfinite import traces import numpy as np -from lenses import bind import mtl.ast from mtl.ast import (And, F, G, Interval, Neg, Or, Next, Until, diff --git a/requirements.txt b/requirements.txt index 8117d2d..6a40619 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,11 @@ -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 funcy==1.9.1 lenses==0.4.0 parsimonious==0.7.0 traces==0.3.1 hypothesis==3.32.1 +numpy==1.15.0 pytest==3.2.3 pytest-bpdb==0.1.4