Skip to content

Commit d31a95f

Browse files
committed
Update typeshed patch for revert remove inheritance iterator
1 parent 6b117ae commit d31a95f

File tree

1 file changed

+76
-76
lines changed

1 file changed

+76
-76
lines changed
Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From abc5225e3c69d7ae8f3388c87260fe496efaecac Mon Sep 17 00:00:00 2001
1+
From 49ed611997ce5c8b41dcbf6238b3c73526bfe1c0 Mon Sep 17 00:00:00 2001
22
From: Marc Mueller <[email protected]>
33
Date: Sat, 21 Dec 2024 22:36:38 +0100
44
Subject: [PATCH] Revert Remove redundant inheritances from Iterator in
@@ -15,7 +15,7 @@ Subject: [PATCH] Revert Remove redundant inheritances from Iterator in
1515
7 files changed, 34 insertions(+), 34 deletions(-)
1616

1717
diff --git a/mypy/typeshed/stdlib/_asyncio.pyi b/mypy/typeshed/stdlib/_asyncio.pyi
18-
index 89cdff6cc..1397e579d 100644
18+
index be486fddb..3c918d818 100644
1919
--- a/mypy/typeshed/stdlib/_asyncio.pyi
2020
+++ b/mypy/typeshed/stdlib/_asyncio.pyi
2121
@@ -1,6 +1,6 @@
@@ -24,284 +24,283 @@ index 89cdff6cc..1397e579d 100644
2424
-from collections.abc import Awaitable, Callable, Coroutine, Generator
2525
+from collections.abc import Awaitable, Callable, Coroutine, Generator, Iterable
2626
from contextvars import Context
27-
from types import FrameType
27+
from types import FrameType, GenericAlias
2828
from typing import Any, Literal, TextIO, TypeVar
29-
@@ -13,7 +13,7 @@ _T = TypeVar("_T")
29+
@@ -10,7 +10,7 @@ _T = TypeVar("_T")
3030
_T_co = TypeVar("_T_co", covariant=True)
3131
_TaskYieldType: TypeAlias = Future[object] | None
32-
32+
3333
-class Future(Awaitable[_T]):
3434
+class Future(Awaitable[_T], Iterable[_T]):
3535
_state: str
3636
@property
3737
def _exception(self) -> BaseException | None: ...
3838
diff --git a/mypy/typeshed/stdlib/builtins.pyi b/mypy/typeshed/stdlib/builtins.pyi
39-
index b75e34fc5..526406acc 100644
39+
index 64d08dba0..e45967e10 100644
4040
--- a/mypy/typeshed/stdlib/builtins.pyi
4141
+++ b/mypy/typeshed/stdlib/builtins.pyi
42-
@@ -1130,7 +1130,7 @@ class frozenset(AbstractSet[_T_co]):
43-
if sys.version_info >= (3, 9):
44-
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
45-
42+
@@ -1134,7 +1134,7 @@ class frozenset(AbstractSet[_T_co]):
43+
def __hash__(self) -> int: ...
44+
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
45+
4646
-class enumerate(Generic[_T]):
4747
+class enumerate(Iterator[tuple[int, _T]]):
4848
def __new__(cls, iterable: Iterable[_T], start: int = 0) -> Self: ...
4949
def __iter__(self) -> Self: ...
5050
def __next__(self) -> tuple[int, _T]: ...
51-
@@ -1324,7 +1324,7 @@ else:
52-
51+
@@ -1330,7 +1330,7 @@ else:
52+
5353
exit: _sitebuiltins.Quitter
54-
54+
5555
-class filter(Generic[_T]):
5656
+class filter(Iterator[_T]):
5757
@overload
5858
def __new__(cls, function: None, iterable: Iterable[_T | None], /) -> Self: ...
5959
@overload
60-
@@ -1389,7 +1389,7 @@ license: _sitebuiltins._Printer
61-
60+
@@ -1395,7 +1395,7 @@ license: _sitebuiltins._Printer
61+
6262
def locals() -> dict[str, Any]: ...
63-
63+
6464
-class map(Generic[_S]):
6565
+class map(Iterator[_S]):
6666
@overload
6767
def __new__(cls, func: Callable[[_T1], _S], iterable: Iterable[_T1], /) -> Self: ...
6868
@overload
69-
@@ -1632,7 +1632,7 @@ def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex
70-
69+
@@ -1638,7 +1638,7 @@ def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex
70+
7171
quit: _sitebuiltins.Quitter
72-
72+
7373
-class reversed(Generic[_T]):
7474
+class reversed(Iterator[_T]):
7575
@overload
7676
def __new__(cls, sequence: Reversible[_T], /) -> Iterator[_T]: ... # type: ignore[misc]
7777
@overload
78-
@@ -1693,7 +1693,7 @@ def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
78+
@@ -1699,7 +1699,7 @@ def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
7979
@overload
8080
def vars(object: Any = ..., /) -> dict[str, Any]: ...
81-
81+
8282
-class zip(Generic[_T_co]):
8383
+class zip(Iterator[_T_co]):
8484
if sys.version_info >= (3, 10):
8585
@overload
8686
def __new__(cls, *, strict: bool = ...) -> zip[Any]: ...
8787
diff --git a/mypy/typeshed/stdlib/csv.pyi b/mypy/typeshed/stdlib/csv.pyi
88-
index 4a82de638..ef93129d6 100644
88+
index 2c8e7109c..4ed0ab1d8 100644
8989
--- a/mypy/typeshed/stdlib/csv.pyi
9090
+++ b/mypy/typeshed/stdlib/csv.pyi
9191
@@ -25,7 +25,7 @@ else:
9292
from _csv import _reader as Reader, _writer as Writer
93-
93+
9494
from _typeshed import SupportsWrite
9595
-from collections.abc import Collection, Iterable, Mapping, Sequence
9696
+from collections.abc import Collection, Iterable, Iterator, Mapping, Sequence
97+
from types import GenericAlias
9798
from typing import Any, Generic, Literal, TypeVar, overload
9899
from typing_extensions import Self
99-
100-
@@ -75,7 +75,7 @@ class excel(Dialect): ...
100+
@@ -73,7 +73,7 @@ class excel(Dialect): ...
101101
class excel_tab(excel): ...
102102
class unix_dialect(Dialect): ...
103-
103+
104104
-class DictReader(Generic[_T]):
105105
+class DictReader(Iterator[dict[_T | Any, str | Any]], Generic[_T]):
106106
fieldnames: Sequence[_T] | None
107107
restkey: _T | None
108108
restval: str | Any | None
109109
diff --git a/mypy/typeshed/stdlib/fileinput.pyi b/mypy/typeshed/stdlib/fileinput.pyi
110-
index bf6daad0a..1e6aa78e2 100644
110+
index 948b39ea1..1d5f9cf00 100644
111111
--- a/mypy/typeshed/stdlib/fileinput.pyi
112112
+++ b/mypy/typeshed/stdlib/fileinput.pyi
113113
@@ -1,8 +1,8 @@
114114
import sys
115115
from _typeshed import AnyStr_co, StrOrBytesPath
116116
-from collections.abc import Callable, Iterable
117117
+from collections.abc import Callable, Iterable, Iterator
118-
from types import TracebackType
118+
from types import GenericAlias, TracebackType
119119
-from typing import IO, Any, AnyStr, Generic, Literal, Protocol, overload
120120
+from typing import IO, Any, AnyStr, Literal, Protocol, overload
121121
from typing_extensions import Self, TypeAlias
122-
123-
if sys.version_info >= (3, 9):
124-
@@ -107,7 +107,7 @@ def fileno() -> int: ...
122+
123+
__all__ = [
124+
@@ -104,7 +104,7 @@ def fileno() -> int: ...
125125
def isfirstline() -> bool: ...
126126
def isstdin() -> bool: ...
127-
127+
128128
-class FileInput(Generic[AnyStr]):
129129
+class FileInput(Iterator[AnyStr]):
130130
if sys.version_info >= (3, 10):
131131
# encoding and errors are added
132132
@overload
133133
diff --git a/mypy/typeshed/stdlib/itertools.pyi b/mypy/typeshed/stdlib/itertools.pyi
134-
index 55b0814ac..675533d44 100644
134+
index d0085dd72..7d05b1318 100644
135135
--- a/mypy/typeshed/stdlib/itertools.pyi
136136
+++ b/mypy/typeshed/stdlib/itertools.pyi
137-
@@ -29,7 +29,7 @@ _Predicate: TypeAlias = Callable[[_T], object]
138-
137+
@@ -27,7 +27,7 @@ _Predicate: TypeAlias = Callable[[_T], object]
138+
139139
# Technically count can take anything that implements a number protocol and has an add method
140140
# but we can't enforce the add method
141141
-class count(Generic[_N]):
142142
+class count(Iterator[_N]):
143143
@overload
144144
def __new__(cls) -> count[int]: ...
145145
@overload
146-
@@ -39,12 +39,12 @@ class count(Generic[_N]):
146+
@@ -37,12 +37,12 @@ class count(Generic[_N]):
147147
def __next__(self) -> _N: ...
148148
def __iter__(self) -> Self: ...
149-
149+
150150
-class cycle(Generic[_T]):
151151
+class cycle(Iterator[_T]):
152152
def __new__(cls, iterable: Iterable[_T], /) -> Self: ...
153153
def __next__(self) -> _T: ...
154154
def __iter__(self) -> Self: ...
155-
155+
156156
-class repeat(Generic[_T]):
157157
+class repeat(Iterator[_T]):
158158
@overload
159159
def __new__(cls, object: _T) -> Self: ...
160160
@overload
161-
@@ -53,7 +53,7 @@ class repeat(Generic[_T]):
161+
@@ -51,7 +51,7 @@ class repeat(Generic[_T]):
162162
def __iter__(self) -> Self: ...
163163
def __length_hint__(self) -> int: ...
164-
164+
165165
-class accumulate(Generic[_T]):
166166
+class accumulate(Iterator[_T]):
167167
@overload
168168
def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> Self: ...
169169
@overload
170-
@@ -61,7 +61,7 @@ class accumulate(Generic[_T]):
170+
@@ -59,7 +59,7 @@ class accumulate(Generic[_T]):
171171
def __iter__(self) -> Self: ...
172172
def __next__(self) -> _T: ...
173-
173+
174174
-class chain(Generic[_T]):
175175
+class chain(Iterator[_T]):
176176
def __new__(cls, *iterables: Iterable[_T]) -> Self: ...
177177
def __next__(self) -> _T: ...
178178
def __iter__(self) -> Self: ...
179-
@@ -71,22 +71,22 @@ class chain(Generic[_T]):
180-
if sys.version_info >= (3, 9):
181-
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
182-
179+
@@ -68,22 +68,22 @@ class chain(Generic[_T]):
180+
def from_iterable(cls: type[Any], iterable: Iterable[Iterable[_S]], /) -> chain[_S]: ...
181+
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
182+
183183
-class compress(Generic[_T]):
184184
+class compress(Iterator[_T]):
185185
def __new__(cls, data: Iterable[_T], selectors: Iterable[Any]) -> Self: ...
186186
def __iter__(self) -> Self: ...
187187
def __next__(self) -> _T: ...
188-
188+
189189
-class dropwhile(Generic[_T]):
190190
+class dropwhile(Iterator[_T]):
191191
def __new__(cls, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> Self: ...
192192
def __iter__(self) -> Self: ...
193193
def __next__(self) -> _T: ...
194-
194+
195195
-class filterfalse(Generic[_T]):
196196
+class filterfalse(Iterator[_T]):
197197
def __new__(cls, function: _Predicate[_T] | None, iterable: Iterable[_T], /) -> Self: ...
198198
def __iter__(self) -> Self: ...
199199
def __next__(self) -> _T: ...
200-
200+
201201
-class groupby(Generic[_T_co, _S_co]):
202202
+class groupby(Iterator[tuple[_T_co, Iterator[_S_co]]], Generic[_T_co, _S_co]):
203203
@overload
204204
def __new__(cls, iterable: Iterable[_T1], key: None = None) -> groupby[_T1, _T1]: ...
205205
@overload
206-
@@ -94,7 +94,7 @@ class groupby(Generic[_T_co, _S_co]):
206+
@@ -91,7 +91,7 @@ class groupby(Generic[_T_co, _S_co]):
207207
def __iter__(self) -> Self: ...
208208
def __next__(self) -> tuple[_T_co, Iterator[_S_co]]: ...
209-
209+
210210
-class islice(Generic[_T]):
211211
+class islice(Iterator[_T]):
212212
@overload
213213
def __new__(cls, iterable: Iterable[_T], stop: int | None, /) -> Self: ...
214214
@overload
215-
@@ -102,19 +102,19 @@ class islice(Generic[_T]):
215+
@@ -99,19 +99,19 @@ class islice(Generic[_T]):
216216
def __iter__(self) -> Self: ...
217217
def __next__(self) -> _T: ...
218-
218+
219219
-class starmap(Generic[_T_co]):
220220
+class starmap(Iterator[_T_co]):
221221
def __new__(cls, function: Callable[..., _T], iterable: Iterable[Iterable[Any]], /) -> starmap[_T]: ...
222222
def __iter__(self) -> Self: ...
223223
def __next__(self) -> _T_co: ...
224-
224+
225225
-class takewhile(Generic[_T]):
226226
+class takewhile(Iterator[_T]):
227227
def __new__(cls, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> Self: ...
228228
def __iter__(self) -> Self: ...
229229
def __next__(self) -> _T: ...
230-
230+
231231
def tee(iterable: Iterable[_T], n: int = 2, /) -> tuple[Iterator[_T], ...]: ...
232-
232+
233233
-class zip_longest(Generic[_T_co]):
234234
+class zip_longest(Iterator[_T_co]):
235235
# one iterable (fillvalue doesn't matter)
236236
@overload
237237
def __new__(cls, iter1: Iterable[_T1], /, *, fillvalue: object = ...) -> zip_longest[tuple[_T1]]: ...
238-
@@ -192,7 +192,7 @@ class zip_longest(Generic[_T_co]):
238+
@@ -189,7 +189,7 @@ class zip_longest(Generic[_T_co]):
239239
def __iter__(self) -> Self: ...
240240
def __next__(self) -> _T_co: ...
241-
241+
242242
-class product(Generic[_T_co]):
243243
+class product(Iterator[_T_co]):
244244
@overload
245245
def __new__(cls, iter1: Iterable[_T1], /) -> product[tuple[_T1]]: ...
246246
@overload
247-
@@ -277,7 +277,7 @@ class product(Generic[_T_co]):
247+
@@ -274,7 +274,7 @@ class product(Generic[_T_co]):
248248
def __iter__(self) -> Self: ...
249249
def __next__(self) -> _T_co: ...
250-
250+
251251
-class permutations(Generic[_T_co]):
252252
+class permutations(Iterator[_T_co]):
253253
@overload
254254
def __new__(cls, iterable: Iterable[_T], r: Literal[2]) -> permutations[tuple[_T, _T]]: ...
255255
@overload
256-
@@ -291,7 +291,7 @@ class permutations(Generic[_T_co]):
256+
@@ -288,7 +288,7 @@ class permutations(Generic[_T_co]):
257257
def __iter__(self) -> Self: ...
258258
def __next__(self) -> _T_co: ...
259-
259+
260260
-class combinations(Generic[_T_co]):
261261
+class combinations(Iterator[_T_co]):
262262
@overload
263263
def __new__(cls, iterable: Iterable[_T], r: Literal[2]) -> combinations[tuple[_T, _T]]: ...
264264
@overload
265-
@@ -305,7 +305,7 @@ class combinations(Generic[_T_co]):
265+
@@ -302,7 +302,7 @@ class combinations(Generic[_T_co]):
266266
def __iter__(self) -> Self: ...
267267
def __next__(self) -> _T_co: ...
268-
268+
269269
-class combinations_with_replacement(Generic[_T_co]):
270270
+class combinations_with_replacement(Iterator[_T_co]):
271271
@overload
272272
def __new__(cls, iterable: Iterable[_T], r: Literal[2]) -> combinations_with_replacement[tuple[_T, _T]]: ...
273273
@overload
274-
@@ -320,13 +320,13 @@ class combinations_with_replacement(Generic[_T_co]):
274+
@@ -317,13 +317,13 @@ class combinations_with_replacement(Generic[_T_co]):
275275
def __next__(self) -> _T_co: ...
276-
276+
277277
if sys.version_info >= (3, 10):
278278
- class pairwise(Generic[_T_co]):
279279
+ class pairwise(Iterator[_T_co]):
280280
def __new__(cls, iterable: Iterable[_T], /) -> pairwise[tuple[_T, _T]]: ...
281281
def __iter__(self) -> Self: ...
282282
def __next__(self) -> _T_co: ...
283-
283+
284284
if sys.version_info >= (3, 12):
285285
- class batched(Generic[_T_co]):
286286
+ class batched(Iterator[tuple[_T_co, ...]], Generic[_T_co]):
287287
if sys.version_info >= (3, 13):
288288
def __new__(cls, iterable: Iterable[_T_co], n: int, *, strict: bool = False) -> Self: ...
289289
else:
290290
diff --git a/mypy/typeshed/stdlib/multiprocessing/pool.pyi b/mypy/typeshed/stdlib/multiprocessing/pool.pyi
291-
index 2937d45e3..93197e5d4 100644
291+
index b79f9e773..f276372d0 100644
292292
--- a/mypy/typeshed/stdlib/multiprocessing/pool.pyi
293293
+++ b/mypy/typeshed/stdlib/multiprocessing/pool.pyi
294-
@@ -1,5 +1,5 @@
295-
import sys
294+
@@ -1,4 +1,4 @@
296295
-from collections.abc import Callable, Iterable, Mapping
297296
+from collections.abc import Callable, Iterable, Iterator, Mapping
298297
from multiprocessing.context import DefaultContext, Process
299-
from types import TracebackType
298+
from types import GenericAlias, TracebackType
300299
from typing import Any, Final, Generic, TypeVar
301-
@@ -37,7 +37,7 @@ class MapResult(ApplyResult[list[_T]]):
300+
@@ -32,7 +32,7 @@ class MapResult(ApplyResult[list[_T]]):
302301
error_callback: Callable[[BaseException], object] | None,
303302
) -> None: ...
304-
303+
305304
-class IMapIterator(Generic[_T]):
306305
+class IMapIterator(Iterator[_T]):
307306
def __init__(self, pool: Pool) -> None: ...
@@ -314,11 +313,12 @@ index b83516b4d..724bc3166 100644
314313
@@ -397,7 +397,7 @@ class Connection:
315314
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None, /
316315
) -> Literal[False]: ...
317-
316+
318317
-class Cursor:
319318
+class Cursor(Iterator[Any]):
320319
arraysize: int
321320
@property
322321
def connection(self) -> Connection: ...
323-
--
324-
2.47.1
322+
--
323+
2.49.0
324+

0 commit comments

Comments
 (0)