@@ -700,10 +700,7 @@ def _build_parser(
700
700
elif callable (parser_builder ):
701
701
parser = parser_builder ()
702
702
elif isinstance (parser_builder , argparse .ArgumentParser ):
703
- if sys .version_info >= (3 , 6 , 4 ):
704
- parser = copy .deepcopy (parser_builder )
705
- else : # pragma: no cover
706
- parser = parser_builder
703
+ parser = copy .deepcopy (parser_builder )
707
704
return parser
708
705
709
706
def _register_command_parser (self , command : str , command_method : Callable [..., Any ]) -> None :
@@ -778,9 +775,9 @@ def unregister_command_set(self, cmdset: CommandSet) -> None:
778
775
cmdset .on_unregister ()
779
776
self ._unregister_subcommands (cmdset )
780
777
781
- methods = inspect .getmembers (
778
+ methods : List [ Tuple [ str , Callable [[ Any ], Any ]]] = inspect .getmembers (
782
779
cmdset ,
783
- predicate = lambda meth : isinstance (meth , Callable ) # type: ignore[arg-type, var-annotated ]
780
+ predicate = lambda meth : isinstance (meth , Callable ) # type: ignore[arg-type]
784
781
and hasattr (meth , '__name__' )
785
782
and meth .__name__ .startswith (COMMAND_FUNC_PREFIX ),
786
783
)
@@ -809,9 +806,9 @@ def unregister_command_set(self, cmdset: CommandSet) -> None:
809
806
self ._installed_command_sets .remove (cmdset )
810
807
811
808
def _check_uninstallable (self , cmdset : CommandSet ) -> None :
812
- methods = inspect .getmembers (
809
+ methods : List [ Tuple [ str , Callable [[ Any ], Any ]]] = inspect .getmembers (
813
810
cmdset ,
814
- predicate = lambda meth : isinstance (meth , Callable ) # type: ignore[arg-type, var-annotated ]
811
+ predicate = lambda meth : isinstance (meth , Callable ) # type: ignore[arg-type]
815
812
and hasattr (meth , '__name__' )
816
813
and meth .__name__ .startswith (COMMAND_FUNC_PREFIX ),
817
814
)
@@ -3328,19 +3325,14 @@ def _cmdloop(self) -> None:
3328
3325
#############################################################
3329
3326
3330
3327
# Top-level parser for alias
3331
- @staticmethod
3332
- def _build_alias_parser () -> argparse .ArgumentParser :
3333
- alias_description = (
3334
- "Manage aliases\n " "\n " "An alias is a command that enables replacement of a word by another string."
3335
- )
3336
- alias_epilog = "See also:\n " " macro"
3337
- alias_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = alias_description , epilog = alias_epilog )
3338
- alias_subparsers = alias_parser .add_subparsers (dest = 'subcommand' , metavar = 'SUBCOMMAND' )
3339
- alias_subparsers .required = True
3340
- return alias_parser
3328
+ alias_description = "Manage aliases\n " "\n " "An alias is a command that enables replacement of a word by another string."
3329
+ alias_epilog = "See also:\n " " macro"
3330
+ alias_parser = argparse_custom .DEFAULT_ARGUMENT_PARSER (description = alias_description , epilog = alias_epilog )
3331
+ alias_subparsers = alias_parser .add_subparsers (dest = 'subcommand' , metavar = 'SUBCOMMAND' )
3332
+ alias_subparsers .required = True
3341
3333
3342
3334
# Preserve quotes since we are passing strings to other commands
3343
- @with_argparser (_build_alias_parser , preserve_quotes = True )
3335
+ @with_argparser (alias_parser , preserve_quotes = True )
3344
3336
def do_alias (self , args : argparse .Namespace ) -> None :
3345
3337
"""Manage aliases"""
3346
3338
# Call handler for whatever subcommand was selected
0 commit comments