An annotation uses typing.List, Dict or another alias where the builtin type takes parameters
What it finds
Since Python 3.9 the builtin collections take type parameters themselves: list[int], dict[str, int], tuple[int, ...], set[str], frozenset[str] and type[C]. typing.List and the other aliases are deprecated duplicates. Reported are those aliases from typing in annotations; stubs keep their style.
From the rule's source, legacy_typing_generic.rs.
import typingfrom typing import List def group(items: List[str]) -> dict[str, int]:tx0 reports: List is a deprecated alias of list seen: typing.Set[str] = set()tx0 reports: typing.Set is a deprecated alias of set return {} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:legacy-typing-generic" = "note"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:legacy-typing-generic] reason="..."tx0 explain tx0/python:legacy-typing-generic shows the same in the terminal. Found a false positive? Report it.