From d1b30b1fc116a05919a03799a1fb9248876ade19 Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 31 Oct 2024 11:01:34 -0700 Subject: [PATCH] Remove unnecessary noqas --- .../full_node/full_sync/test_full_sync.py | 3 -- .../_tests/core/full_node/test_performance.py | 2 -- chia/_tests/core/server/test_dos.py | 1 - chia/_tests/core/test_full_node_rpc.py | 2 -- chia/_tests/pools/test_pool_cmdline.py | 2 -- chia/_tests/pools/test_pool_config.py | 5 +-- chia/_tests/util/network_protocol_data.py | 16 +++++----- .../_tests/util/test_network_protocol_test.py | 31 +++++++++---------- 8 files changed, 25 insertions(+), 37 deletions(-) diff --git a/chia/_tests/core/full_node/full_sync/test_full_sync.py b/chia/_tests/core/full_node/full_sync/test_full_sync.py index 013545e87b22..1848450e098c 100644 --- a/chia/_tests/core/full_node/full_sync/test_full_sync.py +++ b/chia/_tests/core/full_node/full_sync/test_full_sync.py @@ -1,14 +1,11 @@ -# flake8: noqa: F811, F401 from __future__ import annotations import asyncio -import dataclasses import logging import time import pytest -from chia._tests.conftest import ConsensusMode from chia._tests.core.node_height import node_height_between, node_height_exactly from chia._tests.util.time_out_assert import time_out_assert from chia.full_node.full_node import FullNode diff --git a/chia/_tests/core/full_node/test_performance.py b/chia/_tests/core/full_node/test_performance.py index f03eb8c68c50..8dc2f924b45f 100644 --- a/chia/_tests/core/full_node/test_performance.py +++ b/chia/_tests/core/full_node/test_performance.py @@ -1,7 +1,5 @@ -# flake8: noqa: F811, F401 from __future__ import annotations -import dataclasses import logging import random diff --git a/chia/_tests/core/server/test_dos.py b/chia/_tests/core/server/test_dos.py index 69c67a309ced..9885d952e9a6 100644 --- a/chia/_tests/core/server/test_dos.py +++ b/chia/_tests/core/server/test_dos.py @@ -1,4 +1,3 @@ -# flake8: noqa: F811, F401 from __future__ import annotations import asyncio diff --git a/chia/_tests/core/test_full_node_rpc.py b/chia/_tests/core/test_full_node_rpc.py index ca5380c17ea1..b20463a76450 100644 --- a/chia/_tests/core/test_full_node_rpc.py +++ b/chia/_tests/core/test_full_node_rpc.py @@ -1,4 +1,3 @@ -# flake8: noqa: F811, F401 from __future__ import annotations import pytest @@ -7,7 +6,6 @@ from chia import __version__ from chia._tests.blockchain.blockchain_test_utils import _validate_and_add_block -from chia._tests.conftest import ConsensusMode from chia._tests.connection_utils import connect_and_get_peer from chia._tests.util.rpc import validate_get_routes from chia._tests.util.time_out_assert import time_out_assert diff --git a/chia/_tests/pools/test_pool_cmdline.py b/chia/_tests/pools/test_pool_cmdline.py index 73f3d7d01558..d323ad503729 100644 --- a/chia/_tests/pools/test_pool_cmdline.py +++ b/chia/_tests/pools/test_pool_cmdline.py @@ -1,5 +1,3 @@ -# flake8: noqa: E501 - from __future__ import annotations import pytest diff --git a/chia/_tests/pools/test_pool_config.py b/chia/_tests/pools/test_pool_config.py index a41aef71f867..e8e01ec268d6 100644 --- a/chia/_tests/pools/test_pool_config.py +++ b/chia/_tests/pools/test_pool_config.py @@ -1,4 +1,3 @@ -# flake8: noqa: E501 from __future__ import annotations from chia_rs import AugSchemeMPL @@ -20,7 +19,9 @@ def test_pool_config(tmp_path): AugSchemeMPL.key_gen(b"1" * 32) d = { - "owner_public_key": "84c3fcf9d5581c1ddc702cb0f3b4a06043303b334dd993ab42b2c320ebfa98e5ce558448615b3f69638ba92cf7f43da5", + "owner_public_key": ( + "84c3fcf9d5581c1ddc702cb0f3b4a06043303b334dd993ab42b2c320ebfa98e5ce558448615b3f69638ba92cf7f43da5" + ), "p2_singleton_puzzle_hash": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", "payout_instructions": "c2b08e41d766da4116e388357ed957d04ad754623a915f3fd65188a8746cf3e8", "pool_url": "localhost", diff --git a/chia/_tests/util/network_protocol_data.py b/chia/_tests/util/network_protocol_data.py index 76b0c60cd738..5598d82cb814 100644 --- a/chia/_tests/util/network_protocol_data.py +++ b/chia/_tests/util/network_protocol_data.py @@ -1,5 +1,3 @@ -# flake8: noqa - from __future__ import annotations from chia_rs import G1Element, G2Element, RewardChainBlockUnfinished @@ -46,7 +44,7 @@ error_with_data = Error(int16(Err.UNKNOWN.value), "Unknown", b"extra data") -### FARMER PROTOCOL +# FARMER PROTOCOL new_signage_point = farmer_protocol.NewSignagePoint( bytes32(bytes.fromhex("34b2a753b0dc864e7218f8facf23ca0e2b636351df5289b76f5845d9a78b7026")), bytes32(bytes.fromhex("9dc8b9d685c79acdf8780d994416dfcfb118e0adc99769ecfa94e1f40aa5bbe5")), @@ -142,7 +140,7 @@ ) -### FULL NODE PROTOCOL. +# FULL NODE PROTOCOL. new_peak = full_node_protocol.NewPeak( bytes32(bytes.fromhex("8a346e8dc02e9b44c0571caa74fd99f163d4c5d7deae9f8ddb00528721493f7a")), uint32(2653549198), @@ -503,7 +501,7 @@ respond_peers = full_node_protocol.RespondPeers([timestamped_peer_info]) -## WALLET PROTOCOL +# WALLET PROTOCOL request_puzzle_solution = wallet_protocol.RequestPuzzleSolution( bytes32(bytes.fromhex("6edddb46bd154f50566b49c95812e0f1131a0a7162630349fc8d1d696e463e47")), uint32(3905474497), @@ -755,7 +753,7 @@ ) -### HARVESTER PROTOCOL +# HARVESTER PROTOCOL pool_difficulty = harvester_protocol.PoolDifficulty( uint64(14819251421858580996), uint64(12852879676624401630), @@ -899,7 +897,7 @@ ["str"], ) -### INTRODUCER PROTOCOL +# INTRODUCER PROTOCOL request_peers_introducer = introducer_protocol.RequestPeersIntroducer() respond_peers_introducer = introducer_protocol.RespondPeersIntroducer( @@ -913,7 +911,7 @@ ) -### POOL PROTOCOL +# POOL PROTOCOL authentication_payload = pool_protocol.AuthenticationPayload( "method", bytes32(bytes.fromhex("0251e3b3a1aacc689091b6b085be7a8d319bd9d1a015faae969cb76d8a45607c")), @@ -1002,7 +1000,7 @@ "err", ) -### TIMELORD PROTOCOL +# TIMELORD PROTOCOL sub_epoch_summary = SubEpochSummary( bytes32(bytes.fromhex("2d0550de416467e7b57e56e962c712b79bee29cae29c73cc908da5978fc9789e")), bytes32(bytes.fromhex("3d29f5a3fe067ce7edea76c9cebaf3a3afdebc0eb9fbd530f807f1a28ed2df6d")), diff --git a/chia/_tests/util/test_network_protocol_test.py b/chia/_tests/util/test_network_protocol_test.py index d0adb404e7da..32c6319bd4b1 100644 --- a/chia/_tests/util/test_network_protocol_test.py +++ b/chia/_tests/util/test_network_protocol_test.py @@ -1,4 +1,3 @@ -# flake8: noqa from __future__ import annotations import ast @@ -34,18 +33,17 @@ def types_in_module(mod: Any) -> set[str]: return types +STANDARD_ADVICE = "Make sure to update the protocol message regression test to include the new message" + + def test_missing_messages_state_machine() -> None: from chia.protocols.protocol_state_machine import NO_REPLY_EXPECTED, VALID_REPLY_MESSAGE_MAP # if these asserts fail, make sure to add the new network protocol messages # to the visitor in build_network_protocol_files.py and rerun it. Then # update this test - assert ( - len(VALID_REPLY_MESSAGE_MAP) == 26 - ), "A message was added to the protocol state machine. Make sure to update the protocol message regression test to include the new message" - assert ( - len(NO_REPLY_EXPECTED) == 10 - ), "A message was added to the protocol state machine. Make sure to update the protocol message regression test to include the new message" + assert len(VALID_REPLY_MESSAGE_MAP) == 26, f"A message was added to the protocol state machine. {STANDARD_ADVICE}" + assert len(NO_REPLY_EXPECTED) == 10, f"A message was added to the protocol state machine. {STANDARD_ADVICE}" def test_message_ids() -> None: @@ -63,7 +61,8 @@ def test_message_ids() -> None: message_name = entry.targets[0].id if message_id in message_ids: # pragma: no cover raise AssertionError( - f'protocol message ID clash between "{message_name}" and "{message_ids[message_id]}". Value {message_id}' + f'protocol message ID clash between "{message_name}" and "{message_ids[message_id]}". ' + f"Value {message_id}" ) message_ids[message_id] = message_name if message_id < 0 or message_id > 255: # pragma: no cover @@ -226,32 +225,32 @@ def test_missing_messages() -> None: # update this test assert ( types_in_module(wallet_protocol) == wallet_msgs - ), "message types were added or removed from wallet_protocol. Make sure to update the protocol message regression test to include the new message" + ), f"message types were added or removed from wallet_protocol. {STANDARD_ADVICE}" assert ( types_in_module(farmer_protocol) == farmer_msgs - ), "message types were added or removed from farmer_protocol. Make sure to update the protocol message regression test to include the new message" + ), f"message types were added or removed from farmer_protocol. {STANDARD_ADVICE}" assert ( types_in_module(full_node_protocol) == full_node_msgs - ), "message types were added or removed from full_node_protocol. Make sure to update the protocol message regression test to include the new message" + ), f"message types were added or removed from full_node_protocol. {STANDARD_ADVICE}" assert ( types_in_module(harvester_protocol) == harvester_msgs - ), "message types were added or removed from harvester_protocol. Make sure to update the protocol message regression test to include the new message" + ), f"message types were added or removed from harvester_protocol. {STANDARD_ADVICE}" assert ( types_in_module(introducer_protocol) == introducer_msgs - ), "message types were added or removed from introducer_protocol. Make sure to update the protocol message regression test to include the new message" + ), f"message types were added or removed from introducer_protocol. {STANDARD_ADVICE}" assert ( types_in_module(pool_protocol) == pool_msgs - ), "message types were added or removed from pool_protocol. Make sure to update the protocol message regression test to include the new message" + ), f"message types were added or removed from pool_protocol. {STANDARD_ADVICE}" assert ( types_in_module(timelord_protocol) == timelord_msgs - ), "message types were added or removed from timelord_protocol. Make sure to update the protocol message regression test to include the new message" + ), f"message types were added or removed from timelord_protocol. {STANDARD_ADVICE}" assert ( types_in_module(shared_protocol) == shared_msgs - ), "message types were added or removed from shared_protocol. Make sure to update the protocol message regression test to include the new message" + ), f"message types were added or removed from shared_protocol. {STANDARD_ADVICE}"