Enable all PIE rules on ruff (#165814)

This PR enables all PIE rules on ruff, there are already some enabled rules from this family, the new added rules are
```
PIE796  Enum contains duplicate value: {value}
PIE808  Unnecessary start argument in range
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/165814
Approved by: https://github.com/ezyang
This commit is contained in:
Yuanyuan Chen
2025-10-18 07:36:18 +00:00
committed by PyTorch MergeBot
parent a0948d4d23
commit fdab48a7c1
92 changed files with 200 additions and 205 deletions

View File

@ -1787,7 +1787,7 @@ def _padding_check_valid_input(input, padding, *, dim):
for d in range(1, input_dim):
valid_batch_mode = valid_batch_mode and input.size(d) != 0
else:
for d in range(0, input_dim):
for d in range(input_dim):
valid_non_batch_mode = valid_non_batch_mode and input.size(d) != 0
# allow empty batch size but not other dimensions.