From 5bf220a90bd535f924c337aebc2e9d8b38890d4a Mon Sep 17 00:00:00 2001 From: niv vaknin Date: Tue, 7 Jan 2025 20:06:02 +0200 Subject: [PATCH 1/3] Fix command dep bug --- Quorum/entry_points/quorum_cli.py | 54 ++++++++++++++++++++++--------- version | 2 +- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/Quorum/entry_points/quorum_cli.py b/Quorum/entry_points/quorum_cli.py index 06d4582..64f6a7c 100644 --- a/Quorum/entry_points/quorum_cli.py +++ b/Quorum/entry_points/quorum_cli.py @@ -2,22 +2,16 @@ import argparse from pydantic import BaseModel -from typing import Callable +from typing import Callable, Optional import Quorum.entry_points.cli_arguments as cli_args -from Quorum.entry_points.implementations.check_proposal import run_single -from Quorum.entry_points.implementations.check_proposal_config import run_config -from Quorum.entry_points.implementations.check_proposal_id import run_proposal_id -from Quorum.entry_points.implementations.create_report import run_create_report -from Quorum.entry_points.implementations.ipfs_validator import run_ipfs_validator -from Quorum.entry_points.implementations.setup_quorum import run_setup_quorum class Command(BaseModel): name: str help: str arguments: list[cli_args.Argument] - func: Callable[[argparse.Namespace], None] + func: Optional[Callable[[argparse.Namespace], None]] COMMAND_REGISTRY = [ @@ -29,13 +23,13 @@ class Command(BaseModel): cli_args.CHAIN_ARGUMENT, cli_args.PROPOSAL_ADDRESS_ARGUMENT ], - func=run_single + func=None ), Command( name="validate-batch", help="Run a batch check from a JSON config file.", arguments=[cli_args.CONFIG_ARGUMENT], - func=run_config + func=None ), Command( name="validate-by-id", @@ -44,7 +38,7 @@ class Command(BaseModel): cli_args.CUSTOMER_ARGUMENT, cli_args.PROPOSAL_ID_ARGUMENT ], - func=run_proposal_id + func=None ), Command( name="create-report", @@ -54,7 +48,7 @@ class Command(BaseModel): cli_args.TEMPLATE_ARGUMENT, cli_args.GENERATE_REPORT_PATH_ARGUMENT ], - func=run_create_report + func=None ), Command( name="validate-ipfs", @@ -65,13 +59,13 @@ class Command(BaseModel): cli_args.PROPOSAL_ADDRESS_ARGUMENT, cli_args.PROMPT_TEMPLATES_ARGUMENT ], - func=run_ipfs_validator + func=None ), Command( name="setup", help="Initial Quorum environment setup.", arguments=[cli_args.WORKING_DIR_ARGUMENT], - func=run_setup_quorum + func=None ) ] @@ -105,7 +99,37 @@ def main(): help=subcmd.help ) add_arguments(subparser, subcmd.arguments) - subparser.set_defaults(func=subcmd.func) + + if subcmd.name == "validate-address": + def run(args): + from Quorum.entry_points.implementations.check_proposal import run_single + run_single(args) + subparser.set_defaults(func=run) + elif subcmd.name == "validate-batch": + def run(args): + from Quorum.entry_points.implementations.check_proposal_config import run_config + run_config(args) + subparser.set_defaults(func=run) + elif subcmd.name == "validate-by-id": + def run(args): + from Quorum.entry_points.implementations.check_proposal_id import run_proposal_id + run_proposal_id(args) + subparser.set_defaults(func=run) + elif subcmd.name == "create-report": + def run(args): + from Quorum.entry_points.implementations.create_report import run_create_report + run_create_report(args) + subparser.set_defaults(func=run) + elif subcmd.name == "validate-ipfs": + def run(args): + from Quorum.entry_points.implementations.ipfs_validator import run_ipfs_validator + run_ipfs_validator(args) + subparser.set_defaults(func=run) + elif subcmd.name == "setup": + def run(args): + from Quorum.entry_points.implementations.setup_quorum import run_setup_quorum + run_setup_quorum(args) + subparser.set_defaults(func=run) args = parser.parse_args() diff --git a/version b/version index 2ae53ac..b2c73a0 100644 --- a/version +++ b/version @@ -1 +1 @@ -20250107.151758.528252 +20250107.200603.277347 From 91d2fc4dffdcc1c837b0d35ec01ab57bb02627c2 Mon Sep 17 00:00:00 2001 From: niv vaknin Date: Tue, 7 Jan 2025 20:10:59 +0200 Subject: [PATCH 2/3] No need func in command --- Quorum/entry_points/quorum_cli.py | 19 ++++++------------- version | 2 +- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Quorum/entry_points/quorum_cli.py b/Quorum/entry_points/quorum_cli.py index 64f6a7c..d6cb7ea 100644 --- a/Quorum/entry_points/quorum_cli.py +++ b/Quorum/entry_points/quorum_cli.py @@ -11,7 +11,6 @@ class Command(BaseModel): name: str help: str arguments: list[cli_args.Argument] - func: Optional[Callable[[argparse.Namespace], None]] COMMAND_REGISTRY = [ @@ -22,14 +21,12 @@ class Command(BaseModel): cli_args.CUSTOMER_ARGUMENT, cli_args.CHAIN_ARGUMENT, cli_args.PROPOSAL_ADDRESS_ARGUMENT - ], - func=None + ] ), Command( name="validate-batch", help="Run a batch check from a JSON config file.", - arguments=[cli_args.CONFIG_ARGUMENT], - func=None + arguments=[cli_args.CONFIG_ARGUMENT] ), Command( name="validate-by-id", @@ -37,8 +34,7 @@ class Command(BaseModel): arguments=[ cli_args.CUSTOMER_ARGUMENT, cli_args.PROPOSAL_ID_ARGUMENT - ], - func=None + ] ), Command( name="create-report", @@ -47,8 +43,7 @@ class Command(BaseModel): cli_args.PROPOSAL_ID_ARGUMENT, cli_args.TEMPLATE_ARGUMENT, cli_args.GENERATE_REPORT_PATH_ARGUMENT - ], - func=None + ] ), Command( name="validate-ipfs", @@ -58,14 +53,12 @@ class Command(BaseModel): cli_args.CHAIN_ARGUMENT, cli_args.PROPOSAL_ADDRESS_ARGUMENT, cli_args.PROMPT_TEMPLATES_ARGUMENT - ], - func=None + ] ), Command( name="setup", help="Initial Quorum environment setup.", - arguments=[cli_args.WORKING_DIR_ARGUMENT], - func=None + arguments=[cli_args.WORKING_DIR_ARGUMENT] ) ] diff --git a/version b/version index b2c73a0..1e1706a 100644 --- a/version +++ b/version @@ -1 +1 @@ -20250107.200603.277347 +20250107.201100.319230 From 79b3dd65b0abab80f3d3e8164d33d43c6336677b Mon Sep 17 00:00:00 2001 From: niv vaknin Date: Tue, 7 Jan 2025 20:15:06 +0200 Subject: [PATCH 3/3] Remove redundant imports --- Quorum/entry_points/quorum_cli.py | 1 - version | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Quorum/entry_points/quorum_cli.py b/Quorum/entry_points/quorum_cli.py index d6cb7ea..0e4c40f 100644 --- a/Quorum/entry_points/quorum_cli.py +++ b/Quorum/entry_points/quorum_cli.py @@ -2,7 +2,6 @@ import argparse from pydantic import BaseModel -from typing import Callable, Optional import Quorum.entry_points.cli_arguments as cli_args diff --git a/version b/version index 1e1706a..70388c5 100644 --- a/version +++ b/version @@ -1 +1 @@ -20250107.201100.319230 +20250107.201507.181876