@@ -426,7 +426,7 @@ def install_command_set(self, cmdset: CommandSet) -> None:
426426 cmdset .on_register (self )
427427 methods = inspect .getmembers (
428428 cmdset ,
429- predicate = lambda meth : ( inspect . ismethod ( meth ) or isinstance (meth , Callable ) )
429+ predicate = lambda meth : isinstance (meth , Callable )
430430 and hasattr (meth , '__name__' ) and meth .__name__ .startswith (COMMAND_FUNC_PREFIX ))
431431
432432 installed_attributes = []
@@ -511,7 +511,8 @@ def uninstall_command_set(self, cmdset: CommandSet):
511511
512512 methods = inspect .getmembers (
513513 cmdset ,
514- predicate = lambda meth : inspect .ismethod (meth ) and meth .__name__ .startswith (COMMAND_FUNC_PREFIX ))
514+ predicate = lambda meth : isinstance (meth , Callable )
515+ and hasattr (meth , '__name__' ) and meth .__name__ .startswith (COMMAND_FUNC_PREFIX ))
515516
516517 for method in methods :
517518 cmd_name = method [0 ][len (COMMAND_FUNC_PREFIX ):]
@@ -538,7 +539,7 @@ def _register_subcommands(self, cmdset: Union[CommandSet, 'Cmd']) -> None:
538539 # find all methods that start with the subcommand prefix
539540 methods = inspect .getmembers (
540541 cmdset ,
541- predicate = lambda meth : ( inspect . ismethod ( meth ) or isinstance (meth , Callable ) )
542+ predicate = lambda meth : isinstance (meth , Callable )
542543 and hasattr (meth , constants .SUBCMD_ATTR_NAME )
543544 and hasattr (meth , constants .SUBCMD_ATTR_COMMAND )
544545 and hasattr (meth , constants .CMD_ATTR_ARGPARSER )
@@ -583,7 +584,7 @@ def _unregister_subcommands(self, cmdset: Union[CommandSet, 'Cmd']) -> None:
583584 # find all methods that start with the subcommand prefix
584585 methods = inspect .getmembers (
585586 cmdset ,
586- predicate = lambda meth : ( inspect . ismethod ( meth ) or isinstance (meth , Callable ) )
587+ predicate = lambda meth : isinstance (meth , Callable )
587588 and hasattr (meth , constants .SUBCMD_ATTR_NAME )
588589 and hasattr (meth , constants .SUBCMD_ATTR_COMMAND )
589590 and hasattr (meth , constants .CMD_ATTR_ARGPARSER )
0 commit comments