| 320 | return Signature(d, app=app) |
| 321 | |
| 322 | def __init__(self, task=None, args=None, kwargs=None, options=None, |
| 323 | type=None, subtask_type=None, immutable=False, |
| 324 | app=None, **ex): |
| 325 | self._app = app |
| 326 | |
| 327 | if isinstance(task, dict): |
| 328 | super().__init__(task) # works like dict(d) |
| 329 | else: |
| 330 | # Also supports using task class/instance instead of string name. |
| 331 | try: |
| 332 | task_name = task.name |
| 333 | except AttributeError: |
| 334 | task_name = task |
| 335 | else: |
| 336 | self._type = task |
| 337 | |
| 338 | super().__init__( |
| 339 | task=task_name, args=tuple(args or ()), |
| 340 | kwargs=kwargs or {}, |
| 341 | options=dict(options or {}, **ex), |
| 342 | subtask_type=subtask_type, |
| 343 | immutable=immutable, |
| 344 | ) |
| 345 | |
| 346 | def __call__(self, *partial_args, **partial_kwargs): |
| 347 | """Call the task directly (in the current process).""" |