mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
[BE]: Enable ruff PIE794 and fix bugs it found in test suite (#112989)
Enables some tests that were incorrectly not being run and enables PIE794 globally. This rule checks if a classvar is defined twice as flags it as it is likely a bug. In fact, we found several cases where it was a bug. It does have a couple of false positives which I flagged upstream and replaced with noqas: https://github.com/astral-sh/ruff/issues/8497 Pull Request resolved: https://github.com/pytorch/pytorch/pull/112989 Approved by: https://github.com/malfet
This commit is contained in:
parent
07123bc198
commit
9c1fb2cbb3
4 changed files with 12 additions and 11 deletions
|
|
@ -77,6 +77,7 @@ select = [
|
|||
"UP",
|
||||
"PERF",
|
||||
"PGH004",
|
||||
"PIE794",
|
||||
"PIE807",
|
||||
"PIE810",
|
||||
"PLE",
|
||||
|
|
|
|||
|
|
@ -1046,11 +1046,11 @@ class NNModuleTests(torch._dynamo.test_case.TestCase):
|
|||
test_cfgmod = make_test(CfgModule())
|
||||
test_stringmember = make_test(StringMember())
|
||||
test_modulelist = make_test(ModuleList())
|
||||
test_modulelist = make_test(CustomGetItemModuleList())
|
||||
test_modulelist_custom = make_test(CustomGetItemModuleList())
|
||||
test_moduledict = make_test(ModuleDict())
|
||||
test_moduledict = make_test(CustomGetItemModuleDict())
|
||||
test_moduledict_custom = make_test(CustomGetItemModuleDict())
|
||||
test_parameterdict = make_test(ParameterDict())
|
||||
test_parameterdict = make_test(CustomGetItemParameterDict())
|
||||
test_parameterdict_custom = make_test(CustomGetItemParameterDict())
|
||||
test_super1 = make_test(SuperModule())
|
||||
test_super2 = make_test(SuperModule2())
|
||||
test_super_class_method = make_test(SuperChildCallsClassMethod())
|
||||
|
|
|
|||
|
|
@ -3257,7 +3257,7 @@ class TestArgmax(TestCase):
|
|||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (itertools.product(usg_data, (np.uint8,)))
|
||||
]
|
||||
darr = darr + [
|
||||
darr += [
|
||||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (
|
||||
itertools.product(
|
||||
|
|
@ -3265,7 +3265,7 @@ class TestArgmax(TestCase):
|
|||
)
|
||||
)
|
||||
]
|
||||
darr = darr + [
|
||||
darr += [
|
||||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (
|
||||
itertools.product(
|
||||
|
|
@ -3366,7 +3366,7 @@ class TestArgmin(TestCase):
|
|||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (itertools.product(usg_data, (np.uint8,)))
|
||||
]
|
||||
darr = darr + [
|
||||
darr += [
|
||||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (
|
||||
itertools.product(
|
||||
|
|
@ -3374,7 +3374,7 @@ class TestArgmin(TestCase):
|
|||
)
|
||||
)
|
||||
]
|
||||
darr = darr + [
|
||||
darr += [
|
||||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (
|
||||
itertools.product(
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ class TestArgmax(TestCase):
|
|||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (itertools.product(usg_data, (np.uint8,)))
|
||||
]
|
||||
darr = darr + [
|
||||
darr += [
|
||||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (
|
||||
itertools.product(
|
||||
|
|
@ -389,7 +389,7 @@ class TestArgmax(TestCase):
|
|||
)
|
||||
)
|
||||
]
|
||||
darr = darr + [
|
||||
darr += [
|
||||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (
|
||||
itertools.product(
|
||||
|
|
@ -505,7 +505,7 @@ class TestArgmin(TestCase):
|
|||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (itertools.product(usg_data, (np.uint8,)))
|
||||
]
|
||||
darr = darr + [
|
||||
darr += [
|
||||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (
|
||||
itertools.product(
|
||||
|
|
@ -513,7 +513,7 @@ class TestArgmin(TestCase):
|
|||
)
|
||||
)
|
||||
]
|
||||
darr = darr + [
|
||||
darr += [
|
||||
(np.array(d[0], dtype=t), d[1])
|
||||
for d, t in (
|
||||
itertools.product(
|
||||
|
|
|
|||
Loading…
Reference in a new issue