Create a copy of this signature. Arguments: args (Tuple): Partial args to be prepended to the existing args. kwargs (Dict): Partial kwargs to be merged with existing kwargs. options (Dict): Partial options to be merged with existing option
(self, args=None, kwargs=None, **opts)
| 442 | new_options) |
| 443 | |
| 444 | def clone(self, args=None, kwargs=None, **opts): |
| 445 | """Create a copy of this signature. |
| 446 | |
| 447 | Arguments: |
| 448 | args (Tuple): Partial args to be prepended to the existing args. |
| 449 | kwargs (Dict): Partial kwargs to be merged with existing kwargs. |
| 450 | options (Dict): Partial options to be merged with |
| 451 | existing options. |
| 452 | """ |
| 453 | args = args if args else () |
| 454 | kwargs = kwargs if kwargs else {} |
| 455 | # need to deepcopy options so origins links etc. is not modified. |
| 456 | if args or kwargs or opts: |
| 457 | args, kwargs, opts = self._merge(args, kwargs, opts) |
| 458 | else: |
| 459 | args, kwargs, opts = self.args, self.kwargs, self.options |
| 460 | signature = Signature.from_dict({'task': self.task, |
| 461 | 'args': tuple(args), |
| 462 | 'kwargs': kwargs, |
| 463 | 'options': deepcopy(opts), |
| 464 | 'subtask_type': self.subtask_type, |
| 465 | 'immutable': self.immutable}, |
| 466 | app=self._app) |
| 467 | signature._type = self._type |
| 468 | return signature |
| 469 | |
| 470 | partial = clone |
| 471 |