refactor: inline single-use _calculate_base_score adapter - #949
Closed
ebios-star wants to merge 1 commit into
Closed
refactor: inline single-use _calculate_base_score adapter#949ebios-star wants to merge 1 commit into
ebios-star wants to merge 1 commit into
Conversation
…mirror_pr The private `_calculate_base_score` is described in its own docstring as a 'Thin wrapper: run the shared helper and copy fields onto ScoredMirrorPR' and has exactly one caller. It mutates seven fields on `scored` while returning only `base_score`, hiding the bulk of its side effects behind a misleading return signature. Inlining moves the field-copying out into the caller alongside the `scored.base_score = ...` assignment that already lived there, so all eight mutations are visible on one block. The shared helper `calculate_base_score_for_pr_files` (which actually computes the score) is unaffected and still callable from any future site that wants a non-mutating result. `grep -rn _calculate_base_score` confirms no other call sites or test references in `gittensor/`, `neurons/`, or `tests/`.
Contributor
Author
|
@anderdc whenever you have a moment, this is a small inline of a single-use adapter that the wrapper itself describes as a thin wrapper. Happy to revise or scope differently if you'd prefer. Thanks! |
8 tasks
Collaborator
|
Closing — please consolidate into #917. |
8 tasks
Contributor
Author
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
_calculate_base_scorein gittensor/validator/oss_contributions/mirror/scoring.py is described in its own docstring as a "Thin wrapper: run the shared helper and copy fields onto ScoredMirrorPR" and has exactly one caller (score_mirror_pr).The wrapper mutates seven fields on
scoredwhile returning onlybase_score, hiding most of its side effects behind a misleading return signature — the only visible mutation at the call site isscored.base_score = .... Inlining moves the field-copying out into the caller alongside that existing assignment, so all eight mutations land on one block inscore_mirror_pr.The shared helper
calculate_base_score_for_pr_files(which actually performs the computation) is unaffected and still callable from any future non-mutating consumer.grep -rn _calculate_base_scoreconfirms no other call sites or test references ingittensor/,neurons/, ortests/.Net: -20 / +9 lines, one fewer module-level helper.
Type of Change
Testing
pytest tests/— all 726 tests pass.Checklist