From 4c54197fe2a56d11835b5e26757a40f485819cde Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Wed, 12 Sep 2018 14:51:55 -0400 Subject: [PATCH 1/2] added mypy to .travis.yml --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5e3cfe56..58af5e26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,12 @@ python: - '3.5' - '3.6' install: +- pip install mypy - pip install coveralls - pip install pycodestyle - pip install --upgrade . script: +- mypy --ignore-missing-imports houston - pycodestyle houston - pytest test - coverage run --source=houston setup.py test From a8b17190ec990d01374dbd2b2e5cde4a78ad1545 Mon Sep 17 00:00:00 2001 From: ChrisTimperley Date: Wed, 12 Sep 2018 14:56:44 -0400 Subject: [PATCH 2/2] fixed type issues in predicate module --- houston/predicate.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/houston/predicate.py b/houston/predicate.py index 575a8ea7..84c789b0 100644 --- a/houston/predicate.py +++ b/houston/predicate.py @@ -1,9 +1,13 @@ -__all__ = ['Predicate'] +__all__ = ['Predicate', 'Invariant', 'Postcondition', 'Precondition'] from typing import Callable import attr +from .action import Action +from .state import State +from .environment import Environment + @attr.s(frozen=True) class Predicate(object): @@ -13,13 +17,13 @@ class Predicate(object): of purposes. """ name = attr.ib(type=str) - predicate = attr.ib(type=Callable[['Action', 'State', 'Environment'], + predicate = attr.ib(type=Callable[[Action, State, Environment], bool]) def check(self, - action: 'Action', - state: 'State', - environment: 'Environment' + action: Action, + state: State, + environment: Environment ) -> bool: """ Determines whether this predicate is satisfied by a given action,