Skip to content

Commit

Permalink
Remove unnecessary noqas
Browse files Browse the repository at this point in the history
  • Loading branch information
Quexington committed Oct 31, 2024
1 parent 339a617 commit d1b30b1
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 37 deletions.
3 changes: 0 additions & 3 deletions chia/_tests/core/full_node/full_sync/test_full_sync.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 0 additions & 2 deletions chia/_tests/core/full_node/test_performance.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# flake8: noqa: F811, F401
from __future__ import annotations

import dataclasses
import logging
import random

Expand Down
1 change: 0 additions & 1 deletion chia/_tests/core/server/test_dos.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa: F811, F401
from __future__ import annotations

import asyncio
Expand Down
2 changes: 0 additions & 2 deletions chia/_tests/core/test_full_node_rpc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa: F811, F401
from __future__ import annotations

import pytest
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions chia/_tests/pools/test_pool_cmdline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa: E501

from __future__ import annotations

import pytest
Expand Down
5 changes: 3 additions & 2 deletions chia/_tests/pools/test_pool_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa: E501
from __future__ import annotations

from chia_rs import AugSchemeMPL
Expand All @@ -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",
Expand Down
16 changes: 7 additions & 9 deletions chia/_tests/util/network_protocol_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa

from __future__ import annotations

from chia_rs import G1Element, G2Element, RewardChainBlockUnfinished
Expand Down Expand Up @@ -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")),
Expand Down Expand Up @@ -142,7 +140,7 @@
)


### FULL NODE PROTOCOL.
# FULL NODE PROTOCOL.
new_peak = full_node_protocol.NewPeak(
bytes32(bytes.fromhex("8a346e8dc02e9b44c0571caa74fd99f163d4c5d7deae9f8ddb00528721493f7a")),
uint32(2653549198),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -755,7 +753,7 @@
)


### HARVESTER PROTOCOL
# HARVESTER PROTOCOL
pool_difficulty = harvester_protocol.PoolDifficulty(
uint64(14819251421858580996),
uint64(12852879676624401630),
Expand Down Expand Up @@ -899,7 +897,7 @@
["str"],
)

### INTRODUCER PROTOCOL
# INTRODUCER PROTOCOL
request_peers_introducer = introducer_protocol.RequestPeersIntroducer()

respond_peers_introducer = introducer_protocol.RespondPeersIntroducer(
Expand All @@ -913,7 +911,7 @@
)


### POOL PROTOCOL
# POOL PROTOCOL
authentication_payload = pool_protocol.AuthenticationPayload(
"method",
bytes32(bytes.fromhex("0251e3b3a1aacc689091b6b085be7a8d319bd9d1a015faae969cb76d8a45607c")),
Expand Down Expand Up @@ -1002,7 +1000,7 @@
"err",
)

### TIMELORD PROTOCOL
# TIMELORD PROTOCOL
sub_epoch_summary = SubEpochSummary(
bytes32(bytes.fromhex("2d0550de416467e7b57e56e962c712b79bee29cae29c73cc908da5978fc9789e")),
bytes32(bytes.fromhex("3d29f5a3fe067ce7edea76c9cebaf3a3afdebc0eb9fbd530f807f1a28ed2df6d")),
Expand Down
31 changes: 15 additions & 16 deletions chia/_tests/util/test_network_protocol_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
from __future__ import annotations

import ast
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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}"

0 comments on commit d1b30b1

Please sign in to comment.