1
- From c217544146d36899d50e828d627652a0d8f63bb7 Mon Sep 17 00:00:00 2001
1
+ From 438dbb1300b77331940d7db8f010e97305745116 Mon Sep 17 00:00:00 2001
2
2
From: Marc Mueller <
[email protected] >
3
3
Date: Sat, 21 Dec 2024 22:36:38 +0100
4
4
Subject: [PATCH] Revert Remove redundant inheritances from Iterator in
@@ -15,7 +15,7 @@ Subject: [PATCH] Revert Remove redundant inheritances from Iterator in
15
15
7 files changed, 34 insertions(+), 34 deletions(-)
16
16
17
17
diff --git a/mypy/typeshed/stdlib/_asyncio.pyi b/mypy/typeshed/stdlib/_asyncio.pyi
18
- index ed56f33af..5253e967e 100644
18
+ index d663f5d93..f43178e4d 100644
19
19
--- a/mypy/typeshed/stdlib/_asyncio.pyi
20
20
+++ b/mypy/typeshed/stdlib/_asyncio.pyi
21
21
@@ -1,6 +1,6 @@
@@ -26,59 +26,59 @@ index ed56f33af..5253e967e 100644
26
26
from contextvars import Context
27
27
from types import FrameType, GenericAlias
28
28
from typing import Any, Literal, TextIO, TypeVar
29
- @@ -10,7 +10,7 @@ _T = TypeVar("_T")
30
- _T_co = TypeVar("_T_co", covariant=True)
29
+ @@ -11,7 +11,7 @@ _T_co = TypeVar("_T_co", covariant=True)
31
30
_TaskYieldType: TypeAlias = Future[object] | None
32
31
32
+ @disjoint_base
33
33
- class Future(Awaitable[_T]):
34
34
+ class Future(Awaitable[_T], Iterable[_T]):
35
35
_state: str
36
36
@property
37
37
def _exception(self) -> BaseException | None: ...
38
38
diff --git a/mypy/typeshed/stdlib/builtins.pyi b/mypy/typeshed/stdlib/builtins.pyi
39
- index 0575be3c8..d9be595fe 100644
39
+ index f2dd00079..784ee7eac 100644
40
40
--- a/mypy/typeshed/stdlib/builtins.pyi
41
41
+++ b/mypy/typeshed/stdlib/builtins.pyi
42
- @@ -1186,7 +1186,7 @@ class frozenset(AbstractSet[_T_co]):
43
- def __hash__(self) -> int: ...
42
+ @@ -1209,7 +1209,7 @@ class frozenset(AbstractSet[_T_co]):
44
43
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
45
44
45
+ @disjoint_base
46
46
- class enumerate(Generic[_T]):
47
47
+ class enumerate(Iterator[tuple[int, _T]]):
48
48
def __new__(cls, iterable: Iterable[_T], start: int = 0) -> Self: ...
49
49
def __iter__(self) -> Self: ...
50
50
def __next__(self) -> tuple[int, _T]: ...
51
- @@ -1380,7 +1380,7 @@ else:
52
-
51
+ @@ -1405,7 +1405,7 @@ else:
53
52
exit: _sitebuiltins.Quitter
54
53
54
+ @disjoint_base
55
55
- class filter(Generic[_T]):
56
56
+ class filter(Iterator[_T]):
57
57
@overload
58
58
def __new__(cls, function: None, iterable: Iterable[_T | None], /) -> Self: ...
59
59
@overload
60
- @@ -1444 ,7 +1444 ,7 @@ license: _sitebuiltins._Printer
60
+ @@ -1469 ,7 +1469 ,7 @@ license: _sitebuiltins._Printer
61
61
62
62
def locals() -> dict[str, Any]: ...
63
-
63
+ @disjoint_base
64
64
- class map(Generic[_S]):
65
65
+ class map(Iterator[_S]):
66
66
# 3.14 adds `strict` argument.
67
67
if sys.version_info >= (3, 14):
68
68
@overload
69
- @@ -1750,7 +1750,7 @@ def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex
70
-
69
+ @@ -1776,7 +1776,7 @@ def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex
71
70
quit: _sitebuiltins.Quitter
72
71
72
+ @disjoint_base
73
73
- class reversed(Generic[_T]):
74
74
+ class reversed(Iterator[_T]):
75
75
@overload
76
76
def __new__(cls, sequence: Reversible[_T], /) -> Iterator[_T]: ... # type: ignore[misc]
77
77
@overload
78
- @@ -1814 ,7 +1814 ,7 @@ def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
78
+ @@ -1840 ,7 +1840 ,7 @@ def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
79
79
@overload
80
80
def vars(object: Any = ..., /) -> dict[str, Any]: ...
81
-
81
+ @disjoint_base
82
82
- class zip(Generic[_T_co]):
83
83
+ class zip(Iterator[_T_co]):
84
84
if sys.version_info >= (3, 10):
@@ -131,157 +131,163 @@ index 910d63814..eb942bc55 100644
131
131
# encoding and errors are added
132
132
@overload
133
133
diff --git a/mypy/typeshed/stdlib/itertools.pyi b/mypy/typeshed/stdlib/itertools.pyi
134
- index d0085dd72..7d05b1318 100644
134
+ index fe4ccbdf8..73745fe92 100644
135
135
--- a/mypy/typeshed/stdlib/itertools.pyi
136
136
+++ b/mypy/typeshed/stdlib/itertools.pyi
137
- @@ -27,7 +27,7 @@ _Predicate: TypeAlias = Callable[[_T], object]
138
-
137
+ @@ -28,7 +28,7 @@ _Predicate: TypeAlias = Callable[[_T], object]
139
138
# Technically count can take anything that implements a number protocol and has an add method
140
139
# but we can't enforce the add method
140
+ @disjoint_base
141
141
- class count(Generic[_N]):
142
142
+ class count(Iterator[_N]):
143
143
@overload
144
144
def __new__(cls) -> count[int]: ...
145
145
@overload
146
- @@ -37,12 +37,12 @@ class count(Generic[_N]):
147
- def __next__(self) -> _N: ...
146
+ @@ -39,13 +39,13 @@ class count(Generic[_N]):
148
147
def __iter__(self) -> Self: ...
149
148
149
+ @disjoint_base
150
150
- class cycle(Generic[_T]):
151
151
+ class cycle(Iterator[_T]):
152
152
def __new__(cls, iterable: Iterable[_T], /) -> Self: ...
153
153
def __next__(self) -> _T: ...
154
154
def __iter__(self) -> Self: ...
155
155
156
+ @disjoint_base
156
157
- class repeat(Generic[_T]):
157
158
+ class repeat(Iterator[_T]):
158
159
@overload
159
160
def __new__(cls, object: _T) -> Self: ...
160
161
@overload
161
- @@ -51,7 +51,7 @@ class repeat(Generic[_T]):
162
- def __iter__(self) -> Self: ...
162
+ @@ -55,7 +55,7 @@ class repeat(Generic[_T]):
163
163
def __length_hint__(self) -> int: ...
164
164
165
+ @disjoint_base
165
166
- class accumulate(Generic[_T]):
166
167
+ class accumulate(Iterator[_T]):
167
168
@overload
168
169
def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> Self: ...
169
170
@overload
170
- @@ -59,7 +59,7 @@ class accumulate(Generic[_T]):
171
- def __iter__(self) -> Self: ...
171
+ @@ -64,7 +64,7 @@ class accumulate(Generic[_T]):
172
172
def __next__(self) -> _T: ...
173
173
174
+ @disjoint_base
174
175
- class chain(Generic[_T]):
175
176
+ class chain(Iterator[_T]):
176
177
def __new__(cls, *iterables: Iterable[_T]) -> Self: ...
177
178
def __next__(self) -> _T: ...
178
179
def __iter__(self) -> Self: ...
179
- @@ -68,22 +68,22 @@ class chain(Generic[_T]):
180
- def from_iterable(cls: type[Any], iterable: Iterable[Iterable[_S]], /) -> chain[_S]: ...
180
+ @@ -74,25 +74,25 @@ class chain(Generic[_T]):
181
181
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
182
182
183
+ @disjoint_base
183
184
- class compress(Generic[_T]):
184
185
+ class compress(Iterator[_T]):
185
186
def __new__(cls, data: Iterable[_T], selectors: Iterable[Any]) -> Self: ...
186
187
def __iter__(self) -> Self: ...
187
188
def __next__(self) -> _T: ...
188
189
190
+ @disjoint_base
189
191
- class dropwhile(Generic[_T]):
190
192
+ class dropwhile(Iterator[_T]):
191
193
def __new__(cls, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> Self: ...
192
194
def __iter__(self) -> Self: ...
193
195
def __next__(self) -> _T: ...
194
196
197
+ @disjoint_base
195
198
- class filterfalse(Generic[_T]):
196
199
+ class filterfalse(Iterator[_T]):
197
200
def __new__(cls, function: _Predicate[_T] | None, iterable: Iterable[_T], /) -> Self: ...
198
201
def __iter__(self) -> Self: ...
199
202
def __next__(self) -> _T: ...
200
203
204
+ @disjoint_base
201
205
- class groupby(Generic[_T_co, _S_co]):
202
206
+ class groupby(Iterator[tuple[_T_co, Iterator[_S_co]]], Generic[_T_co, _S_co]):
203
207
@overload
204
208
def __new__(cls, iterable: Iterable[_T1], key: None = None) -> groupby[_T1, _T1]: ...
205
209
@overload
206
- @@ -91,7 +91,7 @@ class groupby(Generic[_T_co, _S_co]):
207
- def __iter__(self) -> Self: ...
210
+ @@ -101,7 +101,7 @@ class groupby(Generic[_T_co, _S_co]):
208
211
def __next__(self) -> tuple[_T_co, Iterator[_S_co]]: ...
209
212
213
+ @disjoint_base
210
214
- class islice(Generic[_T]):
211
215
+ class islice(Iterator[_T]):
212
216
@overload
213
217
def __new__(cls, iterable: Iterable[_T], stop: int | None, /) -> Self: ...
214
218
@overload
215
- @@ -99,19 +99,19 @@ class islice(Generic[_T]):
216
- def __iter__(self) -> Self: ...
219
+ @@ -110,20 +110,20 @@ class islice(Generic[_T]):
217
220
def __next__(self) -> _T: ...
218
221
222
+ @disjoint_base
219
223
- class starmap(Generic[_T_co]):
220
224
+ class starmap(Iterator[_T_co]):
221
225
def __new__(cls, function: Callable[..., _T], iterable: Iterable[Iterable[Any]], /) -> starmap[_T]: ...
222
226
def __iter__(self) -> Self: ...
223
227
def __next__(self) -> _T_co: ...
224
228
229
+ @disjoint_base
225
230
- class takewhile(Generic[_T]):
226
231
+ class takewhile(Iterator[_T]):
227
232
def __new__(cls, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> Self: ...
228
233
def __iter__(self) -> Self: ...
229
234
def __next__(self) -> _T: ...
230
235
231
236
def tee(iterable: Iterable[_T], n: int = 2, /) -> tuple[Iterator[_T], ...]: ...
232
-
237
+ @disjoint_base
233
238
- class zip_longest(Generic[_T_co]):
234
239
+ class zip_longest(Iterator[_T_co]):
235
240
# one iterable (fillvalue doesn't matter)
236
241
@overload
237
242
def __new__(cls, iter1: Iterable[_T1], /, *, fillvalue: object = ...) -> zip_longest[tuple[_T1]]: ...
238
- @@ -189,7 +189,7 @@ class zip_longest(Generic[_T_co]):
239
- def __iter__(self) -> Self: ...
243
+ @@ -202,7 +202,7 @@ class zip_longest(Generic[_T_co]):
240
244
def __next__(self) -> _T_co: ...
241
245
246
+ @disjoint_base
242
247
- class product(Generic[_T_co]):
243
248
+ class product(Iterator[_T_co]):
244
249
@overload
245
250
def __new__(cls, iter1: Iterable[_T1], /) -> product[tuple[_T1]]: ...
246
251
@overload
247
- @@ -274,7 +274,7 @@ class product(Generic[_T_co]):
248
- def __iter__(self) -> Self: ...
252
+ @@ -288,7 +288,7 @@ class product(Generic[_T_co]):
249
253
def __next__(self) -> _T_co: ...
250
254
255
+ @disjoint_base
251
256
- class permutations(Generic[_T_co]):
252
257
+ class permutations(Iterator[_T_co]):
253
258
@overload
254
259
def __new__(cls, iterable: Iterable[_T], r: Literal[2]) -> permutations[tuple[_T, _T]]: ...
255
260
@overload
256
- @@ -288,7 +288,7 @@ class permutations(Generic[_T_co]):
257
- def __iter__(self) -> Self: ...
261
+ @@ -303,7 +303,7 @@ class permutations(Generic[_T_co]):
258
262
def __next__(self) -> _T_co: ...
259
263
264
+ @disjoint_base
260
265
- class combinations(Generic[_T_co]):
261
266
+ class combinations(Iterator[_T_co]):
262
267
@overload
263
268
def __new__(cls, iterable: Iterable[_T], r: Literal[2]) -> combinations[tuple[_T, _T]]: ...
264
269
@overload
265
- @@ -302,7 +302,7 @@ class combinations(Generic[_T_co]):
266
- def __iter__(self) -> Self: ...
270
+ @@ -318,7 +318,7 @@ class combinations(Generic[_T_co]):
267
271
def __next__(self) -> _T_co: ...
268
272
273
+ @disjoint_base
269
274
- class combinations_with_replacement(Generic[_T_co]):
270
275
+ class combinations_with_replacement(Iterator[_T_co]):
271
276
@overload
272
277
def __new__(cls, iterable: Iterable[_T], r: Literal[2]) -> combinations_with_replacement[tuple[_T, _T]]: ...
273
278
@overload
274
- @@ -317,13 +317,13 @@ class combinations_with_replacement(Generic[_T_co]):
275
- def __next__(self) -> _T_co: ...
279
+ @@ -334,14 +334,14 @@ class combinations_with_replacement(Generic[_T_co]):
276
280
277
281
if sys.version_info >= (3, 10):
282
+ @disjoint_base
278
283
- class pairwise(Generic[_T_co]):
279
284
+ class pairwise(Iterator[_T_co]):
280
285
def __new__(cls, iterable: Iterable[_T], /) -> pairwise[tuple[_T, _T]]: ...
281
286
def __iter__(self) -> Self: ...
282
287
def __next__(self) -> _T_co: ...
283
288
284
289
if sys.version_info >= (3, 12):
290
+ @disjoint_base
285
291
- class batched(Generic[_T_co]):
286
292
+ class batched(Iterator[tuple[_T_co, ...]], Generic[_T_co]):
287
293
if sys.version_info >= (3, 13):
@@ -307,18 +313,18 @@ index b79f9e773..f276372d0 100644
307
313
def __iter__(self) -> Self: ...
308
314
def next(self, timeout: float | None = None) -> _T: ...
309
315
diff --git a/mypy/typeshed/stdlib/sqlite3/__init__.pyi b/mypy/typeshed/stdlib/sqlite3/__init__.pyi
310
- index bcfea3a13..5a659deac 100644
316
+ index 6b0f1ba94..882cd143c 100644
311
317
--- a/mypy/typeshed/stdlib/sqlite3/__init__.pyi
312
318
+++ b/mypy/typeshed/stdlib/sqlite3/__init__.pyi
313
- @@ -405,7 +405,7 @@ class Connection:
314
- self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None, /
319
+ @@ -407,7 +407,7 @@ class Connection:
315
320
) -> Literal[False]: ...
316
321
322
+ @disjoint_base
317
323
- class Cursor:
318
324
+ class Cursor(Iterator[Any]):
319
325
arraysize: int
320
326
@property
321
327
def connection(self) -> Connection: ...
322
328
- -
323
- 2.50.1
329
+ 2.51.0
324
330
0 commit comments