Skip to content

Commit 018ecb3

Browse files
cs-shadowJelleZijlstra
authored andcommitted
Update Click to 7.0 (#3027)
Closes #3020.
1 parent f8093d6 commit 018ecb3

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

third_party/2and3/click/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# click 6.6, Python 3
1+
# click 7.0
22

33
`__init__.pyi` is almost a copy of `click/__init__.py`. It's a shortcut module
44
anyway in the actual sources so it works well with minimal changes.

third_party/2and3/click/core.pyi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ class Command(BaseCommand):
228228
def make_parser(self, ctx: Context) -> OptionParser:
229229
...
230230

231+
def get_short_help_str(self, limit: int = ...) -> str:
232+
...
233+
231234
def format_help(self, ctx: Context, formatter: HelpFormatter) -> None:
232235
...
233236

@@ -426,6 +429,9 @@ class Parameter:
426429
def get_usage_pieces(self, ctx: Context) -> List[str]:
427430
...
428431

432+
def get_error_hint(self, ctx: Context) -> str:
433+
...
434+
429435

430436
class Option(Parameter):
431437
prompt: str # sic
@@ -438,8 +444,10 @@ class Option(Parameter):
438444
multiple: bool
439445
allow_from_autoenv: bool
440446
help: Optional[str]
447+
hidden: bool
441448
show_default: bool
442449
show_choices: bool
450+
show_envvar: bool
443451

444452
def __init__(
445453
self,
@@ -455,7 +463,9 @@ class Option(Parameter):
455463
allow_from_autoenv: bool = ...,
456464
type: Optional[_ConvertibleType] = ...,
457465
help: Optional[str] = ...,
466+
hidden: bool = ...,
458467
show_choices: bool = ...,
468+
show_envvar: bool = ...,
459469
**attrs
460470
) -> None:
461471
...

third_party/2and3/click/exceptions.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class NoSuchOption(UsageError):
7070

7171

7272
class BadOptionUsage(UsageError):
73-
def __init__(self, message: str, ctx: Optional[Context] = ...) -> None:
73+
def __init__(self, option_name: str, message: str, ctx: Optional[Context] = ...) -> None:
7474
...
7575

7676

third_party/2and3/click/termui.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ from typing import (
1010
overload,
1111
Tuple,
1212
TypeVar,
13+
Union,
1314
)
1415

1516
from click.core import _ConvertibleType
@@ -59,7 +60,10 @@ def get_terminal_size() -> Tuple[int, int]:
5960
...
6061

6162

62-
def echo_via_pager(text: str, color: Optional[bool] = ...) -> None:
63+
def echo_via_pager(
64+
text_or_generator: Union[str, Iterable[str], Callable[[], Generator[str, None, None]]],
65+
color: Optional[bool]
66+
) -> None:
6367
...
6468

6569

@@ -127,7 +131,7 @@ def unstyle(text: str) -> str:
127131

128132
# Styling options copied from style() for nicer type checking.
129133
def secho(
130-
text: str,
134+
message: Optional[str] = ...,
131135
file: Optional[IO] = ...,
132136
nl: bool = ...,
133137
err: bool = ...,

third_party/2and3/click/testing.pyi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,36 @@ class Result:
2020
exit_code: int
2121
exception: Any
2222
exc_info: Optional[Any]
23+
stdout_bytes: bytes
24+
stderr_bytes: bytes
2325
def __init__(
2426
self,
2527
runner: CliRunner,
28+
stdout_bytes: bytes,
29+
stderr_bytes: bytes,
2630
exit_code: int,
2731
exception: Any,
2832
exc_info: Optional[Any] = ...,
2933
) -> None: ...
3034
@property
3135
def output(self) -> Text: ...
36+
@property
37+
def stdout(self) -> Text: ...
38+
@property
39+
def stderr(self) -> Text: ...
3240

3341
class CliRunner:
3442
charset: str
3543
env: Mapping[str, str]
3644
echo_stdin: bool
45+
mix_stderr: bool
46+
3747
def __init__(
3848
self,
3949
charset: Optional[Text] = ...,
4050
env: Optional[Mapping[str, str]] = ...,
4151
echo_stdin: bool = ...,
52+
mix_stderr: bool = ...,
4253
) -> None:
4354
...
4455
def get_default_prog_name(self, cli: BaseCommand) -> str: ...

0 commit comments

Comments
 (0)