Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def call_soon(self, callback, *args):
if not isinstance(callback, Thenable):
callback = promise(callback, args)
self._ready.add(callback)
return callback
@property
def children(self):
return self.results
@classmethod
def restore(cls, id, backend=None, app=None):
"""Restore previously saved group result."""
app = app or (
cls.app if not isinstance(cls.app, property) else current_app
)
backend = backend or app.backend
return backend.restore_group(id)
@Thenable.register
@python_2_unicode_compatible
class EagerResult(AsyncResult):
"""Result that we know has already been executed."""
def __init__(self, id, ret_value, state, traceback=None):
# pylint: disable=super-init-not-called
# XXX should really not be inheriting from AsyncResult
self.id = id
self._result = ret_value
self._state = state
self._traceback = traceback
self.on_ready = promise()
self.on_ready(self)
def then(self, callback, on_error=None, weak=False):
return self.on_ready.then(callback, on_error)