diff options
| -rw-r--r-- | numpy/typing/_callable.pyi (renamed from numpy/typing/_callable.py) | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/typing/_callable.py b/numpy/typing/_callable.pyi index 44ad5c291..e1149f26a 100644 --- a/numpy/typing/_callable.py +++ b/numpy/typing/_callable.pyi @@ -49,6 +49,8 @@ from ._generic_alias import NDArray _T1 = TypeVar("_T1") _T2 = TypeVar("_T2") +_T1_contra = TypeVar("_T1_contra", contravariant=True) +_T2_contra = TypeVar("_T2_contra", contravariant=True) _2Tuple = Tuple[_T1, _T1] _NBit1 = TypeVar("_NBit1", bound=NBitBase) @@ -318,8 +320,8 @@ class _ComplexOp(Protocol[_NBit1]): class _NumberOp(Protocol): def __call__(self, other: _NumberLike_co, /) -> Any: ... -class _ComparisonOp(Protocol[_T1, _T2]): +class _ComparisonOp(Protocol[_T1_contra, _T2_contra]): @overload - def __call__(self, other: _T1, /) -> bool_: ... + def __call__(self, other: _T1_contra, /) -> bool_: ... @overload - def __call__(self, other: _T2, /) -> NDArray[bool_]: ... + def __call__(self, other: _T2_contra, /) -> NDArray[bool_]: ... |
