[BE]: Enable ruff rule SIM113 (#147290)

Lint rules that tells the user to avoid keeping track of their own counter and use the builtin enumerate when possible.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/147290
Approved by: https://github.com/jansel
This commit is contained in:
Aaron Gokaslan
2025-02-16 22:41:13 +00:00
committed by PyTorch MergeBot
parent a8fa4bcfd2
commit e738f7ba23
15 changed files with 22 additions and 35 deletions

View File

@ -861,9 +861,8 @@ class DecisionEvaluator:
"""
y_true = self.df["actual_winner"] if self.ranking else self.df["winner"]
i = 0
for pred, true, prob, leaf_id in zip(
self.predictions, y_true, self.probas, self.leaf_ids
for i, (pred, true, prob, leaf_id) in enumerate(
zip(self.predictions, y_true, self.probas, self.leaf_ids)
):
avail_choices = self.df["avail_choices"].iloc[i]
top_k_choices = self.top_k_classes(
@ -884,7 +883,6 @@ class DecisionEvaluator:
i,
)
self.eval_ranking_prediction(true, top_k_choices, i)
i += 1
total = len(self.predictions)
if return_safe_proba: