A type statement uses a type variable made with TypeVar instead of declaring it in brackets
What it finds
In type Pair = tuple[T, T], an old-style T = TypeVar("T") is not a parameter of the alias, and type checkers reject it or treat the alias as not generic. type Pair[T] = tuple[T, T] declares the parameter.
From the rule's source, old_typevar_in_alias.rs.
from typing import TypeVar T = TypeVar("T") type Pair = tuple[T, T]tx0 reports: this TypeVar is not a parameter of the aliastype Good[U] = tuple[U, U] Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:old-typevar-in-alias" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:old-typevar-in-alias] reason="..."tx0 explain tx0/python:old-typevar-in-alias shows the same in the terminal. Found a false positive? Report it.