mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Fix typehint of click progressbar (#2003)
* Fix typehint of click progressbar * Oops -- stubs are *.pyi files
This commit is contained in:
12
third_party/2and3/click/_termui_impl.pyi
vendored
Normal file
12
third_party/2and3/click/_termui_impl.pyi
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
from typing import ContextManager, Iterator, Generic, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class ProgressBar(object, Generic[_T]):
|
||||
def update(self, n_steps: int) -> None: ...
|
||||
def finish(self) -> None: ...
|
||||
def __enter__(self) -> "ProgressBar[_T]": ...
|
||||
def __exit__(self, exc_type, exc_value, tb) -> None: ...
|
||||
def __iter__(self) -> "ProgressBar[_T]": ...
|
||||
def next(self) -> _T: ...
|
||||
def __next__(self) -> _T: ...
|
||||
28
third_party/2and3/click/termui.pyi
vendored
28
third_party/2and3/click/termui.pyi
vendored
@@ -1,4 +1,3 @@
|
||||
from contextlib import contextmanager
|
||||
from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
@@ -7,11 +6,13 @@ from typing import (
|
||||
IO,
|
||||
List,
|
||||
Optional,
|
||||
overload,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
)
|
||||
|
||||
from click.types import _ConvertibleType
|
||||
from click._termui_impl import ProgressBar as _ProgressBar
|
||||
|
||||
|
||||
def hidden_prompt_func(prompt: str) -> str:
|
||||
@@ -62,10 +63,9 @@ def echo_via_pager(text: str, color: Optional[bool] = ...) -> None:
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
|
||||
@contextmanager
|
||||
@overload
|
||||
def progressbar(
|
||||
iterable: Optional[Iterable[_T]] = ...,
|
||||
iterable: Iterable[_T],
|
||||
length: Optional[int] = ...,
|
||||
label: Optional[str] = ...,
|
||||
show_eta: bool = ...,
|
||||
@@ -79,9 +79,27 @@ def progressbar(
|
||||
width: int = ...,
|
||||
file: Optional[IO] = ...,
|
||||
color: Optional[bool] = ...,
|
||||
) -> Generator[_T, None, None]:
|
||||
) -> _ProgressBar[_T]:
|
||||
...
|
||||
|
||||
@overload
|
||||
def progressbar(
|
||||
iterable: None = ...,
|
||||
length: Optional[int] = ...,
|
||||
label: Optional[str] = ...,
|
||||
show_eta: bool = ...,
|
||||
show_percent: Optional[bool] = ...,
|
||||
show_pos: bool = ...,
|
||||
item_show_func: Optional[Callable[[_T], str]] = ...,
|
||||
fill_char: str = ...,
|
||||
empty_char: str = ...,
|
||||
bar_template: str = ...,
|
||||
info_sep: str = ...,
|
||||
width: int = ...,
|
||||
file: Optional[IO] = ...,
|
||||
color: Optional[bool] = ...,
|
||||
) -> _ProgressBar[int]:
|
||||
...
|
||||
|
||||
def clear() -> None:
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user