Enable ruff FURB161 rule (#164654)

This PR enables FURB161 in ruff.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/164654
Approved by: https://github.com/Skylion007
This commit is contained in:
Yuanyuan Chen
2025-10-04 23:26:28 +00:00
committed by PyTorch MergeBot
parent 5ed4270440
commit cf0a00d4f3
2 changed files with 1 additions and 2 deletions

View File

@ -187,7 +187,6 @@ ignore = [
# TODO: Remove Python-3.10 specific suppressions
"B905",
"UP035",
"FURB161",
]
select = [
"B",

View File

@ -235,7 +235,7 @@ class TestBitCount(TestCase):
def test_small(self, itype):
for a in range(max(np.iinfo(itype).min, 0), 128):
msg = f"Smoke test for {itype}({a}).bit_count()"
assert itype(a).bit_count() == bin(a).count("1"), msg
assert itype(a).bit_count() == a.bit_count(), msg
def test_bit_count(self):
for exp in [10, 17, 63]: