From 624674328a5150b1d56e51e856b8eb5515b36821 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 4 Dec 2024 10:29:47 -0500 Subject: [PATCH 1/2] localize signer cmd import loop --- chia/cmds/chia.py | 2 -- chia/cmds/wallet.py | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/chia/cmds/chia.py b/chia/cmds/chia.py index bba5754c5b1e..ae1350ce22ce 100644 --- a/chia/cmds/chia.py +++ b/chia/cmds/chia.py @@ -137,8 +137,6 @@ def run_daemon_cmd(ctx: click.Context, wait_for_unlock: bool) -> None: def main() -> None: - import chia.cmds.signer # noqa - cli() diff --git a/chia/cmds/wallet.py b/chia/cmds/wallet.py index aef8f2a80029..a93821009847 100644 --- a/chia/cmds/wallet.py +++ b/chia/cmds/wallet.py @@ -34,6 +34,14 @@ def wallet_cmd(ctx: click.Context) -> None: pass +# TODO: must come after the definition above because of an import loop. the command +# class framework should be expanded to support definition without a group to be a +# member of and later attachment to a group using standard click mechanisms. + + +import chia.cmds.signer # noqa: E402, F401 + + @wallet_cmd.command("get_transaction", help="Get a transaction") @click.option( "-wp", From 2a0c6c72a139ad4e6d0b14212717c3fa32048436 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Wed, 4 Dec 2024 11:05:54 -0500 Subject: [PATCH 2/2] and the signer group can actually be turned inside out too --- chia/cmds/signer.py | 2 +- chia/cmds/wallet.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/chia/cmds/signer.py b/chia/cmds/signer.py index b5afcd803a10..c5e7ac8fcced 100644 --- a/chia/cmds/signer.py +++ b/chia/cmds/signer.py @@ -38,7 +38,7 @@ def _clear_screen() -> None: os.system("cls" if os.name == "nt" else "clear") -@wallet_cmd.group("signer", help="Get information for an external signer") +@click.group("signer", help="Get information for an external signer") def signer_cmd() -> None: pass # pragma: no cover diff --git a/chia/cmds/wallet.py b/chia/cmds/wallet.py index a93821009847..14dddf5d46da 100644 --- a/chia/cmds/wallet.py +++ b/chia/cmds/wallet.py @@ -39,7 +39,10 @@ def wallet_cmd(ctx: click.Context) -> None: # member of and later attachment to a group using standard click mechanisms. -import chia.cmds.signer # noqa: E402, F401 +import chia.cmds.signer # noqa: E402 + +# TODO: ignoring as i'm guessing this is tied to the import loop +wallet_cmd.add_command(chia.cmds.signer.signer_cmd) # type: ignore[has-type] @wallet_cmd.command("get_transaction", help="Get a transaction")