Update Click to 7.0 (#3027)

Closes #3020.
This commit is contained in:
Chandan Singh
2019-06-03 15:38:27 +01:00
committed by Jelle Zijlstra
parent f8093d63cd
commit 018ecb3f16
5 changed files with 29 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
# click 6.6, Python 3
# click 7.0
`__init__.pyi` is almost a copy of `click/__init__.py`. It's a shortcut module
anyway in the actual sources so it works well with minimal changes.

View File

@@ -228,6 +228,9 @@ class Command(BaseCommand):
def make_parser(self, ctx: Context) -> OptionParser:
...
def get_short_help_str(self, limit: int = ...) -> str:
...
def format_help(self, ctx: Context, formatter: HelpFormatter) -> None:
...
@@ -426,6 +429,9 @@ class Parameter:
def get_usage_pieces(self, ctx: Context) -> List[str]:
...
def get_error_hint(self, ctx: Context) -> str:
...
class Option(Parameter):
prompt: str # sic
@@ -438,8 +444,10 @@ class Option(Parameter):
multiple: bool
allow_from_autoenv: bool
help: Optional[str]
hidden: bool
show_default: bool
show_choices: bool
show_envvar: bool
def __init__(
self,
@@ -455,7 +463,9 @@ class Option(Parameter):
allow_from_autoenv: bool = ...,
type: Optional[_ConvertibleType] = ...,
help: Optional[str] = ...,
hidden: bool = ...,
show_choices: bool = ...,
show_envvar: bool = ...,
**attrs
) -> None:
...

View File

@@ -70,7 +70,7 @@ class NoSuchOption(UsageError):
class BadOptionUsage(UsageError):
def __init__(self, message: str, ctx: Optional[Context] = ...) -> None:
def __init__(self, option_name: str, message: str, ctx: Optional[Context] = ...) -> None:
...

View File

@@ -10,6 +10,7 @@ from typing import (
overload,
Tuple,
TypeVar,
Union,
)
from click.core import _ConvertibleType
@@ -59,7 +60,10 @@ def get_terminal_size() -> Tuple[int, int]:
...
def echo_via_pager(text: str, color: Optional[bool] = ...) -> None:
def echo_via_pager(
text_or_generator: Union[str, Iterable[str], Callable[[], Generator[str, None, None]]],
color: Optional[bool]
) -> None:
...
@@ -127,7 +131,7 @@ def unstyle(text: str) -> str:
# Styling options copied from style() for nicer type checking.
def secho(
text: str,
message: Optional[str] = ...,
file: Optional[IO] = ...,
nl: bool = ...,
err: bool = ...,

View File

@@ -20,25 +20,36 @@ class Result:
exit_code: int
exception: Any
exc_info: Optional[Any]
stdout_bytes: bytes
stderr_bytes: bytes
def __init__(
self,
runner: CliRunner,
stdout_bytes: bytes,
stderr_bytes: bytes,
exit_code: int,
exception: Any,
exc_info: Optional[Any] = ...,
) -> None: ...
@property
def output(self) -> Text: ...
@property
def stdout(self) -> Text: ...
@property
def stderr(self) -> Text: ...
class CliRunner:
charset: str
env: Mapping[str, str]
echo_stdin: bool
mix_stderr: bool
def __init__(
self,
charset: Optional[Text] = ...,
env: Optional[Mapping[str, str]] = ...,
echo_stdin: bool = ...,
mix_stderr: bool = ...,
) -> None:
...
def get_default_prog_name(self, cli: BaseCommand) -> str: ...