@@ -944,7 +944,7 @@ def _register_subcommands(self, cmdset: Union[CommandSet, 'Cmd']) -> None:
944944
945945 subcommand_valid , errmsg = self .statement_parser .is_valid_command (subcommand_name , is_subcommand = True )
946946 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 } ' )
948948
949949 command_tokens = full_command_name .split ()
950950 command_name = command_tokens [0 ]
@@ -957,13 +957,11 @@ def _register_subcommands(self, cmdset: Union[CommandSet, 'Cmd']) -> None:
957957 command_func = self .cmd_func (command_name )
958958
959959 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} " )
963961 command_parser = self ._command_parsers .get (command_func )
964962 if command_parser is None :
965963 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 } "
967965 )
968966
969967 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:
10591057 if command_func is None : # pragma: no cover
10601058 # This really shouldn't be possible since _register_subcommands would prevent this from happening
10611059 # 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} " )
10651061 command_parser = self ._command_parsers .get (command_func )
10661062 if command_parser is None : # pragma: no cover
10671063 # This really shouldn't be possible since _register_subcommands would prevent this from happening
10681064 # but keeping in case it does for some strange reason
10691065 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 } "
10711067 )
10721068
10731069 for action in command_parser ._actions :
0 commit comments