From 018ecb3f16867a88986c3c47969cb2779c6a276c Mon Sep 17 00:00:00 2001 From: Chandan Singh Date: Mon, 3 Jun 2019 15:38:27 +0100 Subject: [PATCH] Update Click to 7.0 (#3027) Closes #3020. --- third_party/2and3/click/README.md | 2 +- third_party/2and3/click/core.pyi | 10 ++++++++++ third_party/2and3/click/exceptions.pyi | 2 +- third_party/2and3/click/termui.pyi | 8 ++++++-- third_party/2and3/click/testing.pyi | 11 +++++++++++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/third_party/2and3/click/README.md b/third_party/2and3/click/README.md index debe70142..aec5fa911 100644 --- a/third_party/2and3/click/README.md +++ b/third_party/2and3/click/README.md @@ -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. diff --git a/third_party/2and3/click/core.pyi b/third_party/2and3/click/core.pyi index 2cc32f00a..302e2a52f 100644 --- a/third_party/2and3/click/core.pyi +++ b/third_party/2and3/click/core.pyi @@ -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: ... diff --git a/third_party/2and3/click/exceptions.pyi b/third_party/2and3/click/exceptions.pyi index 7e081be0a..ab2932eb4 100644 --- a/third_party/2and3/click/exceptions.pyi +++ b/third_party/2and3/click/exceptions.pyi @@ -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: ... diff --git a/third_party/2and3/click/termui.pyi b/third_party/2and3/click/termui.pyi index 95b685076..4262e3230 100644 --- a/third_party/2and3/click/termui.pyi +++ b/third_party/2and3/click/termui.pyi @@ -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 = ..., diff --git a/third_party/2and3/click/testing.pyi b/third_party/2and3/click/testing.pyi index c74351685..6b16df9b2 100644 --- a/third_party/2and3/click/testing.pyi +++ b/third_party/2and3/click/testing.pyi @@ -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: ...