black src/ and try fixed GH superlinter black

This commit is contained in:
Gene Hoffman 2020-09-15 18:56:20 -07:00 committed by Gene Hoffman
parent dedf41a333
commit b199576bdf
8 changed files with 26 additions and 25 deletions

View File

@ -46,7 +46,7 @@ jobs:
################################ ################################
- name: Lint Code Base - name: Lint Code Base
# uses: github/super-linter@v3.10.0 # uses: github/super-linter@v3.10.0
uses: docker://github/super-linter:v3.10.0 uses: docker://github/super-linter:v3.10.1
env: env:
VALIDATE_ALL_CODEBASE: true VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: master DEFAULT_BRANCH: master

View File

@ -91,7 +91,7 @@ testnet_kwargs = {
"PROPAGATION_DELAY_THRESHOLD": 1500, "PROPAGATION_DELAY_THRESHOLD": 1500,
# Hardcoded genesis block, generated using tests/block_tools.py # Hardcoded genesis block, generated using tests/block_tools.py
# Replace this any time the constants change. # Replace this any time the constants change.
"GENESIS_BLOCK": b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x81\x8f\x0c\xec\x97\x85V`C\xfc\xe4\xf9A\xb6\xa1\xa8-@\x82`\r[v\x8f,\x86\xf1X\xc2?\xf6q\xf8\xfb\x8e\rnZ\xbaw\x11CN\xb1\xa9\xf9\xbb0\x93\x10\x8fc\xc3f&\x9b\x07>H\xf1\xa5\x841\xc8\xd9\xcaO\xd4\xb8\x93\x11\xa3\xd9\xfa\xb2U\x10\xcd\xec\x92*AA\xd9\xfd7\xcc\xf7]\xaf\x91V\xe3\x10\x1aa\x17\x00\x00\x00\xb8`\xbfL[I\x16\xd5\x01>\tw>S\xf0#8\xed\xc6\x88\xc5#=i2\x0c\x8d\xbe\x85\xeb\x8f\xee\x1b\x06a\x99\x1c\xba\xfa\xcba\xe6\x04Q\xf4\xc7\xe92RrU l\x01\xee 7)\xff\xa5\xa68\xb5\x10\xbbrQb\xb0\x01\'K\xf1\x07).Z.\')\xee`b\xab\x01\xa9\x82S\x91\x16\x9c\x96\x95\xaf\xe5\xe5\xca\xb7@\x03\xf4$\x87\xe6N\xd3\xfb\xd39Y4D\x91\xed\x14\xda4\xa8\xbfO@\xb4\xd3\x8d\xa9\x9f\xc5\xd4\xf1`o\x9bg\x81\x12\xb0i\xdfJ\xeb*\xd2*`\x95\xf0\xd0j\xa4\x8e\xa6\xcf\xaaHn\xd9\xfe_\xc9\xd9\x85\x8a\xa5\xe8\x1c\x9dk\xc5\xf0\xda\xfe\xd7R\xb5\xbe\x1e\xe0qw\x7f}x\xa7\xa6[\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\xa2\xa9\x00cN 4\xf5\xb9]\xefu\t\x1a\x92\x85\xd0,\x8e\xca5\xff7N\xb3N-\x94-\xb4\xa3q[\xfd\xf0\x0b4\x8a/&#v\x19Y\\\xf8\x83o\x1b\x1b\x85\xe18\xbd\xce\xd5\x98\x11r\xaa\xd8\x1d8\xbe<Q\x9e\x00\x17sy\x96\x19\x86Go<\x1a\xa1\x94\xc6\xd2\xea\xe1~\xc4\xc8\xf6 \x83}(\xce\x86\xea\xbd\xc0\xe0\xc8_9\xe1`S\xbeZ\xc4y\x1d\xebx\xa1\x1e"g\x16\xbbC\x0b\rhkU\x13\xf2i^[\xa8t(\x95\x00\x00\x00\x00\x82\x00F\x129)\x8a>[/\x8b\xbb\xa4\xf0\x86\x10\x93\x9b\x05\xd1\x1c$\xfc\xae\xbbI\xa8\x835Qj\xba\x87E\xf8a5t\x81i\xa6Lm\x82\xc5#C!\\f\xc5\x18\x80\x97y\xd5P\xe42\xa0\x15\x8b 6\x19l\x00\x18\xb9-\x85\x15\x9c\xed\xe4\xf2\x83j\x8d^\xca&/\xf6X@P\x8eC,\xaea\x85\x0c\xa66\x16,F\xf8\x07V\xf8\x83\xd3\x18\xd2R\xdf\xf8:\x8f\n\x85\xa6\'\xb5\x8bt%\xf5\xbaz\x03\x01\x1a\xa5\xd6m\x10\xcb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00_Y\xda\xc6Z\xb0?\x8fN^\x06\\w#Y\xc3n\xb4\x083\x1d\x01\xb4\xd8Y\xbb\xcf\xa9\xd8\t\x8a8N\xe5a\xa2\x0e\x0cM\xe8Kj\xfb99\xd4\x02\xca\xa2\x14\n\xf4\xafB%\xbf\xf8;\x83\xd7\xee&RS\x8e\x0b\xab\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00P\xa2\xa9\x8c-\x02\x9a\xb0\x08s^m1Z\xf5\x0f\xa7\x1d\x87`|\x92\xeb\x07\xb9\xaa\x90\xc1\xefz\xa2\x10\xf4\xf2\x8d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00z\x91k\xdcP\xd3\xd03{\t\x98f\x8aOC\x96p3\x94g\xd7\xe9\x03\x9b\x86P\xba{\x1dO\xc1\xa0\x00\x00\x01\xd1\xa9J \x00z\x91k\xdcP\xd3\xd03{\t\x98f\x8aOC\x96p3\x94g\xd7\xe9\x03\x9b\x86P\xba{\x1dO\xc1\xa0\x00\x00\x00\x00\xa8\x81\xb2#\xdf\'\xe1\x14\x94p\xa6\xd2\xa4\xe6\x0c\xf7\xd3\x0b9\xdf3C\xf8\'\x98\xeb\xaf\xe8\xeef\xe5\xa8w\xd2\x94h?\x00\xe1\xb0\xd6\xee\x9a\xcb\xbeNM\x80\x17\xca(?o\xf5J\xa8\x9c\xf1\xb7\xd2\x87/\x9f\xb6\x18\xee\xf2\xf6\xcb*\xbc\xb7D\xb7\xf8\xaf\x9b\x99\xe1Z\xb0\x05\xbe\xdf\x85\x10\x0eS\x98\xd1\x14\x1b\xcf\xfe\xa5\xe0\x00\x00\x00\x00\x00\x00\x00\x00\xa1\x999\xae\xe9\xf1n\xc1\xc1\xc6q<\xe97%_\x1e\x1b\xd0>\xcd\xa8\x94\xd8;\xe4\x9f\xa7\xb1V\xa5Q\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x92.\xa5X;>\x8d\x90!Op[q\x90g\xdc,\xee\x1b!\xb7hI\x06q\xf9mq3\xd7,\xb6\x1f,qf\xa3\xdf \x8ac\xbf\x91p\xb1\xd6\xe0\x87\x0cJ\xa0\xb22z?X\x90\x0e\xa9\x85@\x0b\x90\t\x84\xd1e\xd9f\xb9U\x11\xfa+\xa2\xc8+\xa3\x0e\xdf\xcc\x04\x94\xdaC\x1c\xea\xf6\xd5\x18n\x00\x15\xa5S\x11\x00\x00\x00\x00\x04\x01A\xbap', # noqa: E501 "GENESIS_BLOCK": b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x81\x8f\x0c\xec\x97\x85V`C\xfc\xe4\xf9A\xb6\xa1\xa8-@\x82`\r[v\x8f,\x86\xf1X\xc2?\xf6q\xf8\xfb\x8e\rnZ\xbaw\x11CN\xb1\xa9\xf9\xbb0\x93\x10\x8fc\xc3f&\x9b\x07>H\xf1\xa5\x841\xc8\xd9\xcaO\xd4\xb8\x93\x11\xa3\xd9\xfa\xb2U\x10\xcd\xec\x92*AA\xd9\xfd7\xcc\xf7]\xaf\x91V\xe3\x10\x1aa\x17\x00\x00\x00\xb8`\xbfL[I\x16\xd5\x01>\tw>S\xf0#8\xed\xc6\x88\xc5#=i2\x0c\x8d\xbe\x85\xeb\x8f\xee\x1b\x06a\x99\x1c\xba\xfa\xcba\xe6\x04Q\xf4\xc7\xe92RrU l\x01\xee 7)\xff\xa5\xa68\xb5\x10\xbbrQb\xb0\x01'K\xf1\x07).Z.')\xee`b\xab\x01\xa9\x82S\x91\x16\x9c\x96\x95\xaf\xe5\xe5\xca\xb7@\x03\xf4$\x87\xe6N\xd3\xfb\xd39Y4D\x91\xed\x14\xda4\xa8\xbfO@\xb4\xd3\x8d\xa9\x9f\xc5\xd4\xf1`o\x9bg\x81\x12\xb0i\xdfJ\xeb*\xd2*`\x95\xf0\xd0j\xa4\x8e\xa6\xcf\xaaHn\xd9\xfe_\xc9\xd9\x85\x8a\xa5\xe8\x1c\x9dk\xc5\xf0\xda\xfe\xd7R\xb5\xbe\x1e\xe0qw\x7f}x\xa7\xa6[\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00P\xa2\xa9\x00cN 4\xf5\xb9]\xefu\t\x1a\x92\x85\xd0,\x8e\xca5\xff7N\xb3N-\x94-\xb4\xa3q[\xfd\xf0\x0b4\x8a/&#v\x19Y\\\xf8\x83o\x1b\x1b\x85\xe18\xbd\xce\xd5\x98\x11r\xaa\xd8\x1d8\xbe<Q\x9e\x00\x17sy\x96\x19\x86Go<\x1a\xa1\x94\xc6\xd2\xea\xe1~\xc4\xc8\xf6 \x83}(\xce\x86\xea\xbd\xc0\xe0\xc8_9\xe1`S\xbeZ\xc4y\x1d\xebx\xa1\x1e\"g\x16\xbbC\x0b\rhkU\x13\xf2i^[\xa8t(\x95\x00\x00\x00\x00\x82\x00F\x129)\x8a>[/\x8b\xbb\xa4\xf0\x86\x10\x93\x9b\x05\xd1\x1c$\xfc\xae\xbbI\xa8\x835Qj\xba\x87E\xf8a5t\x81i\xa6Lm\x82\xc5#C!\\f\xc5\x18\x80\x97y\xd5P\xe42\xa0\x15\x8b 6\x19l\x00\x18\xb9-\x85\x15\x9c\xed\xe4\xf2\x83j\x8d^\xca&/\xf6X@P\x8eC,\xaea\x85\x0c\xa66\x16,F\xf8\x07V\xf8\x83\xd3\x18\xd2R\xdf\xf8:\x8f\n\x85\xa6'\xb5\x8bt%\xf5\xbaz\x03\x01\x1a\xa5\xd6m\x10\xcb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00_Y\xda\xc6Z\xb0?\x8fN^\x06\\w#Y\xc3n\xb4\x083\x1d\x01\xb4\xd8Y\xbb\xcf\xa9\xd8\t\x8a8N\xe5a\xa2\x0e\x0cM\xe8Kj\xfb99\xd4\x02\xca\xa2\x14\n\xf4\xafB%\xbf\xf8;\x83\xd7\xee&RS\x8e\x0b\xab\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00P\xa2\xa9\x8c-\x02\x9a\xb0\x08s^m1Z\xf5\x0f\xa7\x1d\x87`|\x92\xeb\x07\xb9\xaa\x90\xc1\xefz\xa2\x10\xf4\xf2\x8d\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00z\x91k\xdcP\xd3\xd03{\t\x98f\x8aOC\x96p3\x94g\xd7\xe9\x03\x9b\x86P\xba{\x1dO\xc1\xa0\x00\x00\x01\xd1\xa9J \x00z\x91k\xdcP\xd3\xd03{\t\x98f\x8aOC\x96p3\x94g\xd7\xe9\x03\x9b\x86P\xba{\x1dO\xc1\xa0\x00\x00\x00\x00\xa8\x81\xb2#\xdf'\xe1\x14\x94p\xa6\xd2\xa4\xe6\x0c\xf7\xd3\x0b9\xdf3C\xf8'\x98\xeb\xaf\xe8\xeef\xe5\xa8w\xd2\x94h?\x00\xe1\xb0\xd6\xee\x9a\xcb\xbeNM\x80\x17\xca(?o\xf5J\xa8\x9c\xf1\xb7\xd2\x87/\x9f\xb6\x18\xee\xf2\xf6\xcb*\xbc\xb7D\xb7\xf8\xaf\x9b\x99\xe1Z\xb0\x05\xbe\xdf\x85\x10\x0eS\x98\xd1\x14\x1b\xcf\xfe\xa5\xe0\x00\x00\x00\x00\x00\x00\x00\x00\xa1\x999\xae\xe9\xf1n\xc1\xc1\xc6q<\xe97%_\x1e\x1b\xd0>\xcd\xa8\x94\xd8;\xe4\x9f\xa7\xb1V\xa5Q\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x92.\xa5X;>\x8d\x90!Op[q\x90g\xdc,\xee\x1b!\xb7hI\x06q\xf9mq3\xd7,\xb6\x1f,qf\xa3\xdf \x8ac\xbf\x91p\xb1\xd6\xe0\x87\x0cJ\xa0\xb22z?X\x90\x0e\xa9\x85@\x0b\x90\t\x84\xd1e\xd9f\xb9U\x11\xfa+\xa2\xc8+\xa3\x0e\xdf\xcc\x04\x94\xdaC\x1c\xea\xf6\xd5\x18n\x00\x15\xa5S\x11\x00\x00\x00\x00\x04\x01A\xbap", # noqa: E501
# Target tx count per sec # Target tx count per sec
"TX_PER_SEC": 20, "TX_PER_SEC": 20,
# Size of mempool = 10x the size of block # Size of mempool = 10x the size of block

View File

@ -1770,9 +1770,7 @@ class FullNode:
return return
conns = self.global_connections conns = self.global_connections
for peer in request.peer_list: for peer in request.peer_list:
conns.peers.add( conns.peers.add(PeerInfo(peer.host, peer.port))
PeerInfo(peer.host, peer.port)
)
# Pseudo-message to close the connection # Pseudo-message to close the connection
yield OutboundMessage(NodeType.INTRODUCER, Message("", None), Delivery.CLOSE) yield OutboundMessage(NodeType.INTRODUCER, Message("", None), Delivery.CLOSE)
@ -1789,9 +1787,7 @@ class FullNode:
asyncio.create_task(self.server.start_client(target, self._on_connect)) asyncio.create_task(self.server.start_client(target, self._on_connect))
@api_request @api_request
async def respond_peers_full_node( async def respond_peers_full_node(self, request: full_node_protocol.RespondPeers):
self, request: full_node_protocol.RespondPeers
):
pass pass
@api_request @api_request

View File

@ -215,9 +215,7 @@ class Peers:
self, max_peers: int = 0, randomize: bool = False, recent_threshold=9999999 self, max_peers: int = 0, randomize: bool = False, recent_threshold=9999999
) -> List[TimestampedPeerInfo]: ) -> List[TimestampedPeerInfo]:
target_peers = [ target_peers = [
TimestampedPeerInfo( TimestampedPeerInfo(peer.host, uint16(peer.port), uint64(0))
peer.host, uint16(peer.port), uint64(0)
)
for peer in self._peers for peer in self._peers
if time.time() - self.time_added[peer.get_hash()] < recent_threshold if time.time() - self.time_added[peer.get_hash()] < recent_threshold
] ]

