[flake8-pyi
] Add autofix for unused-private-type-var
(PYI018
)
#15940
Labels
fixes
Related to suggested fixes for violations
good first issue
Good for newcomers
help wanted
Contributions especially welcome
We currently offer a diagnostic for unused private type variables like these:
But it would be nice to offer a fix to delete them too. This came up in #15682 because a PYI018 autofix would finish the transformation of pre-PEP-695 code like this:
to
by converting from
Generic
+ standaloneTypeVar
to PEP-695 generics (UP046, renaming the private generic (UP051), and then removing the now-unused private type variable (PYI018 after this issue).The function implementing this rule can be found here. I think
delete_stmt
may help with the implementation, with some examples of its usage here and here.The text was updated successfully, but these errors were encountered: