You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #14872, more autofixes were added for redundant-none-literal (PYI061), but it only applies to Python 3.10+ as the | may not be usable in annotations in <=3.9 in all cases, even with from __future__ import annotations.
I am requesting to either allow the fix on <=3.9 as an "unsafe" autofix.
OR to autofix using typing.Union. Leaving the Union --> | transformation logic to other (UP?) rules.
I also think this fix should always be available using | in type stubs (.pyi files)
Description
In #14872, more autofixes were added for
redundant-none-literal (PYI061)
, but it only applies to Python 3.10+ as the|
may not be usable in annotations in <=3.9 in all cases, even withfrom __future__ import annotations
.I am requesting to either allow the fix on <=3.9 as an "unsafe" autofix.
OR to autofix using
typing.Union
. Leaving theUnion
-->|
transformation logic to other (UP
?) rules.I also think this fix should always be available using
|
in type stubs (.pyi
files)Current vs expected
The following code:
With the following command:
ruff check --fix --unsafe-fixes --preview --select=PYI061 --isolated --target-version=py39
In Ruff 0.9.3:
I expect:
Unsafely autofixed to:
Or safely autofixed to:
The text was updated successfully, but these errors were encountered: