def collect(self, intermediate=False, **kwargs):
    'Iterator, like :meth:`get` will wait for the task to complete,\n        but will also follow :class:`AsyncResult` and :class:`ResultSet`\n        returned by the task, yielding ``(result, value)`` tuples for each\n        result in the tree.\n\n        An example would be having the following tasks:\n\n        .. code-block:: python\n\n            from celery import group\n            from proj.celery import app\n\n            @app.task(trail=True)\n            def A(how_many):\n                return group(B.s(i) for i in range(how_many))()\n\n            @app.task(trail=True)\n            def B(i):\n                return pow2.delay(i)\n\n            @app.task(trail=True)\n            def pow2(i):\n                return i ** 2\n\n        Note that the ``trail`` option must be enabled\n        so that the list of children is stored in ``result.children``.\n        This is the default but enabled explicitly for illustration.\n\n        Calling :meth:`collect` would return:\n\n        .. code-block:: python\n\n            >>> from celery.result import ResultBase\n            >>> from proj.tasks import A\n\n            >>> result = A.delay(10)\n            >>> [v for v in result.collect()\n            ...  if not isinstance(v, (ResultBase, tuple))]\n            [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]\n\n        '
    for (_, R) in self.iterdeps(intermediate=intermediate):
        (yield (R, R.get(**kwargs)))
Iterator, like :meth:`get` will wait for the task to complete,
but will also follow :class:`AsyncResult` and :class:`ResultSet`
returned by the task, yielding ``(result, value)`` tuples for each
result in the tree.

An example would be having the following tasks:

.. code-block:: python

    from celery import group
    from proj.celery import app

    @app.task(trail=True)
    def A(how_many):
        return group(B.s(i) for i in range(how_many))()

    @app.task(trail=True)
    def B(i):
        return pow2.delay(i)

    @app.task(trail=True)
    def pow2(i):
        return i ** 2

Note that the ``trail`` option must be enabled
so that the list of children is stored in ``result.children``.
This is the default but enabled explicitly for illustration.

Calling :meth:`collect` would return:

.. code-block:: python

    >>> from celery.result import ResultBase
    >>> from proj.tasks import A

    >>> result = A.delay(10)
    >>> [v for v in result.collect()
    ...  if not isinstance(v, (ResultBase, tuple))]
    [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
def collect(self, intermediate=False, **kwargs):
    'Iterator, like :meth:`get` will wait for the task to complete,\n        but will also follow :class:`AsyncResult` and :class:`ResultSet`\n        returned by the task, yielding ``(result, value)`` tuples for each\n        result in the tree.\n\n        An example would be having the following tasks:\n\n        .. code-block:: python\n\n            from celery import group\n            from proj.celery import app\n\n            @app.task(trail=True)\n            def A(how_many):\n                return group(B.s(i) for i in range(how_many))()\n\n            @app.task(trail=True)\n            def B(i):\n                return pow2.delay(i)\n\n            @app.task(trail=True)\n            def pow2(i):\n                return i ** 2\n\n        Note that the ``trail`` option must be enabled\n        so that the list of children is stored in ``result.children``.\n        This is the default but enabled explicitly for illustration.\n\n        Calling :meth:`collect` would return:\n\n        .. code-block:: python\n\n            >>> from celery.result import ResultBase\n            >>> from proj.tasks import A\n\n            >>> result = A.delay(10)\n            >>> [v for v in result.collect()\n            ...  if not isinstance(v, (ResultBase, tuple))]\n            [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]\n\n        '
    for (_, R) in self.iterdeps(intermediate=intermediate):
        (yield (R, R.get(**kwargs)))