@@ -758,9 +758,11 @@ def register_command_set(self, cmdset: CommandSet) -> None:
758758 list [tuple [str , Callable [..., Any ]]],
759759 inspect .getmembers (
760760 cmdset ,
761- predicate = lambda meth : isinstance (meth , Callable ) # type: ignore[arg-type]
762- and hasattr (meth , '__name__' )
763- and meth .__name__ .startswith (COMMAND_FUNC_PREFIX ),
761+ predicate = lambda meth : ( # type: ignore[arg-type]
762+ isinstance (meth , Callable ) # type: ignore[arg-type]
763+ and hasattr (meth , '__name__' )
764+ and meth .__name__ .startswith (COMMAND_FUNC_PREFIX )
765+ ),
764766 ),
765767 )
766768
@@ -913,9 +915,11 @@ def unregister_command_set(self, cmdset: CommandSet) -> None:
913915
914916 methods : list [tuple [str , Callable [..., Any ]]] = inspect .getmembers (
915917 cmdset ,
916- predicate = lambda meth : isinstance (meth , Callable ) # type: ignore[arg-type]
917- and hasattr (meth , '__name__' )
918- and meth .__name__ .startswith (COMMAND_FUNC_PREFIX ),
918+ predicate = lambda meth : ( # type: ignore[arg-type]
919+ isinstance (meth , Callable ) # type: ignore[arg-type]
920+ and hasattr (meth , '__name__' )
921+ and meth .__name__ .startswith (COMMAND_FUNC_PREFIX )
922+ ),
919923 )
920924
921925 for cmd_func_name , command_method in methods :
@@ -959,9 +963,11 @@ def check_parser_uninstallable(parser: argparse.ArgumentParser) -> None:
959963
960964 methods : list [tuple [str , Callable [..., Any ]]] = inspect .getmembers (
961965 cmdset ,
962- predicate = lambda meth : isinstance (meth , Callable ) # type: ignore[arg-type]
963- and hasattr (meth , '__name__' )
964- and meth .__name__ .startswith (COMMAND_FUNC_PREFIX ),
966+ predicate = lambda meth : ( # type: ignore[arg-type]
967+ isinstance (meth , Callable ) # type: ignore[arg-type]
968+ and hasattr (meth , '__name__' )
969+ and meth .__name__ .startswith (COMMAND_FUNC_PREFIX )
970+ ),
965971 )
966972
967973 for cmd_func_name , command_method in methods :
@@ -983,10 +989,12 @@ def _register_subcommands(self, cmdset: Union[CommandSet, 'Cmd']) -> None:
983989 # find methods that have the required attributes necessary to be recognized as a sub-command
984990 methods = inspect .getmembers (
985991 cmdset ,
986- predicate = lambda meth : isinstance (meth , Callable ) # type: ignore[arg-type]
987- and hasattr (meth , constants .SUBCMD_ATTR_NAME )
988- and hasattr (meth , constants .SUBCMD_ATTR_COMMAND )
989- and hasattr (meth , constants .CMD_ATTR_ARGPARSER ),
992+ predicate = lambda meth : (
993+ isinstance (meth , Callable ) # type: ignore[arg-type]
994+ and hasattr (meth , constants .SUBCMD_ATTR_NAME )
995+ and hasattr (meth , constants .SUBCMD_ATTR_COMMAND )
996+ and hasattr (meth , constants .CMD_ATTR_ARGPARSER )
997+ ),
990998 )
991999
9921000 # iterate through all matching methods
@@ -1072,10 +1080,12 @@ def _unregister_subcommands(self, cmdset: Union[CommandSet, 'Cmd']) -> None:
10721080 # find methods that have the required attributes necessary to be recognized as a sub-command
10731081 methods = inspect .getmembers (
10741082 cmdset ,
1075- predicate = lambda meth : isinstance (meth , Callable ) # type: ignore[arg-type]
1076- and hasattr (meth , constants .SUBCMD_ATTR_NAME )
1077- and hasattr (meth , constants .SUBCMD_ATTR_COMMAND )
1078- and hasattr (meth , constants .CMD_ATTR_ARGPARSER ),
1083+ predicate = lambda meth : (
1084+ isinstance (meth , Callable ) # type: ignore[arg-type]
1085+ and hasattr (meth , constants .SUBCMD_ATTR_NAME )
1086+ and hasattr (meth , constants .SUBCMD_ATTR_COMMAND )
1087+ and hasattr (meth , constants .CMD_ATTR_ARGPARSER )
1088+ ),
10791089 )
10801090
10811091 # iterate through all matching methods
@@ -2262,7 +2272,7 @@ def _display_matches_pyreadline(self, matches: list[str]) -> None: # pragma: no
22622272 # Otherwise use pyreadline3's formatter
22632273 else :
22642274 # Check if we should show display_matches
2265- matches_to_display = self .display_matches if self . display_matches else matches
2275+ matches_to_display = self .display_matches or matches
22662276
22672277 # Add padding for visual appeal
22682278 matches_to_display , _ = self ._pad_matches_to_display (matches_to_display )
0 commit comments