(self, fn, *, context=None)
Add a callback to be run when the future becomes done.

        The callback is called with a single argument - the future object. If
        the future is already done when this is called, the callback is
        scheduled with call_soon.
Add a callback to be run when the future becomes done.
Add a callback to be run when the future becomes done .
def add_done_callback(self, fn, *, context=None):
        """Add a callback to be run when the future becomes done.

        The callback is called with a single argument - the future object. If
        the future is already done when this is called, the callback is
        scheduled with call_soon.
        """
        if self._state != _PENDING:
            self._loop.call_soon(fn, self, context=context)
        else:
            if context is None:
                context = contextvars.copy_context()
            self._callbacks.append((fn, context))
def add_done_callback ( self , fn , * , context = None ) : if self . _state != _PENDING : self . _loop . call_soon ( fn , self , context = context ) else : if context is None : context = contextvars . copy_context ( ) self . _callbacks . append ( ( fn , context ) )