Skip to content

Commit

Permalink
Address formatting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricahrd Hammond committed Feb 15, 2024
1 parent 7071321 commit acd6806
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
12 changes: 4 additions & 8 deletions cmd2/argparse_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -381,8 +379,7 @@ def __call__(
line: str,
begidx: int,
endidx: int,
) -> List[str]:
... # pragma: no cover
) -> List[str]: ... # pragma: no cover


@runtime_checkable
Expand All @@ -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]
Expand Down
13 changes: 5 additions & 8 deletions cmd2/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand All @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand Down
6 changes: 2 additions & 4 deletions cmd2/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit acd6806

Please sign in to comment.