Skip to content

Commit

Permalink
Fix web3 lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
e3243eric committed Feb 28, 2023
1 parent e6c86a4 commit 91e530e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ commands=
flake8 {toxinidir}/web3 {toxinidir}/ens {toxinidir}/ethpm {toxinidir}/tests --exclude {toxinidir}/ethpm/ethpm-spec,{toxinidir}/**/*_pb2.py
black {toxinidir}/ens {toxinidir}/ethpm {toxinidir}/web3 {toxinidir}/tests {toxinidir}/setup.py --exclude /ethpm/ethpm-spec/|/ethpm/_utils/protobuf/ipfs_file_pb2\.py --check
isort --check-only --diff {toxinidir}/web3/ {toxinidir}/ens/ {toxinidir}/ethpm/ {toxinidir}/tests/
mypy -p web3 -p ethpm -p ens --config-file {toxinidir}/mypy.ini
mypy -p web3 -p ethpm -p ens --enable-incomplete-feature Unpack --config-file {toxinidir}/mypy.ini

[testenv:lint]
basepython: python
Expand Down
8 changes: 4 additions & 4 deletions web3/_utils/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def construct_event_topic_set(
for arg, arg_options in zipped_abi_and_args
]

topics = list(normalize_topic_list([event_topic] + encoded_args)) # type: ignore
topics = list(normalize_topic_list([event_topic] + encoded_args))
return topics


Expand Down Expand Up @@ -394,12 +394,12 @@ def address(self, value: ChecksumAddress) -> None:
def ordered_args(self) -> Tuple[Any, ...]:
return tuple(map(self.args.__getitem__, self._ordered_arg_names))

@property # type: ignore
@property
@to_tuple
def indexed_args(self) -> Tuple[Any, ...]:
return tuple(filter(is_indexed, self.ordered_args))

@property # type: ignore
@property
@to_tuple
def data_args(self) -> Tuple[Any, ...]:
return tuple(filter(is_not_indexed, self.ordered_args))
Expand Down Expand Up @@ -432,7 +432,7 @@ def deploy(self, w3: "Web3") -> "LogFilter":
if not isinstance(w3, web3.Web3):
raise ValueError(f"Invalid web3 argument: got: {w3!r}")

for arg in AttributeDict.values(self.args):
for arg in self.args.values():
arg._immutable = True
self._immutable = True

Expand Down
8 changes: 4 additions & 4 deletions web3/_utils/module_testing/eth_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -2670,7 +2670,7 @@ def test_eth_modify_transaction_legacy(
txn_hash = w3.eth.send_transaction(txn_params)

modified_txn_hash = w3.eth.modify_transaction(
txn_hash, gasPrice=(cast(int, txn_params["gasPrice"]) * 2), value=2
txn_hash, gasPrice=(cast(Wei, txn_params["gasPrice"] * 2)), value=Wei(2)
)
modified_txn = w3.eth.get_transaction(modified_txn_hash)

Expand Down Expand Up @@ -2699,9 +2699,9 @@ def test_eth_modify_transaction(

modified_txn_hash = w3.eth.modify_transaction(
txn_hash,
value=2,
maxPriorityFeePerGas=(cast(Wei, txn_params["maxPriorityFeePerGas"]) * 2),
maxFeePerGas=(cast(Wei, txn_params["maxFeePerGas"]) * 2),
value=Wei(2),
maxPriorityFeePerGas=(cast(Wei, txn_params["maxPriorityFeePerGas"] * 2)),
maxFeePerGas=(cast(Wei, txn_params["maxFeePerGas"] * 2)),
)
modified_txn = w3.eth.get_transaction(modified_txn_hash)

Expand Down
2 changes: 1 addition & 1 deletion web3/_utils/module_testing/web3_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def test_solidity_keccak(
expected: HexBytes,
) -> None:
if isinstance(expected, type) and issubclass(expected, Exception):
with pytest.raises(expected): # type: ignore
with pytest.raises(expected):
w3.solidity_keccak(types, values)
return

Expand Down
4 changes: 1 addition & 3 deletions web3/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,7 @@ def is_encodable(self, _type: TypeStr, value: Any) -> bool:
@property
def pm(self) -> "PM":
if hasattr(self, "_pm"):
# ignored b/c property is dynamically set
# via enable_unstable_package_management_api
return self._pm # type: ignore
return self._pm
else:
raise AttributeError(
"The Package Management feature is disabled by default until "
Expand Down

0 comments on commit 91e530e

Please sign in to comment.