apply style rules

pull/984/head
Joran Honig 6 years ago
parent 83891a379b
commit d239b60e38
  1. 10
      mythril/laser/ethereum/plugins/implementations/coverage.py
  2. 4
      mythril/laser/ethereum/plugins/plugin_factory.py

@ -34,7 +34,11 @@ class InstructionCoveragePlugin(LaserPlugin):
for code, code_cov in coverage.items(): for code, code_cov in coverage.items():
cov_percentage = sum(code_cov[1]) / float(code_cov[0]) * 100 cov_percentage = sum(code_cov[1]) / float(code_cov[0]) * 100
log.info("Achieved {:.2f}% coverage for code: {}".format(cov_percentage, code)) log.info(
"Achieved {:.2f}% coverage for code: {}".format(
cov_percentage, code
)
)
@symbolic_vm.laser_hook("execute_state") @symbolic_vm.laser_hook("execute_state")
def execute_state_hook(global_state: GlobalState): def execute_state_hook(global_state: GlobalState):
@ -42,7 +46,9 @@ class InstructionCoveragePlugin(LaserPlugin):
code = global_state.environment.code.bytecode code = global_state.environment.code.bytecode
if code not in coverage.keys(): if code not in coverage.keys():
number_of_instructions = len(global_state.environment.code.instruction_list) number_of_instructions = len(
global_state.environment.code.instruction_list
)
coverage[code] = ( coverage[code] = (
number_of_instructions, number_of_instructions,
[False] * number_of_instructions, [False] * number_of_instructions,

@ -3,7 +3,9 @@ from mythril.laser.ethereum.plugins.implementations.benchmark import BenchmarkPl
from mythril.laser.ethereum.plugins.implementations.mutation_pruner import ( from mythril.laser.ethereum.plugins.implementations.mutation_pruner import (
MutationPruner, MutationPruner,
) )
from mythril.laser.ethereum.plugins.implementations.coverage import InstructionCoveragePlugin from mythril.laser.ethereum.plugins.implementations.coverage import (
InstructionCoveragePlugin,
)
class PluginFactory: class PluginFactory:

Loading…
Cancel
Save