Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion gittensor/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,14 @@ def get_all_file_changes(self) -> List[FileChange]:
return all_file_changes

def add_pull_request(self, pull_request: PullRequest):
"""Helper method to add a pull request and maintain collections."""
"""Helper method to add a pull request and maintain collections.

Automatically tracks the repository in unique_repos_contributed_to
to prevent KeyError in apply_cross_miner_multipliers_and_finalize
when calculating uniqueness multipliers.
"""
self.pull_requests.append(pull_request)
self.unique_repos_contributed_to.add(pull_request.repository_full_name)


class GitPatSynapse(bt.Synapse):
Expand Down
3 changes: 1 addition & 2 deletions gittensor/validator/evaluation/scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ def score_pull_requests(
pr.time_decay_multiplier = round(time_decay_multiplier, 2)
pr.gittensor_tag_multiplier = round(gittensor_tag_multiplier, 2)
pr.merge_success_multiplier = round(merge_success_multiplier, 2)

miner_eval.unique_repos_contributed_to.add(pr.repository_full_name)
# Note: unique_repos_contributed_to is now tracked in MinerEvaluation.add_pull_request()


def count_repository_contributors(miner_evaluations: Dict[int, MinerEvaluation]) -> Dict[str, int]:
Expand Down