@@ -944,7 +944,7 @@ def _register_subcommands(self, cmdset: Union[CommandSet, 'Cmd']) -> None:
944
944
945
945
subcommand_valid , errmsg = self .statement_parser .is_valid_command (subcommand_name , is_subcommand = True )
946
946
if not subcommand_valid :
947
- raise CommandSetRegistrationError (f'Subcommand { str ( subcommand_name ) } is not valid: { errmsg } ' )
947
+ raise CommandSetRegistrationError (f'Subcommand { subcommand_name !s } is not valid: { errmsg } ' )
948
948
949
949
command_tokens = full_command_name .split ()
950
950
command_name = command_tokens [0 ]
@@ -957,13 +957,11 @@ def _register_subcommands(self, cmdset: Union[CommandSet, 'Cmd']) -> None:
957
957
command_func = self .cmd_func (command_name )
958
958
959
959
if command_func is None :
960
- raise CommandSetRegistrationError (
961
- f"Could not find command '{ command_name } ' needed by subcommand: { str (method )} "
962
- )
960
+ raise CommandSetRegistrationError (f"Could not find command '{ command_name } ' needed by subcommand: { method !s} " )
963
961
command_parser = self ._command_parsers .get (command_func )
964
962
if command_parser is None :
965
963
raise CommandSetRegistrationError (
966
- f"Could not find argparser for command '{ command_name } ' needed by subcommand: { str ( method ) } "
964
+ f"Could not find argparser for command '{ command_name } ' needed by subcommand: { method !s } "
967
965
)
968
966
969
967
def find_subcommand (action : argparse .ArgumentParser , subcmd_names : List [str ]) -> argparse .ArgumentParser :
@@ -1059,15 +1057,13 @@ def _unregister_subcommands(self, cmdset: Union[CommandSet, 'Cmd']) -> None:
1059
1057
if command_func is None : # pragma: no cover
1060
1058
# This really shouldn't be possible since _register_subcommands would prevent this from happening
1061
1059
# but keeping in case it does for some strange reason
1062
- raise CommandSetRegistrationError (
1063
- f"Could not find command '{ command_name } ' needed by subcommand: { str (method )} "
1064
- )
1060
+ raise CommandSetRegistrationError (f"Could not find command '{ command_name } ' needed by subcommand: { method !s} " )
1065
1061
command_parser = self ._command_parsers .get (command_func )
1066
1062
if command_parser is None : # pragma: no cover
1067
1063
# This really shouldn't be possible since _register_subcommands would prevent this from happening
1068
1064
# but keeping in case it does for some strange reason
1069
1065
raise CommandSetRegistrationError (
1070
- f"Could not find argparser for command '{ command_name } ' needed by subcommand: { str ( method ) } "
1066
+ f"Could not find argparser for command '{ command_name } ' needed by subcommand: { method !s } "
1071
1067
)
1072
1068
1073
1069
for action in command_parser ._actions :
0 commit comments