@@ -3645,9 +3645,8 @@ def enable_category(self, category: str) -> None:
36453645 :param category: the category to enable
36463646 """
36473647 for cmd_name in list (self .disabled_commands ):
3648- dc = self .disabled_commands [cmd_name ]
3649- cmd_category = getattr (dc .command_function , HELP_CATEGORY , None )
3650- if cmd_category is not None and cmd_category == category :
3648+ func = self .disabled_commands [cmd_name ].command_function
3649+ if hasattr (func , HELP_CATEGORY ) and getattr (func , HELP_CATEGORY ) == category :
36513650 self .enable_command (cmd_name )
36523651
36533652 def disable_command (self , command : str , message_to_print : str ) -> None :
@@ -3689,10 +3688,7 @@ def disable_category(self, category: str, message_to_print: str) -> None:
36893688
36903689 for cmd_name in all_commands :
36913690 func = self .cmd_func (cmd_name )
3692- cmd_category = getattr (func , HELP_CATEGORY , None )
3693-
3694- # If this command is in the category, then disable it
3695- if cmd_category is not None and cmd_category == category :
3691+ if hasattr (func , HELP_CATEGORY ) and getattr (func , HELP_CATEGORY ) == category :
36963692 self .disable_command (cmd_name , message_to_print )
36973693
36983694 # noinspection PyUnusedLocal
0 commit comments