typevar-double-variance / C0131#

Message emitted:

TypeVar cannot be both covariant and contravariant

Description:

Emitted when both the "covariant" and "contravariant" keyword arguments are set to "True" in a TypeVar.

Correct code:

from typing import TypeVar

T_co = TypeVar("T_co", covariant=True)
T_contra = TypeVar("T_contra", contravariant=True)

Problematic code:

from typing import TypeVar

T = TypeVar("T", covariant=True, contravariant=True)  # [typevar-double-variance]

Created by the basic checker.