From ae2de64171ebc4af082e570b28226347efcb81fe Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 13 Jan 2025 21:20:04 +0100 Subject: [PATCH] CHIA-2215 Annotate run_block.py (#19128) Annotate run_block.py. --- mypy-exclusions.txt | 1 - tools/run_block.py | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mypy-exclusions.txt b/mypy-exclusions.txt index 6f733f97e0f2..9d079d738df6 100644 --- a/mypy-exclusions.txt +++ b/mypy-exclusions.txt @@ -89,4 +89,3 @@ chia._tests.util.time_out_assert chia._tests.wallet.did_wallet.test_did chia._tests.wallet.rpc.test_wallet_rpc tools.analyze-chain -tools.run_block diff --git a/tools/run_block.py b/tools/run_block.py index e65752692a2c..969aab9427e8 100644 --- a/tools/run_block.py +++ b/tools/run_block.py @@ -40,11 +40,12 @@ import json from pathlib import Path +from typing import Any import click from chia._tests.util.run_block import run_json_block -from chia.consensus.constants import replace_str_to_bytes +from chia.consensus.constants import ConsensusConstants, replace_str_to_bytes from chia.consensus.default_constants import DEFAULT_CONSTANTS from chia.util.config import load_config from chia.util.default_root import DEFAULT_ROOT_PATH @@ -52,12 +53,12 @@ @click.command() @click.argument("filename", type=click.Path(exists=True), default="testnet10.396963.json") -def cmd_run_json_block_file(filename): +def cmd_run_json_block_file(filename: str) -> None: """`file` is a file containing a FullBlock in JSON format""" return run_json_block_file(Path(filename)) -def run_json_block_file(filename: Path): +def run_json_block_file(filename: Path) -> None: full_block = json.load(filename.open("rb")) # pull in current constants from config.yaml _, constants = get_config_and_constants() @@ -68,7 +69,7 @@ def run_json_block_file(filename: Path): print(cat_list_json) -def get_config_and_constants(): +def get_config_and_constants() -> tuple[dict[str, Any], ConsensusConstants]: config = load_config(DEFAULT_ROOT_PATH, "config.yaml") network = config["selected_network"] overrides = config["network_overrides"]["constants"][network]