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 06:40:12 +00:00
committed by PyTorch MergeBot
parent e595136187
commit c79dfdc655
91 changed files with 195 additions and 200 deletions

View File

@ -1559,7 +1559,7 @@ class TestOldViewOps(TestCase):
self.compare_with_numpy(torch_fn, np_fn, x, device=None, dtype=None)
def _test_atleast_dim(self, torch_fn, np_fn, device, dtype):
for ndims in range(0, 5):
for ndims in range(5):
shape = _rand_shape(ndims, min_size=5, max_size=10)
for _ in range(ndims + 1):
for with_extremal in [False, True]: