|
1 | 1 | import sys
|
| 2 | +from _typeshed import _T_co |
2 | 3 | from typing import (
|
3 | 4 | Any,
|
4 | 5 | Callable,
|
@@ -122,60 +123,74 @@ _T3 = TypeVar("_T3")
|
122 | 123 | _T4 = TypeVar("_T4")
|
123 | 124 | _T5 = TypeVar("_T5")
|
124 | 125 | _T6 = TypeVar("_T6")
|
125 |
| -@overload |
126 |
| -def product(__iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]: ... |
127 |
| -@overload |
128 |
| -def product(__iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]: ... |
129 |
| -@overload |
130 |
| -def product(__iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> Iterator[Tuple[_T1, _T2, _T3]]: ... |
131 |
| -@overload |
132 |
| -def product( |
133 |
| - __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] |
134 |
| -) -> Iterator[Tuple[_T1, _T2, _T3, _T4]]: ... |
135 |
| -@overload |
136 |
| -def product( |
137 |
| - __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4], __iter5: Iterable[_T5] |
138 |
| -) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... |
139 |
| -@overload |
140 |
| -def product( |
141 |
| - __iter1: Iterable[_T1], |
142 |
| - __iter2: Iterable[_T2], |
143 |
| - __iter3: Iterable[_T3], |
144 |
| - __iter4: Iterable[_T4], |
145 |
| - __iter5: Iterable[_T5], |
146 |
| - __iter6: Iterable[_T6], |
147 |
| -) -> Iterator[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... |
148 |
| -@overload |
149 |
| -def product( |
150 |
| - __iter1: Iterable[Any], |
151 |
| - __iter2: Iterable[Any], |
152 |
| - __iter3: Iterable[Any], |
153 |
| - __iter4: Iterable[Any], |
154 |
| - __iter5: Iterable[Any], |
155 |
| - __iter6: Iterable[Any], |
156 |
| - __iter7: Iterable[Any], |
157 |
| - *iterables: Iterable[Any], |
158 |
| -) -> Iterator[Tuple[Any, ...]]: ... |
159 |
| -@overload |
160 |
| -def product(*iterables: Iterable[_T1], repeat: int) -> Iterator[Tuple[_T1, ...]]: ... |
161 |
| -@overload |
162 |
| -def product(*iterables: Iterable[Any], repeat: int = ...) -> Iterator[Tuple[Any, ...]]: ... |
| 126 | + |
| 127 | +class product(Iterator[_T_co], Generic[_T_co]): |
| 128 | + @overload |
| 129 | + def __new__(cls, __iter1: Iterable[_T1]) -> product[Tuple[_T1]]: ... |
| 130 | + @overload |
| 131 | + def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2]) -> product[Tuple[_T1, _T2]]: ... |
| 132 | + @overload |
| 133 | + def __new__(cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3]) -> product[Tuple[_T1, _T2, _T3]]: ... |
| 134 | + @overload |
| 135 | + def __new__( |
| 136 | + cls, __iter1: Iterable[_T1], __iter2: Iterable[_T2], __iter3: Iterable[_T3], __iter4: Iterable[_T4] |
| 137 | + ) -> product[Tuple[_T1, _T2, _T3, _T4]]: ... |
| 138 | + @overload |
| 139 | + def __new__( |
| 140 | + cls, |
| 141 | + __iter1: Iterable[_T1], |
| 142 | + __iter2: Iterable[_T2], |
| 143 | + __iter3: Iterable[_T3], |
| 144 | + __iter4: Iterable[_T4], |
| 145 | + __iter5: Iterable[_T5], |
| 146 | + ) -> product[Tuple[_T1, _T2, _T3, _T4, _T5]]: ... |
| 147 | + @overload |
| 148 | + def __new__( |
| 149 | + cls, |
| 150 | + __iter1: Iterable[_T1], |
| 151 | + __iter2: Iterable[_T2], |
| 152 | + __iter3: Iterable[_T3], |
| 153 | + __iter4: Iterable[_T4], |
| 154 | + __iter5: Iterable[_T5], |
| 155 | + __iter6: Iterable[_T6], |
| 156 | + ) -> product[Tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ... |
| 157 | + @overload |
| 158 | + def __new__( |
| 159 | + cls, |
| 160 | + __iter1: Iterable[Any], |
| 161 | + __iter2: Iterable[Any], |
| 162 | + __iter3: Iterable[Any], |
| 163 | + __iter4: Iterable[Any], |
| 164 | + __iter5: Iterable[Any], |
| 165 | + __iter6: Iterable[Any], |
| 166 | + __iter7: Iterable[Any], |
| 167 | + *iterables: Iterable[Any], |
| 168 | + ) -> product[Tuple[Any, ...]]: ... |
| 169 | + @overload |
| 170 | + def __new__(cls, *iterables: Iterable[_T1], repeat: int) -> product[Tuple[_T1, ...]]: ... |
| 171 | + @overload |
| 172 | + def __new__(cls, *iterables: Iterable[Any], repeat: int = ...) -> product[Tuple[Any, ...]]: ... |
| 173 | + def __iter__(self) -> Iterator[_T_co]: ... |
| 174 | + def __next__(self) -> _T_co: ... |
163 | 175 |
|
164 | 176 | class permutations(Iterator[Tuple[_T, ...]], Generic[_T]):
|
165 | 177 | def __init__(self, iterable: Iterable[_T], r: Optional[int] = ...) -> None: ...
|
166 | 178 | def __iter__(self) -> Iterator[Tuple[_T, ...]]: ...
|
167 | 179 | def __next__(self) -> Tuple[_T, ...]: ...
|
168 | 180 |
|
169 |
| -@overload |
170 |
| -def combinations(iterable: Iterable[_T], r: Literal[2]) -> Iterator[Tuple[_T, _T]]: ... |
171 |
| -@overload |
172 |
| -def combinations(iterable: Iterable[_T], r: Literal[3]) -> Iterator[Tuple[_T, _T, _T]]: ... |
173 |
| -@overload |
174 |
| -def combinations(iterable: Iterable[_T], r: Literal[4]) -> Iterator[Tuple[_T, _T, _T, _T]]: ... |
175 |
| -@overload |
176 |
| -def combinations(iterable: Iterable[_T], r: Literal[5]) -> Iterator[Tuple[_T, _T, _T, _T, _T]]: ... |
177 |
| -@overload |
178 |
| -def combinations(iterable: Iterable[_T], r: int) -> Iterator[Tuple[_T, ...]]: ... |
| 181 | +class combinations(Iterator[_T_co], Generic[_T_co]): |
| 182 | + @overload |
| 183 | + def __new__(cls, iterable: Iterable[_T], r: Literal[2]) -> combinations[Tuple[_T, _T]]: ... |
| 184 | + @overload |
| 185 | + def __new__(cls, iterable: Iterable[_T], r: Literal[3]) -> combinations[Tuple[_T, _T, _T]]: ... |
| 186 | + @overload |
| 187 | + def __new__(cls, iterable: Iterable[_T], r: Literal[4]) -> combinations[Tuple[_T, _T, _T, _T]]: ... |
| 188 | + @overload |
| 189 | + def __new__(cls, iterable: Iterable[_T], r: Literal[5]) -> combinations[Tuple[_T, _T, _T, _T, _T]]: ... |
| 190 | + @overload |
| 191 | + def __new__(cls, iterable: Iterable[_T], r: int) -> combinations[Tuple[_T, ...]]: ... |
| 192 | + def __iter__(self) -> Iterator[_T_co]: ... |
| 193 | + def __next__(self) -> _T_co: ... |
179 | 194 |
|
180 | 195 | class combinations_with_replacement(Iterator[Tuple[_T, ...]], Generic[_T]):
|
181 | 196 | def __init__(self, iterable: Iterable[_T], r: int) -> None: ...
|
|
0 commit comments