mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-23 01:58:29 +08:00
Added missing type annotations and type arguments (#5070)
Co-authored-by: Eric Traut <erictr@microsoft.com> Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from typing import Generic, Optional, TypeVar
|
||||
from types import TracebackType
|
||||
from typing import Generic, Optional, Type, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -6,7 +7,9 @@ class ProgressBar(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 __exit__(
|
||||
self, exctype: Optional[Type[BaseException]], excinst: Optional[BaseException], exctb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
def __iter__(self) -> ProgressBar[_T]: ...
|
||||
def next(self) -> _T: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
@@ -86,8 +86,8 @@ class Context:
|
||||
def exit(self, code: Union[int, str] = ...) -> NoReturn: ...
|
||||
def get_usage(self) -> str: ...
|
||||
def get_help(self) -> str: ...
|
||||
def invoke(self, callback: Union[Command, Callable[..., Any]], *args, **kwargs) -> Any: ...
|
||||
def forward(self, callback: Union[Command, Callable[..., Any]], *args, **kwargs) -> Any: ...
|
||||
def invoke(self, callback: Union[Command, Callable[..., Any]], *args: Any, **kwargs: Any) -> Any: ...
|
||||
def forward(self, callback: Union[Command, Callable[..., Any]], *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
class BaseCommand:
|
||||
allow_extra_args: bool
|
||||
@@ -98,7 +98,7 @@ class BaseCommand:
|
||||
def __init__(self, name: str, context_settings: Optional[Dict[Any, Any]] = ...) -> None: ...
|
||||
def get_usage(self, ctx: Context) -> str: ...
|
||||
def get_help(self, ctx: Context) -> str: ...
|
||||
def make_context(self, info_name: str, args: List[str], parent: Optional[Context] = ..., **extra) -> Context: ...
|
||||
def make_context(self, info_name: str, args: List[str], parent: Optional[Context] = ..., **extra: Any) -> Context: ...
|
||||
def parse_args(self, ctx: Context, args: List[str]) -> List[str]: ...
|
||||
def invoke(self, ctx: Context) -> Any: ...
|
||||
def main(
|
||||
@@ -107,9 +107,9 @@ class BaseCommand:
|
||||
prog_name: Optional[str] = ...,
|
||||
complete_var: Optional[str] = ...,
|
||||
standalone_mode: bool = ...,
|
||||
**extra,
|
||||
**extra: Any,
|
||||
) -> Any: ...
|
||||
def __call__(self, *args, **kwargs) -> Any: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
class Command(BaseCommand):
|
||||
callback: Optional[Callable[..., Any]]
|
||||
@@ -164,7 +164,7 @@ class MultiCommand(Command):
|
||||
subcommand_metavar: Optional[str] = ...,
|
||||
chain: bool = ...,
|
||||
result_callback: Optional[Callable[..., Any]] = ...,
|
||||
**attrs,
|
||||
**attrs: Any,
|
||||
) -> None: ...
|
||||
def resultcallback(self, replace: bool = ...) -> Callable[[_F], _F]: ...
|
||||
def format_commands(self, ctx: Context, formatter: HelpFormatter) -> None: ...
|
||||
@@ -174,14 +174,14 @@ class MultiCommand(Command):
|
||||
|
||||
class Group(MultiCommand):
|
||||
commands: Dict[str, Command]
|
||||
def __init__(self, name: Optional[str] = ..., commands: Optional[Dict[str, Command]] = ..., **attrs) -> None: ...
|
||||
def add_command(self, cmd: Command, name: Optional[str] = ...): ...
|
||||
def command(self, *args, **kwargs) -> Callable[[Callable[..., Any]], Command]: ...
|
||||
def group(self, *args, **kwargs) -> Callable[[Callable[..., Any]], Group]: ...
|
||||
def __init__(self, name: Optional[str] = ..., commands: Optional[Dict[str, Command]] = ..., **attrs: Any) -> None: ...
|
||||
def add_command(self, cmd: Command, name: Optional[str] = ...) -> None: ...
|
||||
def command(self, *args: Any, **kwargs: Any) -> Callable[[Callable[..., Any]], Command]: ...
|
||||
def group(self, *args: Any, **kwargs: Any) -> Callable[[Callable[..., Any]], Group]: ...
|
||||
|
||||
class CommandCollection(MultiCommand):
|
||||
sources: List[MultiCommand]
|
||||
def __init__(self, name: Optional[str] = ..., sources: Optional[List[MultiCommand]] = ..., **attrs) -> None: ...
|
||||
def __init__(self, name: Optional[str] = ..., sources: Optional[List[MultiCommand]] = ..., **attrs: Any) -> None: ...
|
||||
def add_source(self, multi_cmd: MultiCommand) -> None: ...
|
||||
|
||||
class _ParamType:
|
||||
@@ -277,9 +277,9 @@ class Option(Parameter):
|
||||
hidden: bool = ...,
|
||||
show_choices: bool = ...,
|
||||
show_envvar: bool = ...,
|
||||
**attrs,
|
||||
**attrs: Any,
|
||||
) -> None: ...
|
||||
def prompt_for_value(self, ctx: Context) -> Any: ...
|
||||
|
||||
class Argument(Parameter):
|
||||
def __init__(self, param_decls: Optional[List[str]] = ..., required: Optional[bool] = ..., **attrs) -> None: ...
|
||||
def __init__(self, param_decls: Optional[List[str]] = ..., required: Optional[bool] = ..., **attrs: Any) -> None: ...
|
||||
|
||||
@@ -22,12 +22,12 @@ class HelpFormatter:
|
||||
prog: str,
|
||||
args: str = ...,
|
||||
prefix: str = ...,
|
||||
): ...
|
||||
) -> None: ...
|
||||
def write_heading(self, heading: str) -> None: ...
|
||||
def write_paragraph(self) -> None: ...
|
||||
def write_text(self, text: str) -> None: ...
|
||||
def write_dl(self, rows: Iterable[Iterable[str]], col_max: int = ..., col_spacing: int = ...) -> None: ...
|
||||
def section(self, name) -> ContextManager[None]: ...
|
||||
def section(self, name: str) -> ContextManager[None]: ...
|
||||
def indentation(self) -> ContextManager[None]: ...
|
||||
def getvalue(self) -> str: ...
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ def secho(
|
||||
blink: Optional[bool] = ...,
|
||||
reverse: Optional[bool] = ...,
|
||||
reset: bool = ...,
|
||||
): ...
|
||||
) -> None: ...
|
||||
def edit(
|
||||
text: Optional[str] = ...,
|
||||
editor: Optional[str] = ...,
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from typing import IO, Any, AnyStr, Generic, Iterator, List, Optional, Text, TypeVar
|
||||
from types import TracebackType
|
||||
from typing import IO, Any, AnyStr, Generic, Iterator, List, Optional, Text, Type, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
def _posixify(name: str) -> str: ...
|
||||
def safecall(func: _T) -> _T: ...
|
||||
def make_str(value: Any) -> str: ...
|
||||
def make_default_short_help(help: str, max_length: int = ...): ...
|
||||
def make_default_short_help(help: str, max_length: int = ...) -> str: ...
|
||||
|
||||
class LazyFile(object):
|
||||
name: str
|
||||
@@ -20,14 +21,18 @@ class LazyFile(object):
|
||||
def close(self) -> None: ...
|
||||
def close_intelligently(self) -> None: ...
|
||||
def __enter__(self) -> LazyFile: ...
|
||||
def __exit__(self, exc_type, exc_value, tb): ...
|
||||
def __exit__(
|
||||
self, exctype: Optional[Type[BaseException]], excinst: Optional[BaseException], exctb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[Any]: ...
|
||||
|
||||
class KeepOpenFile(Generic[AnyStr]):
|
||||
_file: IO[AnyStr]
|
||||
def __init__(self, file: IO[AnyStr]) -> None: ...
|
||||
def __enter__(self) -> KeepOpenFile[AnyStr]: ...
|
||||
def __exit__(self, exc_type, exc_value, tb): ...
|
||||
def __exit__(
|
||||
self, exctype: Optional[Type[BaseException]], excinst: Optional[BaseException], exctb: Optional[TracebackType]
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[AnyStr]: ...
|
||||
|
||||
def echo(
|
||||
|
||||
Reference in New Issue
Block a user