@@ -3652,9 +3652,8 @@ def enable_category(self, category: str) -> None:
36523652 :param category: the category to enable
36533653 """
36543654 for cmd_name in list (self .disabled_commands ):
3655- dc = self .disabled_commands [cmd_name ]
3656- cmd_category = getattr (dc .command_function , HELP_CATEGORY , None )
3657- if cmd_category is not None and cmd_category == category :
3655+ func = self .disabled_commands [cmd_name ].command_function
3656+ if hasattr (func , HELP_CATEGORY ) and getattr (func , HELP_CATEGORY ) == category :
36583657 self .enable_command (cmd_name )
36593658
36603659 def disable_command (self , command : str , message_to_print : str ) -> None :
@@ -3696,10 +3695,7 @@ def disable_category(self, category: str, message_to_print: str) -> None:
36963695
36973696 for cmd_name in all_commands :
36983697 func = self .cmd_func (cmd_name )
3699- cmd_category = getattr (func , HELP_CATEGORY , None )
3700-
3701- # If this command is in the category, then disable it
3702- if cmd_category is not None and cmd_category == category :
3698+ if hasattr (func , HELP_CATEGORY ) and getattr (func , HELP_CATEGORY ) == category :
37033699 self .disable_command (cmd_name , message_to_print )
37043700
37053701 # noinspection PyUnusedLocal
0 commit comments