We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ruff seems to add unnecessary parentheses when automatically fixing UP007 related errors.
test.py:
from typing import Union def sample(a: Union[str, int, list]): print(a)
The ruff command used:
ruff check --select UP007 --target-version py311 --fix --unsafe-fixes test.py
test.py after being modified by Ruff:
from typing import Union def sample(a: str | (int | list)): print(a)
Based on https://docs.python.org/3.11/library/stdtypes.html#union-type
from typing import Union def sample(a: str | int | list): print(a)
would be okay unless I'm missing something?
The text was updated successfully, but these errors were encountered:
Thanks for reporting. This seems reasonable to fix, although I do not know why it is that way in the first place.
Sorry, something went wrong.
I believe this was fixed in #8610.
No branches or pull requests
Ruff seems to add unnecessary parentheses when automatically fixing UP007 related errors.
test.py:
The ruff command used:
test.py after being modified by Ruff:
Based on https://docs.python.org/3.11/library/stdtypes.html#union-type
would be okay unless I'm missing something?
The text was updated successfully, but these errors were encountered: