remove unnecessary use of list comprehension

pull/2323/head
Judy Wu 9 months ago
parent 4f4acae1af
commit a99f90b976
  1. 8
      slither/tools/upgradeability/checks/variables_order.py
  2. 8
      slither/utils/upgradeability.py

@ -115,8 +115,8 @@ Avoid variables in the proxy. If a variable is in the proxy, ensure it has the s
def _check(self) -> List[Output]:
contract1 = self._contract1()
contract2 = self._contract2()
order1 = [variable for variable in contract1.stored_state_variables_ordered]
order2 = [variable for variable in contract2.stored_state_variables_ordered]
order1 = contract1.stored_state_variables_ordered
order2 = contract2.stored_state_variables_ordered
results: List[Output] = []
for idx, _ in enumerate(order1):
@ -236,8 +236,8 @@ Avoid variables in the proxy. If a variable is in the proxy, ensure it has the s
def _check(self) -> List[Output]:
contract1 = self._contract1()
contract2 = self._contract2()
order1 = [variable for variable in contract1.stored_state_variables_ordered]
order2 = [variable for variable in contract2.stored_state_variables_ordered]
order1 = contract1.stored_state_variables_ordered
order2 = contract2.stored_state_variables_ordered
results = []

@ -81,8 +81,8 @@ def compare(
tainted-contracts: list[TaintedExternalContract]
"""
order_vars1 = [v for v in v1.stored_state_variables_ordered]
order_vars2 = [v for v in v2.stored_state_variables_ordered]
order_vars1 = v1.stored_state_variables_ordered
order_vars2 = v2.stored_state_variables_ordered
func_sigs1 = [function.solidity_signature for function in v1.functions]
func_sigs2 = [function.solidity_signature for function in v2.functions]
@ -300,8 +300,8 @@ def get_missing_vars(v1: Contract, v2: Contract) -> List[StateVariable]:
List of StateVariables from v1 missing in v2
"""
results = []
order_vars1 = [v for v in v1.stored_state_variables_ordered]
order_vars2 = [v for v in v2.stored_state_variables_ordered]
order_vars1 = v1.stored_state_variables_ordered
order_vars2 = v2.stored_state_variables_ordered
if len(order_vars2) < len(order_vars1):
for variable in order_vars1:
if variable.name not in [v.name for v in order_vars2]:

Loading…
Cancel
Save