MCPcopy Index your code
hub / github.com/pyinvoke/invoke / call

Function call

invoke/tasks.py:492–525  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

490
491
492def 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&#x27;s actually just a convenient wrapper
498 around the `.Call` class, which may be used directly instead if desired.
499
500 For example, here&#x27;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&#x27;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)

Calls 1

CallClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…