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

Method clone

invoke/tasks.py:458–489  ·  view source on GitHub ↗

Return a standalone copy of this Call. Useful when parameterizing task executions. :param into: A subclass to generate instead of the current class. Optional. :param dict with_: A dict of additional keyword arguments to use when creating th

(
        self,
        into: Optional[Type["Call"]] = None,
        with_: Optional[Dict[str, Any]] = None,
    )

Source from the content-addressed store, hash-verified

456 )
457
458 def clone(
459 self,
460 into: Optional[Type["Call"]] = None,
461 with_: Optional[Dict[str, Any]] = None,
462 ) -> "Call":
463 """
464 Return a standalone copy of this Call.
465
466 Useful when parameterizing task executions.
467
468 :param into:
469 A subclass to generate instead of the current class. Optional.
470
471 :param dict with_:
472 A dict of additional keyword arguments to use when creating the new
473 clone; typically used when cloning ``into`` a subclass that has
474 extra args on top of the base class. Optional.
475
476 .. note::
477 This dict is used to ``.update()`` the original object's data
478 (the return value from its `clone_data`), so in the event of
479 a conflict, values in ``with_`` will win out.
480
481 .. versionadded:: 1.0
482 .. versionchanged:: 1.1
483 Added the ``with_`` kwarg.
484 """
485 klass = into if into is not None else self.__class__
486 data = self.clone_data()
487 if with_ is not None:
488 data.update(with_)
489 return klass(**data)
490
491
492def call(task: "Task", *args: Any, **kwargs: Any) -> "Call":

Calls 2

clone_dataMethod · 0.95
updateMethod · 0.45

Tested by

no test coverage detected