View File

@ -37,7 +37,8 @@ from src.wallet.cc_wallet.cc_utils import (
from src.wallet.puzzles.genesis_by_coin_id_with_0 import ( from src.wallet.puzzles.genesis_by_coin_id_with_0 import (
create_genesis_or_zero_coin_checker, create_genesis_or_zero_coin_checker,
lineage_proof_for_genesis, lineage_proof_for_genesis,
genesis_coin_id_for_genesis_coin_checker) genesis_coin_id_for_genesis_coin_checker,
)
from dataclasses import replace from dataclasses import replace

View File

@ -54,7 +54,11 @@ def int_as_bytes32(v: int) -> bytes32:
return v.to_bytes(32, byteorder="big") return v.to_bytes(32, byteorder="big")
def generate_farmed_coin(block_index: int, puzzle_hash: bytes32, amount: int,) -> Coin: def generate_farmed_coin(
block_index: int,
puzzle_hash: bytes32,
amount: int,
) -> Coin:
""" """
Generate a (fake) coin which can be used as a starting point for a chain Generate a (fake) coin which can be used as a starting point for a chain
of coin tests. of coin tests.
@ -162,7 +166,10 @@ def test_spend_through_n(mod_code, coin_checker_for_farmed_coin, n):
inner_puzzle_solution = Program.to(output_conditions) inner_puzzle_solution = Program.to(output_conditions)
spend_bundle = spend_bundle_for_spendable_ccs( spend_bundle = spend_bundle_for_spendable_ccs(
mod_code, genesis_coin_checker, spendable_cc_list, [inner_puzzle_solution], mod_code,
genesis_coin_checker,
spendable_cc_list,
[inner_puzzle_solution],
) )
debug_spend_bundle(spend_bundle) debug_spend_bundle(spend_bundle)
@ -187,7 +194,10 @@ def test_spend_through_n(mod_code, coin_checker_for_farmed_coin, n):
] ]
spend_bundle = spend_bundle_for_spendable_ccs( spend_bundle = spend_bundle_for_spendable_ccs(
mod_code, genesis_coin_checker, spendable_cc_list, inner_solutions, mod_code,
genesis_coin_checker,
spendable_cc_list,
inner_solutions,
) )
debug_spend_bundle(spend_bundle) debug_spend_bundle(spend_bundle)

