@@ -3645,9 +3645,8 @@ def enable_category(self, category: str) -> None:
3645
3645
:param category: the category to enable
3646
3646
"""
3647
3647
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 :
3651
3650
self .enable_command (cmd_name )
3652
3651
3653
3652
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:
3689
3688
3690
3689
for cmd_name in all_commands :
3691
3690
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 :
3696
3692
self .disable_command (cmd_name , message_to_print )
3697
3693
3698
3694
# noinspection PyUnusedLocal
0 commit comments