click: Support tuples of _ParamTypes, CliRunner fixes (#3259)

This commit is contained in:
Colin Gilgenbach
2019-09-24 08:11:25 -04:00
committed by Sebastian Rittau
parent 3f8c2169d1
commit c33239b011
3 changed files with 6 additions and 5 deletions

View File

@@ -356,7 +356,8 @@ class _ParamType:
# This type is here to resolve https://github.com/python/mypy/issues/5275
_ConvertibleType = Union[type, _ParamType, Tuple[type, ...], Callable[[str], Any], Callable[[Optional[str]], Any]]
_ConvertibleType = Union[type, _ParamType, Tuple[Union[type, _ParamType], ...],
Callable[[str], Any], Callable[[Optional[str]], Any]]
class Parameter:

View File

@@ -56,7 +56,7 @@ class CliRunner:
def make_env(self, overrides: Optional[Mapping[str, str]] = ...) -> Dict[str, str]: ...
def isolation(
self,
input: Optional[IO] = ...,
input: Optional[Union[bytes, Text, IO]] = ...,
env: Optional[Mapping[str, str]] = ...,
color: bool = ...,
) -> ContextManager[BinaryIO]: ...
@@ -64,7 +64,7 @@ class CliRunner:
self,
cli: BaseCommand,
args: Optional[Union[str, Iterable[str]]] = ...,
input: Optional[IO] = ...,
input: Optional[Union[bytes, Text, IO]] = ...,
env: Optional[Mapping[str, str]] = ...,
catch_exceptions: bool = ...,
color: bool = ...,

View File

@@ -4,7 +4,7 @@
from click import BaseCommand
from click.testing import CliRunner, Result
from typing import Any, IO, Iterable, Mapping, Optional, Union, TypeVar
from typing import Any, IO, Iterable, Mapping, Optional, Text, TypeVar, Union
from werkzeug.test import Client
def make_test_environ_builder(app: Any, path: str = ..., base_url: Optional[Any] = ..., subdomain: Optional[Any] = ..., url_scheme: Optional[Any] = ..., *args: Any, **kwargs: Any): ...
@@ -29,7 +29,7 @@ class FlaskCliRunner(CliRunner):
self,
cli: Optional[BaseCommand] = ...,
args: Optional[Union[str, Iterable[str]]] = ...,
input: Optional[IO] = ...,
input: Optional[Union[bytes, IO, Text]] = ...,
env: Optional[Mapping[str, str]] = ...,
catch_exceptions: bool = ...,
color: bool = ...,