Fix typehints after the mypy merge

pull/906/head
Nikhil Parasaram 6 years ago
parent 18d5c0bf7f
commit e006b2ee73
  1. 4
      mythril/mythril/mythril_analyzer.py
  2. 22
      mythril/mythril/mythril_config.py

@ -16,7 +16,7 @@ from mythril.analysis.symbolic import SymExecWrapper
from mythril.analysis.callgraph import generate_graph
from mythril.analysis.traceexplore import get_serializable_statespace
from mythril.analysis.security import fire_lasers, retrieve_callback_issues
from mythril.analysis.report import Report
from mythril.analysis.report import Report, Issue
from mythril.ethereum.evmcontract import EVMContract
log = logging.getLogger(__name__)
@ -154,7 +154,7 @@ class MythrilAnalyzer:
:param enable_iprof: Enables/disables instruction profiler
:return: The Report class which contains the all the issues/vulnerabilities
"""
all_issues = []
all_issues = [] # type: List[Issue]
for contract in contracts or self.contracts:
try:
sym = SymExecWrapper(

@ -64,7 +64,8 @@ class MythrilConfig:
open(self.config_path, "a").close()
config = ConfigParser(allow_no_value=True)
config.optionxform = str
# TODO: Remove this after this issue https://github.com/python/mypy/issues/2427 is closed
config.optionxform = str # type:ignore
config.read(self.config_path, "utf-8")
if "defaults" not in config.sections():
self._add_default_options(config)
@ -120,12 +121,13 @@ class MythrilConfig:
:param leveldb_fallback_dir: The leveldb dir to use by default for searches
:return: None
"""
config.set("defaults", "#Default chaindata locations:")
config.set("defaults", "#– Mac: ~/Library/Ethereum/geth/chaindata")
config.set("defaults", "#– Linux: ~/.ethereum/geth/chaindata")
config.set("defaults", "#Default chaindata locations:", None)
config.set("defaults", "#– Mac: ~/Library/Ethereum/geth/chaindata", None)
config.set("defaults", "#– Linux: ~/.ethereum/geth/chaindata", None)
config.set(
"defaults",
"#– Windows: %USERPROFILE%\\AppData\\Roaming\\Ethereum\\geth\\chaindata",
None,
)
config.set("defaults", "leveldb_dir", leveldb_fallback_dir)
@ -136,14 +138,19 @@ class MythrilConfig:
:param config: The config file object
:return: None
"""
config.set("defaults", "#– To connect to Infura use dynamic_loading: infura")
config.set(
"defaults", "#– To connect to Infura use dynamic_loading: infura", None
)
config.set(
"defaults",
"#– To connect to Rpc use "
"dynamic_loading: HOST:PORT / ganache / infura-[network_name]",
None,
)
config.set(
"defaults", "#– To connect to local host use dynamic_loading: localhost"
"defaults",
"#– To connect to local host use dynamic_loading: localhost",
None,
)
config.set("defaults", "dynamic_loading", "infura")
@ -190,7 +197,8 @@ class MythrilConfig:
def set_api_from_config_path(self) -> None:
"""Set the RPC mode based on a given config file."""
config = ConfigParser(allow_no_value=False)
config.optionxform = str
# TODO: Remove this after this issue https://github.com/python/mypy/issues/2427 is closed
config.optionxform = str # type:ignore
config.read(self.config_path, "utf-8")
if config.has_option("defaults", "dynamic_loading"):
dynamic_loading = config.get("defaults", "dynamic_loading")

Loading…
Cancel
Save