deprecated-typing-alias
What it does
Section titled “What it does”Reports a subscript of typing.List, Dict, Set, FrozenSet, Tuple or Type when the target_version makes the builtin generic (3.9 and later).
Why it matters
Section titled “Why it matters”Since Python 3.9 list[int], dict[str, int] and the other builtins are generic, and the typing aliases are deprecated. They also need an import that the builtin does not.
To fix, write the builtin, list[int] for List[int].
Example
Section titled “Example”...
...x: List[int]
...Configuration
Section titled “Configuration”python: lint: rules: deprecated-typing-alias: warn # off (default), warn, errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line deprecated-typing-alias in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | UP006 |
full |