@@ -28,7 +28,7 @@ _Predicate: TypeAlias = Callable[[_T], object]
28
28
29
29
# Technically count can take anything that implements a number protocol and has an add method
30
30
# but we can't enforce the add method
31
- class count (Iterator [_N ]):
31
+ class count (Generic [_N ]):
32
32
@overload
33
33
def __new__ (cls ) -> count [int ]: ...
34
34
@overload
@@ -38,12 +38,12 @@ class count(Iterator[_N]):
38
38
def __next__ (self ) -> _N : ...
39
39
def __iter__ (self ) -> Self : ...
40
40
41
- class cycle (Iterator [_T ]):
41
+ class cycle (Generic [_T ]):
42
42
def __init__ (self , iterable : Iterable [_T ], / ) -> None : ...
43
43
def __next__ (self ) -> _T : ...
44
44
def __iter__ (self ) -> Self : ...
45
45
46
- class repeat (Iterator [_T ]):
46
+ class repeat (Generic [_T ]):
47
47
@overload
48
48
def __init__ (self , object : _T ) -> None : ...
49
49
@overload
@@ -52,15 +52,15 @@ class repeat(Iterator[_T]):
52
52
def __iter__ (self ) -> Self : ...
53
53
def __length_hint__ (self ) -> int : ...
54
54
55
- class accumulate (Iterator [_T ]):
55
+ class accumulate (Generic [_T ]):
56
56
@overload
57
57
def __init__ (self , iterable : Iterable [_T ], func : None = None , * , initial : _T | None = ...) -> None : ...
58
58
@overload
59
59
def __init__ (self , iterable : Iterable [_S ], func : Callable [[_T , _S ], _T ], * , initial : _T | None = ...) -> None : ...
60
60
def __iter__ (self ) -> Self : ...
61
61
def __next__ (self ) -> _T : ...
62
62
63
- class chain (Iterator [_T ]):
63
+ class chain (Generic [_T ]):
64
64
def __init__ (self , * iterables : Iterable [_T ]) -> None : ...
65
65
def __next__ (self ) -> _T : ...
66
66
def __iter__ (self ) -> Self : ...
@@ -70,50 +70,50 @@ class chain(Iterator[_T]):
70
70
if sys .version_info >= (3 , 9 ):
71
71
def __class_getitem__ (cls , item : Any , / ) -> GenericAlias : ...
72
72
73
- class compress (Iterator [_T ]):
73
+ class compress (Generic [_T ]):
74
74
def __init__ (self , data : Iterable [_T ], selectors : Iterable [Any ]) -> None : ...
75
75
def __iter__ (self ) -> Self : ...
76
76
def __next__ (self ) -> _T : ...
77
77
78
- class dropwhile (Iterator [_T ]):
78
+ class dropwhile (Generic [_T ]):
79
79
def __init__ (self , predicate : _Predicate [_T ], iterable : Iterable [_T ], / ) -> None : ...
80
80
def __iter__ (self ) -> Self : ...
81
81
def __next__ (self ) -> _T : ...
82
82
83
- class filterfalse (Iterator [_T ]):
83
+ class filterfalse (Generic [_T ]):
84
84
def __init__ (self , predicate : _Predicate [_T ] | None , iterable : Iterable [_T ], / ) -> None : ...
85
85
def __iter__ (self ) -> Self : ...
86
86
def __next__ (self ) -> _T : ...
87
87
88
- class groupby (Iterator [ tuple [ _T_co , Iterator [ _S_co ]]], Generic [_T_co , _S_co ]):
88
+ class groupby (Generic [_T_co , _S_co ]):
89
89
@overload
90
90
def __new__ (cls , iterable : Iterable [_T1 ], key : None = None ) -> groupby [_T1 , _T1 ]: ...
91
91
@overload
92
92
def __new__ (cls , iterable : Iterable [_T1 ], key : Callable [[_T1 ], _T2 ]) -> groupby [_T2 , _T1 ]: ...
93
93
def __iter__ (self ) -> Self : ...
94
94
def __next__ (self ) -> tuple [_T_co , Iterator [_S_co ]]: ...
95
95
96
- class islice (Iterator [_T ]):
96
+ class islice (Generic [_T ]):
97
97
@overload
98
98
def __init__ (self , iterable : Iterable [_T ], stop : int | None , / ) -> None : ...
99
99
@overload
100
100
def __init__ (self , iterable : Iterable [_T ], start : int | None , stop : int | None , step : int | None = ..., / ) -> None : ...
101
101
def __iter__ (self ) -> Self : ...
102
102
def __next__ (self ) -> _T : ...
103
103
104
- class starmap (Iterator [_T_co ]):
104
+ class starmap (Generic [_T_co ]):
105
105
def __new__ (cls , function : Callable [..., _T ], iterable : Iterable [Iterable [Any ]], / ) -> starmap [_T ]: ...
106
106
def __iter__ (self ) -> Self : ...
107
107
def __next__ (self ) -> _T_co : ...
108
108
109
- class takewhile (Iterator [_T ]):
109
+ class takewhile (Generic [_T ]):
110
110
def __init__ (self , predicate : _Predicate [_T ], iterable : Iterable [_T ], / ) -> None : ...
111
111
def __iter__ (self ) -> Self : ...
112
112
def __next__ (self ) -> _T : ...
113
113
114
114
def tee (iterable : Iterable [_T ], n : int = 2 , / ) -> tuple [Iterator [_T ], ...]: ...
115
115
116
- class zip_longest (Iterator [_T_co ]):
116
+ class zip_longest (Generic [_T_co ]):
117
117
# one iterable (fillvalue doesn't matter)
118
118
@overload
119
119
def __new__ (cls , iter1 : Iterable [_T1 ], / , * , fillvalue : object = ...) -> zip_longest [tuple [_T1 ]]: ...
@@ -191,7 +191,7 @@ class zip_longest(Iterator[_T_co]):
191
191
def __iter__ (self ) -> Self : ...
192
192
def __next__ (self ) -> _T_co : ...
193
193
194
- class product (Iterator [_T_co ]):
194
+ class product (Generic [_T_co ]):
195
195
@overload
196
196
def __new__ (cls , iter1 : Iterable [_T1 ], / ) -> product [tuple [_T1 ]]: ...
197
197
@overload
@@ -276,7 +276,7 @@ class product(Iterator[_T_co]):
276
276
def __iter__ (self ) -> Self : ...
277
277
def __next__ (self ) -> _T_co : ...
278
278
279
- class permutations (Iterator [_T_co ]):
279
+ class permutations (Generic [_T_co ]):
280
280
@overload
281
281
def __new__ (cls , iterable : Iterable [_T ], r : Literal [2 ]) -> permutations [tuple [_T , _T ]]: ...
282
282
@overload
@@ -290,7 +290,7 @@ class permutations(Iterator[_T_co]):
290
290
def __iter__ (self ) -> Self : ...
291
291
def __next__ (self ) -> _T_co : ...
292
292
293
- class combinations (Iterator [_T_co ]):
293
+ class combinations (Generic [_T_co ]):
294
294
@overload
295
295
def __new__ (cls , iterable : Iterable [_T ], r : Literal [2 ]) -> combinations [tuple [_T , _T ]]: ...
296
296
@overload
@@ -304,7 +304,7 @@ class combinations(Iterator[_T_co]):
304
304
def __iter__ (self ) -> Self : ...
305
305
def __next__ (self ) -> _T_co : ...
306
306
307
- class combinations_with_replacement (Iterator [_T_co ]):
307
+ class combinations_with_replacement (Generic [_T_co ]):
308
308
@overload
309
309
def __new__ (cls , iterable : Iterable [_T ], r : Literal [2 ]) -> combinations_with_replacement [tuple [_T , _T ]]: ...
310
310
@overload
@@ -319,13 +319,13 @@ class combinations_with_replacement(Iterator[_T_co]):
319
319
def __next__ (self ) -> _T_co : ...
320
320
321
321
if sys .version_info >= (3 , 10 ):
322
- class pairwise (Iterator [_T_co ]):
322
+ class pairwise (Generic [_T_co ]):
323
323
def __new__ (cls , iterable : Iterable [_T ], / ) -> pairwise [tuple [_T , _T ]]: ...
324
324
def __iter__ (self ) -> Self : ...
325
325
def __next__ (self ) -> _T_co : ...
326
326
327
327
if sys .version_info >= (3 , 12 ):
328
- class batched (Iterator [ tuple [ _T_co , ...]], Generic [_T_co ]):
328
+ class batched (Generic [_T_co ]):
329
329
if sys .version_info >= (3 , 13 ):
330
330
def __new__ (cls , iterable : Iterable [_T_co ], n : int , * , strict : bool = False ) -> Self : ...
331
331
else :
0 commit comments