Skip to content

Commit 386c3a3

Browse files
committed
Add typeshed operator revert patch
1 parent 7f38b86 commit 386c3a3

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
From 7f38b86464d59188a87ff8c9913c257e788a2f0b Mon Sep 17 00:00:00 2001
2+
From: hauntsaninja <hauntsaninja@gmail.com>
3+
Date: Wed, 6 May 2026 19:49:41 -0700
4+
Subject: [PATCH] Revert operator changes
5+
6+
---
7+
mypy/typeshed/stdlib/_operator.pyi | 51 ++++++++----------------------
8+
1 file changed, 14 insertions(+), 37 deletions(-)
9+
10+
diff --git a/mypy/typeshed/stdlib/_operator.pyi b/mypy/typeshed/stdlib/_operator.pyi
11+
index e7d85f811..8c705065b 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
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+
@@ -18,7 +8,6 @@ from typing_extensions import ParamSpec, TypeAlias, TypeIs
32+
_R = TypeVar("_R")
33+
_T = TypeVar("_T")
34+
_T_co = TypeVar("_T_co", covariant=True)
35+
-_T_contra = TypeVar("_T_contra", contravariant=True)
36+
_K = TypeVar("_K")
37+
_V = TypeVar("_V")
38+
_P = ParamSpec("_P")
39+
@@ -69,36 +58,24 @@ def truth(a: object, /) -> bool: ...
40+
def is_(a: object, b: object, /) -> bool: ...
41+
def is_not(a: object, b: object, /) -> bool: ...
42+
def abs(a: SupportsAbs[_T], /) -> _T: ...
43+
-@overload
44+
-def add(a: SupportsAdd[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
45+
-@overload
46+
-def add(a: _T_contra, b: SupportsRAdd[_T_contra, _T_co], /) -> _T_co: ...
47+
-def and_(a, b, /): ...
48+
-def floordiv(a, b, /): ...
49+
+def add(a: Any, b: Any, /) -> Any: ...
50+
+def and_(a: Any, b: Any, /) -> Any: ...
51+
+def floordiv(a: Any, b: Any, /) -> Any: ...
52+
def index(a: SupportsIndex, /) -> int: ...
53+
def inv(a: _SupportsInversion[_T_co], /) -> _T_co: ...
54+
def invert(a: _SupportsInversion[_T_co], /) -> _T_co: ...
55+
-def lshift(a, b, /): ...
56+
-@overload
57+
-def mod(a: SupportsMod[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
58+
-@overload
59+
-def mod(a: _T_contra, b: SupportsRMod[_T_contra, _T_co], /) -> _T_co: ...
60+
-@overload
61+
-def mul(a: SupportsMul[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
62+
-@overload
63+
-def mul(a: _T_contra, b: SupportsRMul[_T_contra, _T_co], /) -> _T_co: ...
64+
-def matmul(a, b, /): ...
65+
+def lshift(a: Any, b: Any, /) -> Any: ...
66+
+def mod(a: Any, b: Any, /) -> Any: ...
67+
+def mul(a: Any, b: Any, /) -> Any: ...
68+
+def matmul(a: Any, b: Any, /) -> Any: ...
69+
def neg(a: _SupportsNeg[_T_co], /) -> _T_co: ...
70+
-def or_(a, b, /): ...
71+
+def or_(a: Any, b: Any, /) -> Any: ...
72+
def pos(a: _SupportsPos[_T_co], /) -> _T_co: ...
73+
-def pow(a, b, /): ...
74+
-def rshift(a, b, /): ...
75+
-@overload
76+
-def sub(a: SupportsSub[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
77+
-@overload
78+
-def sub(a: _T_contra, b: SupportsRSub[_T_contra, _T_co], /) -> _T_co: ...
79+
-def truediv(a, b, /): ...
80+
-def xor(a, b, /): ...
81+
+def pow(a: Any, b: Any, /) -> Any: ...
82+
+def rshift(a: Any, b: Any, /) -> Any: ...
83+
+def sub(a: Any, b: Any, /) -> Any: ...
84+
+def truediv(a: Any, b: Any, /) -> Any: ...
85+
+def xor(a: Any, b: Any, /) -> Any: ...
86+
def concat(a: Sequence[_T], b: Sequence[_T], /) -> Sequence[_T]: ...
87+
def contains(a: Container[object], b: object, /) -> bool: ...
88+
def countOf(a: Iterable[object], b: object, /) -> int: ...
89+
--
90+
2.53.0
91+

0 commit comments

Comments
 (0)