BSK-E0055
error
Invalid TypeVar / TypeVarTuple / ParamSpec keyword argument combination
PEP 484 / PEP 695 forbid certain combinations of keyword arguments in TypeVar(...) calls, and PEP 646 / PEP 612 restrict what kwargs TypeVarTuple and ParamSpec accept:
1. covariant=True and contravariant=True together — a TypeVar cannot be both covariant and contravariant. 2. infer_variance=True with covariant=True or contravariant=True — when variance is inferred, the explicit flags are redundant and disallowed. 3. Constraints (2+ positional type args) combined with bound= — a TypeVar may have one or the other, but not both. 4. TypeVarTuple and ParamSpec do not support covariant, contravariant, bound, or type constraint arguments.
from typing import TypeVar, TypeVarTuple
T1 = TypeVar("T1", covariant=True, contravariant=True) # E
T2 = TypeVar("T2", covariant=True, infer_variance=True) # E
T3 = TypeVar("T3", str, int, bound="int") # E
Ts = TypeVarTuple("Ts", covariant=True) # E
Ts2 = TypeVarTuple("Ts2", int, float) # E
How to handle it
Every rule is on by default — strict is the default, not a cage. You can dial
BSK-E0055 down per-file or per-path from your editor or
pyproject.toml, or fix the code
so it type-checks. See the Type System rules and
the complete diagnostic reference.
Canonical URL: https://www.basilisk-python.dev/errors/BSK-E0055