@@ -3652,9 +3652,8 @@ def enable_category(self, category: str) -> None:
3652
3652
:param category: the category to enable
3653
3653
"""
3654
3654
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 :
3658
3657
self .enable_command (cmd_name )
3659
3658
3660
3659
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:
3696
3695
3697
3696
for cmd_name in all_commands :
3698
3697
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 :
3703
3699
self .disable_command (cmd_name , message_to_print )
3704
3700
3705
3701
# noinspection PyUnusedLocal
0 commit comments