diff --git a/cmd2/argparse_custom.py b/cmd2/argparse_custom.py index 2371fa54..595737c5 100644 --- a/cmd2/argparse_custom.py +++ b/cmd2/argparse_custom.py @@ -352,8 +352,7 @@ class ChoicesProviderFuncBase(Protocol): Function that returns a list of choices in support of tab completion """ - def __call__(self) -> List[str]: - ... # pragma: no cover + def __call__(self) -> List[str]: ... # pragma: no cover @runtime_checkable @@ -362,8 +361,7 @@ class ChoicesProviderFuncWithTokens(Protocol): Function that returns a list of choices in support of tab completion and accepts a dictionary of prior arguments. """ - def __call__(self, *, arg_tokens: Dict[str, List[str]] = {}) -> List[str]: - ... # pragma: no cover + def __call__(self, *, arg_tokens: Dict[str, List[str]] = {}) -> List[str]: ... # pragma: no cover ChoicesProviderFunc = Union[ChoicesProviderFuncBase, ChoicesProviderFuncWithTokens] @@ -381,8 +379,7 @@ def __call__( line: str, begidx: int, endidx: int, - ) -> List[str]: - ... # pragma: no cover + ) -> List[str]: ... # pragma: no cover @runtime_checkable @@ -400,8 +397,7 @@ def __call__( endidx: int, *, arg_tokens: Dict[str, List[str]] = {}, - ) -> List[str]: - ... # pragma: no cover + ) -> List[str]: ... # pragma: no cover CompleterFunc = Union[CompleterFuncBase, CompleterFuncWithTokens] diff --git a/cmd2/decorators.py b/cmd2/decorators.py index c9fd159e..fdebdd4e 100644 --- a/cmd2/decorators.py +++ b/cmd2/decorators.py @@ -247,6 +247,7 @@ def _set_parser_prog(parser: argparse.ArgumentParser, prog: str) -> None: elif action.required: req_args.append(action.dest) + #: Function signature for a Command Function that uses an argparse.ArgumentParser to process user input #: and optionally returns a boolean ArgparseCommandFuncOptionalBoolReturn = Callable[[CommandParent, argparse.Namespace], Optional[bool]] @@ -272,8 +273,7 @@ def with_argparser( ns_provider: Optional[Callable[..., argparse.Namespace]] = None, preserve_quotes: bool = False, with_unknown_args: bool = False, -) -> Callable[[ArgparseCommandFunc[CommandParent]], RawCommandFuncOptionalBoolReturn[CommandParent]]: - ... # pragma: no cover +) -> Callable[[ArgparseCommandFunc[CommandParent]], RawCommandFuncOptionalBoolReturn[CommandParent]]: ... # pragma: no cover @overload @@ -283,8 +283,7 @@ def with_argparser( ns_provider: Optional[Callable[..., argparse.Namespace]] = None, preserve_quotes: bool = False, with_unknown_args: bool = False, -) -> Callable[[ArgparseCommandFunc[CommandParent]], RawCommandFuncOptionalBoolReturn[CommandParent]]: - ... # pragma: no cover +) -> Callable[[ArgparseCommandFunc[CommandParent]], RawCommandFuncOptionalBoolReturn[CommandParent]]: ... # pragma: no cover def with_argparser( @@ -424,8 +423,7 @@ def as_subcommand_to( *, help: Optional[str] = None, aliases: Optional[List[str]] = None, -) -> Callable[[ArgparseCommandFunc[CommandParent]], ArgparseCommandFunc[CommandParent]]: - ... # pragma: no cover +) -> Callable[[ArgparseCommandFunc[CommandParent]], ArgparseCommandFunc[CommandParent]]: ... # pragma: no cover @overload @@ -436,8 +434,7 @@ def as_subcommand_to( *, help: Optional[str] = None, aliases: Optional[List[str]] = None, -) -> Callable[[ArgparseCommandFunc[CommandParent]], ArgparseCommandFunc[CommandParent]]: - ... # pragma: no cover +) -> Callable[[ArgparseCommandFunc[CommandParent]], ArgparseCommandFunc[CommandParent]]: ... # pragma: no cover def as_subcommand_to( diff --git a/cmd2/history.py b/cmd2/history.py index a7d6baff..c79a19dd 100644 --- a/cmd2/history.py +++ b/cmd2/history.py @@ -154,12 +154,10 @@ def _zero_based_index(self, onebased: Union[int, str]) -> int: return result @overload - def append(self, new: HistoryItem) -> None: - ... # pragma: no cover + def append(self, new: HistoryItem) -> None: ... # pragma: no cover @overload - def append(self, new: Statement) -> None: - ... # pragma: no cover + def append(self, new: Statement) -> None: ... # pragma: no cover def append(self, new: Union[Statement, HistoryItem]) -> None: """Append a new statement to the end of the History list.