mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 12:14:27 +08:00
add overloads for combinations r 2-5 (#4309)
This doesn't cover everything but it means it a lot of common usages the type will be slightly more useful Co-authored-by: steve brazier <steve.brazier@trioptima.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
import sys
|
||||
from typing import Any, Callable, Generic, Iterable, Iterator, Optional, Tuple, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_S = TypeVar("_S")
|
||||
@@ -97,5 +98,14 @@ def product(
|
||||
@overload
|
||||
def product(*iterables: Iterable[Any], repeat: int = ...) -> Iterator[Tuple[Any, ...]]: ...
|
||||
def permutations(iterable: Iterable[_T], r: Optional[int] = ...) -> Iterator[Tuple[_T, ...]]: ...
|
||||
@overload
|
||||
def combinations(iterable: Iterable[_T], r: Literal[2]) -> Iterator[Tuple[_T, _T]]: ...
|
||||
@overload
|
||||
def combinations(iterable: Iterable[_T], r: Literal[3]) -> Iterator[Tuple[_T, _T, _T]]: ...
|
||||
@overload
|
||||
def combinations(iterable: Iterable[_T], r: Literal[4]) -> Iterator[Tuple[_T, _T, _T, _T]]: ...
|
||||
@overload
|
||||
def combinations(iterable: Iterable[_T], r: Literal[5]) -> Iterator[Tuple[_T, _T, _T, _T, _T]]: ...
|
||||
@overload
|
||||
def combinations(iterable: Iterable[_T], r: int) -> Iterator[Tuple[_T, ...]]: ...
|
||||
def combinations_with_replacement(iterable: Iterable[_T], r: int) -> Iterator[Tuple[_T, ...]]: ...
|
||||
|
||||
Reference in New Issue
Block a user