Skip to content

Commit d14ca76

Browse files
committed
Add typeshed _operator revert patches
1 parent 256eb9c commit d14ca76

2 files changed

Lines changed: 159 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
From 1c577fac65b2294e53d84f6b2e11dbd0fe60245f Mon Sep 17 00:00:00 2001
2+
From: hauntsaninja <hauntsaninja@gmail.com>
3+
Date: Wed, 6 May 2026 18:55:50 -0700
4+
Subject: [PATCH] Revert "[_operator] Type `add` and `sub` (#15601)"
5+
6+
---
7+
mypy/typeshed/stdlib/_operator.pyi | 22 +++-------------------
8+
1 file changed, 3 insertions(+), 19 deletions(-)
9+
10+
diff --git a/mypy/typeshed/stdlib/_operator.pyi b/mypy/typeshed/stdlib/_operator.pyi
11+
index e7d85f811..8bfb43245 100644
12+
--- a/mypy/typeshed/stdlib/_operator.pyi
13+
+++ b/mypy/typeshed/stdlib/_operator.pyi
14+
@@ -1,15 +1,5 @@
15+
import sys
16+
-from _typeshed import (
17+
- SupportsAdd,
18+
- SupportsGetItem,
19+
- SupportsMod,
20+
- SupportsMul,
21+
- SupportsRAdd,
22+
- SupportsRMod,
23+
- SupportsRMul,
24+
- SupportsRSub,
25+
- SupportsSub,
26+
-)
27+
+from _typeshed import SupportsGetItem, SupportsMod, SupportsMul, SupportsRMod, SupportsRMul
28+
from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence
29+
from operator import attrgetter as attrgetter, itemgetter as itemgetter, methodcaller as methodcaller
30+
from typing import Any, AnyStr, Protocol, SupportsAbs, SupportsIndex, TypeVar, overload, type_check_only
31+
@@ -69,10 +59,7 @@ def truth(a: object, /) -> bool: ...
32+
def is_(a: object, b: object, /) -> bool: ...
33+
def is_not(a: object, b: object, /) -> bool: ...
34+
def abs(a: SupportsAbs[_T], /) -> _T: ...
35+
-@overload
36+
-def add(a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
37+
-@overload
38+
-def add(a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co: ...
39+
+def add(a, b, /): ...
40+
def and_(a, b, /): ...
41+
def floordiv(a, b, /): ...
42+
def index(a: SupportsIndex, /) -> int: ...
43+
@@ -93,10 +80,7 @@ def or_(a, b, /): ...
44+
def pos(a: _SupportsPos[_T_co], /) -> _T_co: ...
45+
def pow(a, b, /): ...
46+
def rshift(a, b, /): ...
47+
-@overload
48+
-def sub(a: SupportsSub[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
49+
-@overload
50+
-def sub(a: _T_contra, b: SupportsRSub[_T_contra, _T_co], /) -> _T_co: ...
51+
+def sub(a, b, /): ...
52+
def truediv(a, b, /): ...
53+
def xor(a, b, /): ...
54+
def concat(a: Sequence[_T], b: Sequence[_T], /) -> Sequence[_T]: ...
55+
--
56+
2.53.0
57+
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
From 256eb9c40202a37f3c2eb124f92f558bbc6e16ab Mon Sep 17 00:00:00 2001
2+
From: hauntsaninja <hauntsaninja@gmail.com>
3+
Date: Wed, 6 May 2026 18:55:54 -0700
4+
Subject: [PATCH] Revert "[_operator] Type `mul` and remove `Any`s that can be
5+
improved (#15598)"
6+
7+
---
8+
mypy/typeshed/stdlib/_operator.pyi | 57 ++++++++++++++----------------
9+
1 file changed, 27 insertions(+), 30 deletions(-)
10+
11+
diff --git a/mypy/typeshed/stdlib/_operator.pyi b/mypy/typeshed/stdlib/_operator.pyi
12+
index 8bfb43245..54bff9329 100644
13+
--- a/mypy/typeshed/stdlib/_operator.pyi
14+
+++ b/mypy/typeshed/stdlib/_operator.pyi
15+
@@ -1,5 +1,5 @@
16+
import sys
17+
-from _typeshed import SupportsGetItem, SupportsMod, SupportsMul, SupportsRMod, SupportsRMul
18+
+from _typeshed import SupportsGetItem, SupportsMod, SupportsRMod
19+
from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence
20+
from operator import attrgetter as attrgetter, itemgetter as itemgetter, methodcaller as methodcaller
21+
from typing import Any, AnyStr, Protocol, SupportsAbs, SupportsIndex, TypeVar, overload, type_check_only
22+
@@ -59,30 +59,27 @@ def truth(a: object, /) -> bool: ...
23+
def is_(a: object, b: object, /) -> bool: ...
24+
def is_not(a: object, b: object, /) -> bool: ...
25+
def abs(a: SupportsAbs[_T], /) -> _T: ...
26+
-def add(a, b, /): ...
27+
-def and_(a, b, /): ...
28+
-def floordiv(a, b, /): ...
29+
+def add(a: Any, b: Any, /) -> Any: ...
30+
+def and_(a: Any, b: Any, /) -> Any: ...
31+
+def floordiv(a: Any, b: Any, /) -> Any: ...
32+
def index(a: SupportsIndex, /) -> int: ...
33+
def inv(a: _SupportsInversion[_T_co], /) -> _T_co: ...
34+
def invert(a: _SupportsInversion[_T_co], /) -> _T_co: ...
35+
-def lshift(a, b, /): ...
36+
+def lshift(a: Any, b: Any, /) -> Any: ...
37+
@overload
38+
def mod(a: SupportsMod[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
39+
@overload
40+
def mod(a: _T_contra, b: SupportsRMod[_T_contra, _T_co], /) -> _T_co: ...
41+
-@overload
42+
-def mul(a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
43+
-@overload
44+
-def mul(a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co: ...
45+
-def matmul(a, b, /): ...
46+
+def mul(a: Any, b: Any, /) -> Any: ...
47+
+def matmul(a: Any, b: Any, /) -> Any: ...
48+
def neg(a: _SupportsNeg[_T_co], /) -> _T_co: ...
49+
-def or_(a, b, /): ...
50+
+def or_(a: Any, b: Any, /) -> Any: ...
51+
def pos(a: _SupportsPos[_T_co], /) -> _T_co: ...
52+
-def pow(a, b, /): ...
53+
-def rshift(a, b, /): ...
54+
-def sub(a, b, /): ...
55+
-def truediv(a, b, /): ...
56+
-def xor(a, b, /): ...
57+
+def pow(a: Any, b: Any, /) -> Any: ...
58+
+def rshift(a: Any, b: Any, /) -> Any: ...
59+
+def sub(a: Any, b: Any, /) -> Any: ...
60+
+def truediv(a: Any, b: Any, /) -> Any: ...
61+
+def xor(a: Any, b: Any, /) -> Any: ...
62+
def concat(a: Sequence[_T], b: Sequence[_T], /) -> Sequence[_T]: ...
63+
def contains(a: Container[object], b: object, /) -> bool: ...
64+
def countOf(a: Iterable[object], b: object, /) -> int: ...
65+
@@ -104,20 +101,20 @@ def setitem(a: MutableSequence[_T], b: slice[int | None], c: Sequence[_T], /) ->
66+
@overload
67+
def setitem(a: MutableMapping[_K, _V], b: _K, c: _V, /) -> None: ...
68+
def length_hint(obj: object, default: int = 0, /) -> int: ...
69+
-def iadd(a, b, /): ...
70+
-def iand(a, b, /): ...
71+
-def iconcat(a, b, /): ...
72+
-def ifloordiv(a, b, /): ...
73+
-def ilshift(a, b, /): ...
74+
-def imod(a, b, /): ...
75+
-def imul(a, b, /): ...
76+
-def imatmul(a, b, /): ...
77+
-def ior(a, b, /): ...
78+
-def ipow(a, b, /): ...
79+
-def irshift(a, b, /): ...
80+
-def isub(a, b, /): ...
81+
-def itruediv(a, b, /): ...
82+
-def ixor(a, b, /): ...
83+
+def iadd(a: Any, b: Any, /) -> Any: ...
84+
+def iand(a: Any, b: Any, /) -> Any: ...
85+
+def iconcat(a: Any, b: Any, /) -> Any: ...
86+
+def ifloordiv(a: Any, b: Any, /) -> Any: ...
87+
+def ilshift(a: Any, b: Any, /) -> Any: ...
88+
+def imod(a: Any, b: Any, /) -> Any: ...
89+
+def imul(a: Any, b: Any, /) -> Any: ...
90+
+def imatmul(a: Any, b: Any, /) -> Any: ...
91+
+def ior(a: Any, b: Any, /) -> Any: ...
92+
+def ipow(a: Any, b: Any, /) -> Any: ...
93+
+def irshift(a: Any, b: Any, /) -> Any: ...
94+
+def isub(a: Any, b: Any, /) -> Any: ...
95+
+def itruediv(a: Any, b: Any, /) -> Any: ...
96+
+def ixor(a: Any, b: Any, /) -> Any: ...
97+
98+
if sys.version_info >= (3, 11):
99+
def call(obj: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
100+
--
101+
2.53.0
102+

0 commit comments

Comments
 (0)