Skip to content

Commit 6f7ca85

Browse files
committed
Updated comments and type hint.
1 parent 0d24308 commit 6f7ca85

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

cmd2/argparse_custom.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ def _SubParsersAction_attach_parser( # noqa: N802
533533
subcmd_parser: argparse.ArgumentParser,
534534
**add_parser_kwargs: Any,
535535
) -> None:
536-
"""Attach an existing ArgumentParser to a subparsers action.
536+
"""Attach an existing parser to a subparsers action.
537537
538538
This is useful when a parser is pre-configured (e.g. by cmd2's subcommand decorator)
539539
and needs to be attached to a parent parser.
@@ -828,7 +828,7 @@ def __init__(
828828
*,
829829
ap_completer_type: type['ArgparseCompleter'] | None = None,
830830
) -> None:
831-
"""Initialize the Cmd2ArgumentParser instance, a custom ArgumentParser added by cmd2.
831+
"""Initialize the Cmd2ArgumentParser instance.
832832
833833
:param ap_completer_type: optional parameter which specifies a subclass of ArgparseCompleter for custom completion
834834
behavior on this parser. If this is None or not present, then cmd2 will use
@@ -921,7 +921,7 @@ def update_prog(self, prog: str) -> None:
921921
# 1. We can't use action._choices_actions because it excludes subcommands without help text.
922922
# 2. Since dictionaries are ordered and argparse inserts the primary name before aliases,
923923
# we assume the first time we encounter a parser, the key is the true subcommand name.
924-
updated_parsers: set[argparse.ArgumentParser] = set()
924+
updated_parsers: set[Cmd2ArgumentParser] = set()
925925

926926
# Set the prog value for each subcommand's parser
927927
for subcmd_name, subcmd_parser in action.choices.items():
@@ -1055,7 +1055,6 @@ def _check_value(self, action: argparse.Action, value: Any) -> None:
10551055
10561056
When displaying choices, use CompletionItem.value instead of the CompletionItem instance.
10571057
1058-
:param self: ArgumentParser instance
10591058
:param action: the action being populated
10601059
:param value: value from command line already run through conversion function by argparse
10611060
"""
@@ -1098,7 +1097,7 @@ def set(self, new_val: Any) -> None:
10981097

10991098

11001099
def set_default_argument_parser_type(parser_type: type[Cmd2ArgumentParser]) -> None:
1101-
"""Set the default ArgumentParser class for cmd2's built-in commands.
1100+
"""Set the default Cmd2ArgumentParser class for cmd2's built-in commands.
11021101
11031102
Since built-in commands rely on customizations made in Cmd2ArgumentParser,
11041103
your custom parser class should inherit from Cmd2ArgumentParser.

0 commit comments

Comments
 (0)