mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:15:12 +00:00

## Summary Similar to #11414, this PR extends `UP037` to flag quoted annotations that are located in positions that won't be evaluated at runtime. For example, the quotes on `Tuple` are unnecessary in: ```python from typing import TYPE_CHECKING if TYPE_CHECKING: from typing import Tuple def foo(): x: "Tuple[int, int]" = (0, 0) foo() ```
14 lines
190 B
Python
14 lines
190 B
Python
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from typing import Tuple
|
|
|
|
|
|
def foo():
|
|
# UP037
|
|
x: "Tuple[int, int]" = (0, 0)
|
|
print(x)
|
|
|
|
|
|
# OK
|
|
X: "Tuple[int, int]" = (0, 0)
|