add missing type hints to independence solver

pull/902/head
Joran Honig 6 years ago
parent 94ea7831c6
commit 50a6080e78
  1. 10
      mythril/laser/smt/independence_solver.py
  2. 4
      mythril/laser/smt/solver.py

@ -2,7 +2,7 @@ import z3
from mythril.laser.smt.model import Model
from mythril.laser.smt.bool import Bool
from typing import Set, List, Dict, Union
from typing import Set, List, Dict, Union, cast
def _get_expr_variables(expression: z3.ExprRef) -> List[z3.ExprRef]:
@ -68,8 +68,8 @@ class DependenceMap:
def _merge_buckets(self, bucket_list: Set[DependenceBucket]) -> DependenceBucket:
""" Merges the buckets in bucket list """
variables = []
conditions = []
variables = [] # type: List[str]
conditions = [] # type: List[z3.BoolRef]
for bucket in bucket_list:
self.buckets.remove(bucket)
variables += bucket.variables
@ -103,7 +103,7 @@ class IndependenceSolver:
:param constraints: constraints to add
"""
constraints = [c.raw for c in constraints]
constraints = [c.raw for c in cast(List[Bool], constraints)]
self.constraints.extend(constraints)
def append(self, *constraints: List[Bool]) -> None:
@ -111,7 +111,7 @@ class IndependenceSolver:
:param constraints: constraints to add
"""
constraints = [c.raw for c in constraints]
constraints = [c.raw for c in cast(List[Bool], constraints)]
self.constraints.extend(constraints)
def check(self) -> z3.CheckSatResult:

@ -29,7 +29,9 @@ class BaseSolver(Generic[T]):
:param constraints:
:return:
"""
z3_constraints = [c.raw for c in cast(List[Bool], constraints)] # type: Sequence[z3.BoolRef]
z3_constraints = [
c.raw for c in cast(List[Bool], constraints)
] # type: Sequence[z3.BoolRef]
self.raw.add(z3_constraints)
def append(self, *constraints: List[Bool]) -> None:

Loading…
Cancel
Save