Skip to content

Commit 34aebf1

Browse files
committed
Use protocols from _typeshed
1 parent f0e725a commit 34aebf1

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

stdlib/_operator.pyi

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from _typeshed import SupportsGetItem
2+
from _typeshed import SupportsGetItem, SupportsMul, SupportsRMul
33
from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence
44
from operator import attrgetter as attrgetter, itemgetter as itemgetter, methodcaller as methodcaller
55
from typing import Any, AnyStr, Protocol, SupportsAbs, SupportsIndex, TypeVar, overload, type_check_only
@@ -39,14 +39,6 @@ _SupportsComparison: TypeAlias = _SupportsDunderLE | _SupportsDunderGE | _Suppor
3939
class _SupportsInversion(Protocol[_T_co]):
4040
def __invert__(self) -> _T_co: ...
4141

42-
@type_check_only
43-
class _SupportsMul(Protocol[_T_co, _T_contra]):
44-
def __mul__(self, other: _T_contra, /) -> _T_co: ...
45-
46-
@type_check_only
47-
class _SupportsRMul(Protocol[_T_co, _T_contra]):
48-
def __rmul__(self, other: _T_contra, /) -> _T_co: ...
49-
5042
@type_check_only
5143
class _SupportsNeg(Protocol[_T_co]):
5244
def __neg__(self) -> _T_co: ...
@@ -76,9 +68,9 @@ def invert(a: _SupportsInversion[_T_co], /) -> _T_co: ...
7668
def lshift(a, b, /): ...
7769
def mod(a, b, /): ...
7870
@overload
79-
def mul(a: _SupportsMul[_T_co, _T_contra], b: _T_contra, /) -> _T_co: ...
71+
def mul(a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
8072
@overload
81-
def mul(a: _T_contra, b: _SupportsRMul[_T_co, _T_contra], /) -> _T_co: ...
73+
def mul(a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co: ...
8274
def matmul(a, b, /): ...
8375
def neg(a: _SupportsNeg[_T_co], /) -> _T_co: ...
8476
def or_(a, b, /): ...

0 commit comments

Comments
 (0)