View File

@ -16,7 +16,9 @@ from src.util.hash import std_hash
from src.util.ints import uint32, uint64 from src.util.ints import uint32, uint64
from src.wallet.cc_wallet import cc_utils from src.wallet.cc_wallet import cc_utils
from src.wallet.cc_wallet.cc_wallet import CCWallet from src.wallet.cc_wallet.cc_wallet import CCWallet
from src.wallet.puzzles.genesis_by_coin_id_with_0 import genesis_coin_id_for_genesis_coin_checker from src.wallet.puzzles.genesis_by_coin_id_with_0 import (
genesis_coin_id_for_genesis_coin_checker,
)
from src.wallet.trade_record import TradeRecord from src.wallet.trade_record import TradeRecord
from src.wallet.trading.trade_status import TradeStatus from src.wallet.trading.trade_status import TradeStatus
from src.wallet.trading.trade_store import TradeStore from src.wallet.trading.trade_store import TradeStore

View File

@ -18,9 +18,7 @@ from src.util.merkle_set import (
confirm_not_included_already_hashed, confirm_not_included_already_hashed,
MerkleSet, MerkleSet,
) )
from src.protocols import ( from src.protocols import introducer_protocol, wallet_protocol, full_node_protocol
introducer_protocol, wallet_protocol, full_node_protocol
)
from src.consensus.constants import ConsensusConstants from src.consensus.constants import ConsensusConstants
from src.server.connection import PeerConnections from src.server.connection import PeerConnections
from src.server.server import ChiaServer from src.server.server import ChiaServer
@ -341,9 +339,7 @@ class WalletNode:
return return
conns = self.global_connections conns = self.global_connections
for peer in request.peer_list: for peer in request.peer_list:
conns.peers.add( conns.peers.add(PeerInfo(peer.host, uint16(peer.port)))
PeerInfo(peer.host, uint16(peer.port))
)
# Pseudo-message to close the connection # Pseudo-message to close the connection
yield OutboundMessage(NodeType.INTRODUCER, Message("", None), Delivery.CLOSE) yield OutboundMessage(NodeType.INTRODUCER, Message("", None), Delivery.CLOSE)
@ -364,9 +360,7 @@ class WalletNode:
await asyncio.gather(*tasks) await asyncio.gather(*tasks)
@api_request @api_request
async def respond_peers_full_node( async def respond_peers_full_node(self, request: full_node_protocol.RespondPeers):
self, request: full_node_protocol.RespondPeers
):
pass pass
async def _sync(self): async def _sync(self):