mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 20:42:10 +00:00
460 B
460 B
prefix-type-params (PYI001)
Derived from the flake8-pyi linter.
What it does
Checks that type TypeVar
, ParamSpec
, and TypeVarTuple
definitions in
stubs are prefixed with _
.
Why is this bad?
By prefixing type parameters with _
, we can avoid accidentally exposing
names internal to the stub.
Example
from typing import TypeVar
T = TypeVar("T")
Use instead:
from typing import TypeVar
_T = TypeVar("_T")