Describes execution of a `.Task`, typically with pre-supplied arguments. Useful for setting up :ref:`pre/post task invocations `. It's actually just a convenient wrapper around the `.Call` class, which may be used directly instead if desired. For
(task: "Task", *args: Any, **kwargs: Any)
| 490 | |
| 491 | |
| 492 | def call(task: "Task", *args: Any, **kwargs: Any) -> "Call": |
| 493 | """ |
| 494 | Describes execution of a `.Task`, typically with pre-supplied arguments. |
| 495 | |
| 496 | Useful for setting up :ref:`pre/post task invocations |
| 497 | <parameterizing-pre-post-tasks>`. It's actually just a convenient wrapper |
| 498 | around the `.Call` class, which may be used directly instead if desired. |
| 499 | |
| 500 | For example, here's two build-like tasks that both refer to a ``setup`` |
| 501 | pre-task, one with no baked-in argument values (and thus no need to use |
| 502 | `.call`), and one that toggles a boolean flag:: |
| 503 | |
| 504 | @task |
| 505 | def setup(c, clean=False): |
| 506 | if clean: |
| 507 | c.run("rm -rf target") |
| 508 | # ... setup things here ... |
| 509 | c.run("tar czvf target.tgz target") |
| 510 | |
| 511 | @task(pre=[setup]) |
| 512 | def build(c): |
| 513 | c.run("build, accounting for leftover files...") |
| 514 | |
| 515 | @task(pre=[call(setup, clean=True)]) |
| 516 | def clean_build(c): |
| 517 | c.run("build, assuming clean slate...") |
| 518 | |
| 519 | Please see the constructor docs for `.Call` for details - this function's |
| 520 | ``args`` and ``kwargs`` map directly to the same arguments as in that |
| 521 | method. |
| 522 | |
| 523 | .. versionadded:: 1.0 |
| 524 | """ |
| 525 | return Call(task, args=args, kwargs=kwargs) |
no test coverage detected
searching dependent graphs…