Skip to content

refactor: import emit_json from gittensor.cli.json_output directly#1205

Open
ebios-star wants to merge 1 commit into
entrius:testfrom
ebios-star:refactor/import-emit-json-from-canonical-module
Open

refactor: import emit_json from gittensor.cli.json_output directly#1205
ebios-star wants to merge 1 commit into
entrius:testfrom
ebios-star:refactor/import-emit-json-from-canonical-module

Conversation

@ebios-star
Copy link
Copy Markdown
Contributor

Summary

gittensor/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 in helpers.py itself — the as emit_json alias was the pyright re-export hint so the three downstream call sites (submissions.py, view.py, vote.py) could pick it up via from .helpers import emit_json. grep -n emit_json gittensor/cli/issue_commands/helpers.py confirms 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 source gittensor.cli.json_output and drops the shim from helpers.py. emit_error_json stays imported in helpers because handle_exception() uses it internally.

Changes

  • gittensor/cli/issue_commands/helpers.py — drop from gittensor.cli.json_output import emit_json as emit_json (no other lines touched).
  • gittensor/cli/issue_commands/submissions.py — extend the existing from gittensor.cli.json_output import click_error_type into click_error_type, emit_json, remove emit_json, from the .helpers block.
  • gittensor/cli/issue_commands/view.py — add from gittensor.cli.json_output import emit_json, remove emit_json, from the .helpers block.
  • gittensor/cli/issue_commands/vote.py — same pattern.
  • tests/cli/test_cli_helpers.py — move the test's emit_json import to the canonical module.

Same shape as merged #802 (drop get_contract_address re-export shim from validator/utils/issue_competitions).

Net: +6 / -6 lines across 5 files.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other

Testing

  • pytest tests/ — all 1504 tests pass.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Changes are documented (if applicable)

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).
@xiao-xiao-mao xiao-xiao-mao Bot added the refactor Code restructuring without behavior change label May 12, 2026
@ebios-star
Copy link
Copy Markdown
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Code restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant