Skip to content

Commit

Permalink
Some flake8 - still more to do
Browse files Browse the repository at this point in the history
  • Loading branch information
kclowes committed Jul 1, 2022
1 parent 884c38b commit abd1e6b
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 75 deletions.
54 changes: 27 additions & 27 deletions tests/core/contracts/conftest.py

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions tests/core/contracts/test_contract_call_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
)

MULTIPLE_FUNCTIONS = json.loads(
'[{"constant":false,"inputs":[],"name":"a","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"","type":"bytes32"}],"name":"a","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"a","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint8"}],"name":"a","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"","type":"int8"}],"name":"a","outputs":[],"type":"function"}]'
) # noqa: E501
'[{"constant":false,"inputs":[],"name":"a","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"","type":"bytes32"}],"name":"a","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"a","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"","type":"uint8"}],"name":"a","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"","type":"int8"}],"name":"a","outputs":[],"type":"function"}]' # noqa: E501
)


@pytest.fixture(params=[b"\x04\x06", "0x0406", "0406"])
Expand Down Expand Up @@ -364,16 +364,16 @@ def test_call_read_bytes32_variable(bytes32_contract, call):
result = call(contract=bytes32_contract, contract_function="constValue")
assert (
result
== b"\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23"
) # noqa
== b"\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23" # noqa: E501
)


def test_call_get_bytes32_value(bytes32_contract, call):
result = call(contract=bytes32_contract, contract_function="getValue")
assert (
result
== b"\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06"
) # noqa
== b"\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06" # noqa: E501
)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -1164,8 +1164,8 @@ async def test_async_call_read_bytes32_variable(async_bytes32_contract, async_ca
)
assert (
result
== b"\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23"
) # noqa
== b"\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23\x01\x23" # noqa: E501
)


@pytest.mark.asyncio
Expand All @@ -1175,8 +1175,8 @@ async def test_async_call_get_bytes32_value(async_bytes32_contract, async_call):
)
assert (
result
== b"\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06"
) # noqa
== b"\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06\x04\x06" # noqa: E501
)


@pytest.mark.asyncio
Expand Down
8 changes: 4 additions & 4 deletions tests/core/contracts/test_contract_constructor_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ def test_contract_constructor_encoding_encoding_warning(
(
(
"0x" + "00" * 32,
"0x00000000000000000000000000000000000000000000000000000000000004d20000000000000000000000000000000000000000000000000000000000000000",
), # noqa: E501
"0x00000000000000000000000000000000000000000000000000000000000004d20000000000000000000000000000000000000000000000000000000000000000", # noqa: E501
),
(
b"1" * 32,
"0x00000000000000000000000000000000000000000000000000000000000004d23131313131313131313131313131313131313131313131313131313131313131",
), # noqa: E501
"0x00000000000000000000000000000000000000000000000000000000000004d23131313131313131313131313131313131313131313131313131313131313131", # noqa: E501
),
),
)
def test_contract_constructor_encoding_encoding_strict(
Expand Down
4 changes: 2 additions & 2 deletions tests/core/contracts/test_contract_events_build_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
)

CONTRACT_ABI = json.loads(
'[{"constant":false,"inputs":[],"name":"return13","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":true,"inputs":[],"name":"counter","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"amt","type":"uint256"}],"name":"increment","outputs":[{"name":"result","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"},{"name":"b","type":"int256"}],"name":"add","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":false,"inputs":[],"name":"increment","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"}],"name":"multiply7","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Increased","type":"event"}]'
) # noqa: E501
'[{"constant":false,"inputs":[],"name":"return13","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":true,"inputs":[],"name":"counter","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"amt","type":"uint256"}],"name":"increment","outputs":[{"name":"result","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"},{"name":"b","type":"int256"}],"name":"add","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"constant":false,"inputs":[],"name":"increment","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"a","type":"int256"}],"name":"multiply7","outputs":[{"name":"result","type":"int256"}],"type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"value","type":"uint256"}],"name":"Increased","type":"event"}]' # noqa: E501
)


