@@ -83,26 +83,26 @@ def html_doc_items(self) -> List[Tuple[str, str]]:
83
83
class Task (Node ):
84
84
def __init__ (self , id : str , description : str , commands : Optional [Union [Callable , List [Command ]]] = None , max_retries : Optional [int ] = None ) -> None :
85
85
super ().__init__ (id , description )
86
- self .callable_commands = callable (commands )
86
+ self .is_dynamic_commands = callable (commands )
87
87
self .max_retries = max_retries
88
88
89
- if self .callable_commands :
89
+ if self .is_dynamic_commands :
90
90
self ._commands = None
91
- self .__commands_callable = commands
91
+ self .__dynamic_commands_generator_func = commands
92
92
else :
93
93
self ._commands = []
94
94
self ._add_commands (commands or [])
95
95
96
- def _test_is_not_dynamic (self ):
97
- if self .callable_commands :
96
+ def _assert_is_not_dynamic (self ):
97
+ if self .is_dynamic_commands :
98
98
raise Exception ('You cannot use add_command when the task is constructed with a callable commands function.' )
99
99
100
100
@property
101
101
def commands (self ) -> List :
102
- if not self ._commands :
102
+ if self ._commands is None :
103
103
self ._commands = []
104
104
# execute the callable command function and cache the result
105
- for command in self .__commands_callable () or []:
105
+ for command in self .__dynamic_commands_generator_func () or []:
106
106
self ._add_command (command )
107
107
return self ._commands
108
108
@@ -118,11 +118,11 @@ def _add_commands(self, commands: List[Command]):
118
118
self ._add_command (command )
119
119
120
120
def add_command (self , command : Command , prepend = False ):
121
- self ._test_is_not_dynamic ()
121
+ self ._assert_is_not_dynamic ()
122
122
self ._add_command (command , prepend = prepend )
123
123
124
124
def add_commands (self , commands : List [Command ]):
125
- self ._test_is_not_dynamic ()
125
+ self ._assert_is_not_dynamic ()
126
126
self ._add_commands (commands )
127
127
128
128
def run (self ):
0 commit comments