(self, result)
Sets the return value of work associated with the future.

        Should only be used by Executor implementations and unit tests.
Sets the return value of work associated with the future.
Sets the return value of work associated with the future .
def set_result(self, result):
        """Sets the return value of work associated with the future.

        Should only be used by Executor implementations and unit tests.
        """
        with self._condition:
            if self._state in {CANCELLED, CANCELLED_AND_NOTIFIED, FINISHED}:
                raise InvalidStateError('{}: {!r}'.format(self._state, self))
            self._result = result
            self._state = FINISHED
            for waiter in self._waiters:
                waiter.add_result(self)
            self._condition.notify_all()
        self._invoke_callbacks()
def set_result ( self , result ) : with self . _condition : if self . _state in { CANCELLED , CANCELLED_AND_NOTIFIED , FINISHED } : raise InvalidStateError ( '{}: {!r}' . format ( self . _state , self ) ) self . _result = result self . _state = FINISHED for waiter in self . _waiters : waiter . add_result ( self ) self . _condition . notify_all ( ) self . _invoke_callbacks ( )