Remove extra type definitions, add todo, use Baseclass over Union[SymbolicCalldata, ConcreteCalldata]

pull/894/head
Nikhil Parasaram 6 years ago
parent b170d74f4f
commit 36fd075836
  1. 2
      mythril/laser/ethereum/strategy/basic.py
  2. 4
      mythril/laser/ethereum/transaction/transaction_models.py
  3. 2
      mythril/laser/smt/bool.py
  4. 5
      mythril/laser/smt/expression.py

@ -14,7 +14,7 @@ except ImportError:
from random import random
from bisect import bisect
# Remove ignore after this has been fixed: https://github.com/python/mypy/issues/1297
# TODO: Remove ignore after this has been fixed: https://github.com/python/mypy/issues/1297
def choices( # type: ignore
population: List, weights: List[int] = None
) -> List[int]:

@ -87,10 +87,10 @@ class BaseTransaction:
if call_data is None and init_call_data:
self.call_data = SymbolicCalldata(
self.id
) # type: Union[SymbolicCalldata, ConcreteCalldata]
) # type: BaseCalldata
else:
self.call_data = (
cast(Union[SymbolicCalldata, ConcreteCalldata], call_data)
call_data
if isinstance(call_data, BaseCalldata)
else ConcreteCalldata(self.id, [])
)

@ -84,7 +84,7 @@ class Bool(Expression[z3.BoolRef]):
def And(*args: Union[Bool, bool]) -> Bool:
"""Create an And expression."""
union = []
args_list = [arg if isinstance(arg, Bool) else Bool(arg) for arg in args] # type: List[Bool]
args_list = [arg if isinstance(arg, Bool) else Bool(arg) for arg in args]
for arg in args_list:
union.append(arg.annotations)
return Bool(z3.And([a.raw for a in args_list]), union)

@ -46,7 +46,10 @@ class Expression(Generic[T]):
return repr(self.raw)
def simplify(expression: T) -> T:
G = TypeVar("G", bound=Expression)
def simplify(expression: G) -> G:
"""Simplify the expression .
:param expression:

Loading…
Cancel
Save