def test_build_filter_topic_signature(w3):
Expand Down
4 changes: 2 additions & 2 deletions tests/core/contracts/test_contract_method_abi_decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
'[{"constant":false,"inputs":[],"name":"noargfunc","outputs":[],"type":"function"}]'
) # noqa: E501
ABI_B = json.loads(
'[{"constant":false,"inputs":[{"name":"uintarg","type":"uint256"}],"name":"uintfunc","outputs":[],"type":"function"}]'
) # noqa: E501
'[{"constant":false,"inputs":[{"name":"uintarg","type":"uint256"}],"name":"uintfunc","outputs":[],"type":"function"}]' # noqa: E501
)
ABI_C = json.loads(
'[{"constant":false,"inputs":[],"name":"namesakefunc","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"bytesarg","type":"bytes32"}],"name":"namesakefunc","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"uintarg","type":"uint256"}],"name":"namesakefunc","outputs":[],"type":"function"}]'
) # noqa: E501
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
'[{"constant":false,"inputs":[],"name":"a","outputs":[],"type":"function"}]'
) # noqa: E501
SINGLE_FN_ONE_ARG = json.loads(
'[{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"a","outputs":[],"type":"function"}]'
) # noqa: E501
'[{"constant":false,"inputs":[{"name":"","type":"uint256"}],"name":"a","outputs":[],"type":"function"}]' # noqa: E501
)
FALLBACK_FUNCTION = json.loads(
'[{"constant": false, "inputs": [], "name": "getData", "outputs": [{"name": "r", "type": "uint256"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"payable": false, "stateMutability": "nonpayable", "type": "fallback"}]'
) # noqa: E501
'[{"constant": false, "inputs": [], "name": "getData", "outputs": [{"name": "r", "type": "uint256"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"payable": false, "stateMutability": "nonpayable", "type": "fallback"}]' # noqa: E501
)
RECEIVE_FUNCTION = json.loads(
'[{"constant": false, "inputs": [], "name": "getData", "outputs": [{"name": "r", "type": "uint256"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"payable": true, "stateMutability": "payable", "type": "receive"}]'
) # noqa: E501
'[{"constant": false, "inputs": [], "name": "getData", "outputs": [{"name": "r", "type": "uint256"}], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"payable": true, "stateMutability": "payable", "type": "receive"}]' # noqa: E501
)
MULTIPLE_FUNCTIONS = json.loads(
"""
[
Expand Down
48 changes: 24 additions & 24 deletions tests/core/eth-module/test_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ def test_eth_account_recover_message(acct):
)
def test_eth_account_recover_signature_bytes(acct, signature_bytes):
msg = encode_defunct(
b"\xbb\r\x8a\xba\x9f\xf7\xa1<N,s{i\x81\x86r\x83{\xba\x9f\xe2\x1d\xaa\xdd\xb3\xd6\x01\xda\x00\xb7)\xa1"
) # noqa: E501
b"\xbb\r\x8a\xba\x9f\xf7\xa1<N,s{i\x81\x86r\x83{\xba\x9f\xe2\x1d\xaa\xdd\xb3\xd6\x01\xda\x00\xb7)\xa1" # noqa: E501
)
from_account = acct.recover_message(msg, signature=signature_bytes)
assert from_account == "0xb7E7385a15fFd29e349BB409C4c0a7d7469601C7"

Expand All @@ -185,8 +185,8 @@ def test_eth_account_recover_vrs(acct):
)

msg = encode_defunct(
b"\xbb\r\x8a\xba\x9f\xf7\xa1<N,s{i\x81\x86r\x83{\xba\x9f\xe2\x1d\xaa\xdd\xb3\xd6\x01\xda\x00\xb7)\xa1"
) # noqa: E501
b"\xbb\r\x8a\xba\x9f\xf7\xa1<N,s{i\x81\x86r\x83{\xba\x9f\xe2\x1d\xaa\xdd\xb3\xd6\x01\xda\x00\xb7)\xa1" # noqa: E501
)
from_account = acct.recover_message(msg, vrs=(v, r, s))
assert from_account == "0xb7E7385a15fFd29e349BB409C4c0a7d7469601C7"

Expand All @@ -201,8 +201,8 @@ def test_eth_account_recover_vrs_standard_v(acct):
15655399131600894366408541311673616702363115109327707006109616887384920764603,
)
msg = encode_defunct(
b"\xbb\r\x8a\xba\x9f\xf7\xa1<N,s{i\x81\x86r\x83{\xba\x9f\xe2\x1d\xaa\xdd\xb3\xd6\x01\xda\x00\xb7)\xa1"
) # noqa: E501
b"\xbb\r\x8a\xba\x9f\xf7\xa1<N,s{i\x81\x86r\x83{\xba\x9f\xe2\x1d\xaa\xdd\xb3\xd6\x01\xda\x00\xb7)\xa1" # noqa: E501
)
from_account = acct.recover_message(msg, vrs=(v, r, s))
assert from_account == "0xb7E7385a15fFd29e349BB409C4c0a7d7469601C7"

Expand All @@ -221,8 +221,8 @@ def test_eth_account_recover_vrs_standard_v(acct):
83713930994764734002432606962255364472443135907807238282514898577139886061053,
43435997768575461196683613590576722655951133545204789519877940758262837256233,
HexBytes(
"0xb91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a0291c"
), # noqa: E501
"0xb91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a0291c" # noqa: E501
),
),
(
"10284",
Expand All @@ -235,8 +235,8 @@ def test_eth_account_recover_vrs_standard_v(acct):
143748089818580655331728101695676826715814583506606354117109114714663470502,
227853308212209543997879651656855994238138056366857653269155208245074180053,
HexBytes(
"0x00515bc8fd32264e21ec0820e8c5123ed58c1195c9ea17cb018b1ad4073cc5a60080f5dcec397a5a8c523082bfa41771568903aa554ec06ba8475ca9050fb7d51b"
), # noqa: E501
"0x00515bc8fd32264e21ec0820e8c5123ed58c1195c9ea17cb018b1ad4073cc5a60080f5dcec397a5a8c523082bfa41771568903aa554ec06ba8475ca9050fb7d51b" # noqa: E501
),
),
),
ids=["web3js_example", "31byte_r_and_s"],
Expand Down Expand Up @@ -277,8 +277,8 @@ def test_eth_account_sign(
},
"0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318",
HexBytes(
"0xf86a8086d55698372431831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428"
), # noqa: E501
"0xf86a8086d55698372431831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428" # noqa: E501
),
HexBytes(
"0xd8f64a42b57be0d565f385378db2f6bf324ce14a594afc05de90436e9ce01f60"
),
Expand All @@ -297,8 +297,8 @@ def test_eth_account_sign(
},
"0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318",
HexBytes(
"0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20"
), # noqa: E501
"0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20" # noqa: E501
),
HexBytes(
"0xb0c5e2c6b29eeb0b9c1d63eaa8b0f93c02ead18ae01cb7fc795b0612d3e9d55a"
),
Expand Down Expand Up @@ -327,8 +327,8 @@ def test_eth_account_sign(
},
"0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318",
HexBytes(
"0x01f8a70102843b9aca00830186a09496216849c49358b10257cb55b28ea603c874b05e865af3107a4000825544f838f7940000000000000000000000000000000000000001e1a0010000000000000000000000000000000000000000000000000000000000000080a059a827f04246489aca139510f2f82896fd5bd1d34f05228b3fe0c60141db4246a07a28a925eae2e3ee173cf691de2737cbff9160fc527ca4305740a31f154758c5"
), # noqa: 501
"0x01f8a70102843b9aca00830186a09496216849c49358b10257cb55b28ea603c874b05e865af3107a4000825544f838f7940000000000000000000000000000000000000001e1a0010000000000000000000000000000000000000000000000000000000000000080a059a827f04246489aca139510f2f82896fd5bd1d34f05228b3fe0c60141db4246a07a28a925eae2e3ee173cf691de2737cbff9160fc527ca4305740a31f154758c5" # noqa: 501
),
HexBytes(
"0x5daf67cf0dd95f338e98b7b8ee7635f3667b7127be8f42011536c239f8ed4f50"
),
Expand Down Expand Up @@ -358,8 +358,8 @@ def test_eth_account_sign(
},
"0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318",
HexBytes(
"0x02f8ac010284773594008477359400830186a09496216849c49358b10257cb55b28ea603c874b05e865af3107a4000825544f838f7940000000000000000000000000000000000000001e1a0010000000000000000000000000000000000000000000000000000000000000001a0c5217aec4d576a1b5097c5054ed0157f762dd018f5c2195f0d0190ddca9445c5a0230a35968164ab4318a7042ca0ad4b4178a0d24c2cc000e13dfa24c206317935"
), # noqa: 501
"0x02f8ac010284773594008477359400830186a09496216849c49358b10257cb55b28ea603c874b05e865af3107a4000825544f838f7940000000000000000000000000000000000000001e1a0010000000000000000000000000000000000000000000000000000000000000001a0c5217aec4d576a1b5097c5054ed0157f762dd018f5c2195f0d0190ddca9445c5a0230a35968164ab4318a7042ca0ad4b4178a0d24c2cc000e13dfa24c206317935" # noqa: 501
),
HexBytes(
"0xd42048e2a34957ab81f093d757be86453197bec95780d509fb3545d295227a34"
),
Expand All @@ -381,8 +381,8 @@ def test_eth_account_sign(
},
"0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318",
HexBytes(
"0x02f873010284773594008477359400830186a09496216849c49358b10257cb55b28ea603c874b05e865af3107a4000825544c080a07cfcd6472c4a29c566df07851c4708cb02523f71075221cc8e668908db58fde0a03b9185c7a719a99f2822dda5ed94c9f90641bd75578f093f15ceb71fc6ba85fc"
), # noqa: 501
"0x02f873010284773594008477359400830186a09496216849c49358b10257cb55b28ea603c874b05e865af3107a4000825544c080a07cfcd6472c4a29c566df07851c4708cb02523f71075221cc8e668908db58fde0a03b9185c7a719a99f2822dda5ed94c9f90641bd75578f093f15ceb71fc6ba85fc" # noqa: 501
),
HexBytes(
"0x20a46a15e0b39815b44f01f3261a8741b095ed2bb4235339fa0e461251f9dc95"
),
Expand Down Expand Up @@ -487,8 +487,8 @@ def test_eth_account_prepared_encrypt(acct, web3js_key, web3js_password):
"chainId": 1,
},
HexBytes(
"0xf86a8086d55698372431831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428"
), # noqa: E501
"0xf86a8086d55698372431831e848094f0109fc8df283027b6285cc889f5aa624eac1f55843b9aca008025a009ebb6ca057a0535d6186462bc0b465b561c94a295bdb0621fc19208ab149a9ca0440ffd775ce91a833ab410777204d5341a6f9fa91216a6f3ee2c051fea6a0428" # noqa: E501
),
HexBytes(
"0xd8f64a42b57be0d565f385378db2f6bf324ce14a594afc05de90436e9ce01f60"
),
Expand All @@ -506,8 +506,8 @@ def test_eth_account_prepared_encrypt(acct, web3js_key, web3js_password):
"chainId": 1,
},
HexBytes(
"0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20"
), # noqa: E501
"0xf85d8080827c6d94f0109fc8df283027b6285cc889f5aa624eac1f558080269f22f17b38af35286ffbb0c6376c86ec91c20ecbad93f84913a0cc15e7580cd99f83d6e12e82e3544cb4439964d5087da78f74cefeec9a450b16ae179fd8fe20" # noqa: E501
),
HexBytes(
"0xb0c5e2c6b29eeb0b9c1d63eaa8b0f93c02ead18ae01cb7fc795b0612d3e9d55a"
),
Expand Down

0 comments on commit abd1e6b

Please sign in to comment.