Open goodspark opened 2 months ago
I believe that's because 'Something' | None
is not a valid type annotation -- it will error at runtime.
If you add from __future__ import annotations
, we do correctly flag all four, since the type annotations are then deferred.
So I think this is working as intended, AFAICT.
I guess another fix I was envisioning was "Something | None"
(note both Something and None are in strings).
Keywords: forward reference, pyupgrade, UP007
Python 3.12, also 3.10 Ruff 0.6.1, also 0.5.7 Command:
ruff check .
Code:
Python file
pyproject.toml