refactor: import emit_json from gittensor.cli.json_output directly#1205
Open
ebios-star wants to merge 1 commit into
Open
refactor: import emit_json from gittensor.cli.json_output directly#1205ebios-star wants to merge 1 commit into
ebios-star wants to merge 1 commit into
Conversation
cli/issue_commands/helpers.py carried a re-export shim 'from gittensor.cli.json_output import emit_json as emit_json' with no internal use — the 'as emit_json' alias was the pyright re-export hint so submissions.py / view.py / vote.py could pick it up via 'from .helpers import emit_json'. Route those three call sites (and tests/cli/test_cli_helpers.py) at the canonical source instead, and drop the shim. emit_error_json stays imported in helpers because handle_exception() uses it internally. Same pattern as entrius#802 (drop get_contract_address re-export shim from validator/utils/issue_competitions).
Contributor
Author
|
@anderdc whenever you have a moment, this drops a pyright re-export shim and points the three call sites + their test at the canonical json_output module. Happy to revise scope if you'd prefer. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gittensor/cli/issue_commands/helpers.pycarried a re-export shim:with no internal use in
helpers.pyitself — theas emit_jsonalias was the pyright re-export hint so the three downstream call sites (submissions.py,view.py,vote.py) could pick it up viafrom .helpers import emit_json.grep -n emit_json gittensor/cli/issue_commands/helpers.pyconfirms the import line is the only mention of the name in that module.This PR routes those three call sites — plus the equivalent test import in
tests/cli/test_cli_helpers.py— at the canonical sourcegittensor.cli.json_outputand drops the shim fromhelpers.py.emit_error_jsonstays imported inhelpersbecausehandle_exception()uses it internally.Changes
gittensor/cli/issue_commands/helpers.py— dropfrom gittensor.cli.json_output import emit_json as emit_json(no other lines touched).gittensor/cli/issue_commands/submissions.py— extend the existingfrom gittensor.cli.json_output import click_error_typeintoclick_error_type, emit_json, removeemit_json,from the.helpersblock.gittensor/cli/issue_commands/view.py— addfrom gittensor.cli.json_output import emit_json, removeemit_json,from the.helpersblock.gittensor/cli/issue_commands/vote.py— same pattern.tests/cli/test_cli_helpers.py— move the test'semit_jsonimport to the canonical module.Same shape as merged #802 (drop
get_contract_addressre-export shim fromvalidator/utils/issue_competitions).Net: +6 / -6 lines across 5 files.
Type of Change
Testing
pytest tests/— all 1504 tests pass.Checklist