fix(stubs/click): don't force autocompleter to accept anything as context (#5265)

* fix(stubs/click): don't force autocompleter to accept anything as context

Additionally it's enough if it's return value is iterable (e.g. a
generator).
This commit is contained in:
Giel van Schijndel
2021-04-30 17:03:17 +02:00
committed by GitHub
parent fe4acabdd7
commit b0c6598fba

View File

@@ -1,5 +1,5 @@
from distutils.version import Version
from typing import Any, Callable, Dict, List, Optional, Protocol, Text, Tuple, Type, TypeVar, Union, overload
from typing import Any, Callable, Dict, Iterable, List, Optional, Protocol, Text, Tuple, Type, TypeVar, Union, overload
from click.core import Argument, Command, Context, Group, Option, Parameter, _ConvertibleType
@@ -71,7 +71,7 @@ def argument(
expose_value: bool = ...,
is_eager: bool = ...,
envvar: Optional[Union[str, List[str]]] = ...,
autocompletion: Optional[Callable[[Any, List[str], str], List[Union[str, Tuple[str, str]]]]] = ...,
autocompletion: Optional[Callable[[Context, List[str], str], Iterable[Union[str, Tuple[str, str]]]]] = ...,
) -> _IdentityFunction: ...
@overload
def option(