1010 Mapping ,
1111 Optional ,
1212 Type ,
13+ TypeVar ,
1314)
1415
1516from .constants import (
3031#: Further refinements are needed to define the input parameters
3132CommandFunc = Callable [..., Optional [bool ]]
3233
34+ CommandSetType = TypeVar ('CommandSetType' , bound = Type ['CommandSet' ])
3335
34- def with_default_category (category : str , * , heritable : bool = True ) -> Callable [[Type ['CommandSet' ]], Type ['CommandSet' ]]:
36+
37+ def with_default_category (category : str , * , heritable : bool = True ) -> Callable [[CommandSetType ], CommandSetType ]:
3538 """
3639 Decorator that applies a category to all ``do_*`` command methods in a class that do not already
3740 have a category specified.
@@ -42,15 +45,15 @@ def with_default_category(category: str, *, heritable: bool = True) -> Callable[
4245 override the default category.
4346
4447 If `heritable` is set to False, then only the commands declared locally to this CommandSet will be placed in the
45- specified category. Dynamically created commands, and commands declared in sub-classes will not receive this
48+ specified category. Dynamically created commands and commands declared in sub-classes will not receive this
4649 category.
4750
4851 :param category: category to put all uncategorized commands in
4952 :param heritable: Flag whether this default category should apply to sub-classes. Defaults to True
5053 :return: decorator function
5154 """
5255
53- def decorate_class (cls : Type [ CommandSet ] ) -> Type [ CommandSet ] :
56+ def decorate_class (cls : CommandSetType ) -> CommandSetType :
5457 if heritable :
5558 setattr (cls , CLASS_ATTR_DEFAULT_HELP_CATEGORY , category )
5659
0 commit comments