MCPcopy
hub / github.com/celery/celery / __new__

Method __new__

celery/canvas.py:1357–1368  ·  view source on GitHub ↗
(cls, *tasks, **kwargs)

Source from the content-addressed store, hash-verified

1355
1356 # could be function, but must be able to reference as :class:`chain`.
1357 def __new__(cls, *tasks, **kwargs):
1358 # This forces `chain(X, Y, Z)` to work the same way as `X | Y | Z`
1359 if not kwargs and tasks:
1360 if len(tasks) != 1 or is_list(tasks[0]):
1361 tasks = tasks[0] if len(tasks) == 1 else tasks
1362 # if is_list(tasks) and len(tasks) == 1:
1363 # return super(chain, cls).__new__(cls, tasks, **kwargs)
1364 new_instance = reduce(operator.or_, tasks, _chain())
1365 if cls != chain and isinstance(new_instance, _chain) and not isinstance(new_instance, cls):
1366 return super().__new__(cls, new_instance.tasks, **kwargs)
1367 return new_instance
1368 return super().__new__(cls, *tasks, **kwargs)
1369
1370
1371class _basemap(Signature):

Callers 1

__new__Function · 0.45

Calls 1

_chainClass · 0.85

Tested by

no test coverage detected