Expand a list of `.Call` objects into a near-final list of same. The default implementation of this method simply adds a task's pre/post-task list before/after the task itself, as necessary. Subclasses may wish to do other things in addition (or instead of) the
(self, calls: List["Call"])
| 199 | return deduped |
| 200 | |
| 201 | def expand_calls(self, calls: List["Call"]) -> List["Call"]: |
| 202 | """ |
| 203 | Expand a list of `.Call` objects into a near-final list of same. |
| 204 | |
| 205 | The default implementation of this method simply adds a task's |
| 206 | pre/post-task list before/after the task itself, as necessary. |
| 207 | |
| 208 | Subclasses may wish to do other things in addition (or instead of) the |
| 209 | above, such as multiplying the `calls <.Call>` by argument vectors or |
| 210 | similar. |
| 211 | |
| 212 | .. versionadded:: 1.0 |
| 213 | """ |
| 214 | ret = [] |
| 215 | for call in calls: |
| 216 | # Normalize to Call (this method is sometimes called with pre/post |
| 217 | # task lists, which may contain 'raw' Task objects) |
| 218 | if isinstance(call, Task): |
| 219 | call = Call(call) |
| 220 | debug("Expanding task-call {!r}".format(call)) |
| 221 | # TODO: this is where we _used_ to call Executor.config_for(call, |
| 222 | # config)... |
| 223 | # TODO: now we may need to preserve more info like where the call |
| 224 | # came from, etc, but I feel like that shit should go _on the call |
| 225 | # itself_ right??? |
| 226 | # TODO: we _probably_ don't even want the config in here anymore, |
| 227 | # we want this to _just_ be about the recursion across pre/post |
| 228 | # tasks or parameterization...? |
| 229 | ret.extend(self.expand_calls(call.pre)) |
| 230 | ret.append(call) |
| 231 | ret.extend(self.expand_calls(call.post)) |
| 232 | return ret |