r"""Recursively set the state of the task and its subtasks. Args: state (TaskState): The giving state.
(self, state: TaskState)
| 138 | self.id = id |
| 139 | |
| 140 | def set_state(self, state: TaskState): |
| 141 | r"""Recursively set the state of the task and its subtasks. |
| 142 | |
| 143 | Args: |
| 144 | state (TaskState): The giving state. |
| 145 | """ |
| 146 | self.state = state |
| 147 | if state == TaskState.DONE: |
| 148 | for subtask in self.subtasks: |
| 149 | if subtask.state != TaskState.DELETED: |
| 150 | subtask.set_state(state) |
| 151 | elif state == TaskState.RUNNING and self.parent: |
| 152 | self.parent.set_state(state) |
| 153 | |
| 154 | def add_subtask(self, task: "Task"): |
| 155 | r"""Add a subtask to the current task. |
no outgoing calls
no test coverage detected