refactor: inline single-use _single_paragraph and _get_contract_info_value helpers#818
refactor: inline single-use _single_paragraph and _get_contract_info_value helpers#818ebios-star wants to merge 2 commits intoentrius:testfrom
Conversation
|
@anderdc @LandynDev — friendly ping for review when you have a moment. Same family as #748 (merged) and #641. Happy to rebase if needed. |
|
Fold your #819 changes into this. No need to have had them separated |
anderdc
left a comment
There was a problem hiding this comment.
Fold all your inline PRs into this one. no need to separate them.
_single_paragraph in cli/issue_commands/help.py was a 3-line wrapper around `' '.join(text.split())`, called from exactly one place (StyledGroup.get_help). Inlining matches the pattern from entrius#748 / entrius#641 (remove single-use indirection); the inlined idiom is conventional Python for collapsing whitespace and reads just as clearly at the call site. `grep -rn _single_paragraph` confirms no other call sites in gittensor/, neurons/, or tests/. No behaviour change — full test suite passes.
_get_contract_info_value in validator/issue_competitions/storage_utils.py was a 3-line wrapper around `contract_info.value if hasattr(...) else contract_info`, called from exactly one place (_extract_trie_id_bytes). Inlining matches the pattern from entrius#748 / entrius#641 (remove single-use indirection). `grep -rn _get_contract_info_value` confirms no other call sites in gittensor/, neurons/, or tests/. The hasattr fallback is preserved verbatim, so all three substrate trie_id shapes covered by test_get_contract_child_storage_key_accepts_multiple_trie_id_formats (str/bytes/list) still resolve identically. Full test suite passes.
61860ba to
78857cb
Compare
|
Done @anderdc — folded #819 into this PR. Branch is now rebased onto current Happy to squash to a single commit if you'd prefer that shape. |
|
Hi @anderdc — thanks for the quick review and clear direction on the consolidation. The requested fold is in: this PR now contains both inline-helper commits, rebased onto current Whenever you have a moment for a re-review, I'd really appreciate it. Happy to address any further feedback or squash to a single commit if that shape works better for you. |
Summary
Folded #819 into this PR per @anderdc's review. Two single-use module-level helpers inlined into their only callers:
_single_paragraphin gittensor/cli/issue_commands/help.py — 3-line wrapper around' '.join(text.split()), called only fromStyledGroup.get_help. Inlined idiom is conventional Python for collapsing whitespace._get_contract_info_valuein gittensor/validator/issue_competitions/storage_utils.py — 3-line wrapper aroundcontract_info.value if hasattr(contract_info, 'value') else contract_info, called only from_extract_trie_id_bytes. Thehasattrfallback is preserved verbatim so all three substratetrie_idshapes (str/bytes/list) covered bytest_get_contract_child_storage_key_accepts_multiple_trie_id_formatsstill resolve identically.grep -rnconfirms a single call site for each helper, no test references.Net: -12 / +2 lines combined, two fewer private helpers.
Type of Change
Testing
uv run --extra dev pytest tests/— all 652 tests pass.tests/utils/test_issue_competitions_storage_utils.py(14 tests, including the multi-formattrie_idtest) covers the storage_utils path and still passes.Checklist