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