Return the result this future represents. If the future has been cancelled, raises CancelledError. If the future's result isn't yet available, raises InvalidStateError. If the future is done and has an exception set, this exception is raised.
(self)
| 197 | return self._state != _PENDING |
| 198 | |
| 199 | def result(self): |
| 200 | """Return the result this future represents. |
| 201 | |
| 202 | If the future has been cancelled, raises CancelledError. If the |
| 203 | future's result isn't yet available, raises InvalidStateError. If |
| 204 | the future is done and has an exception set, this exception is raised. |
| 205 | """ |
| 206 | if self._state == _CANCELLED: |
| 207 | raise self._make_cancelled_error() |
| 208 | if self._state != _FINISHED: |
| 209 | raise exceptions.InvalidStateError('Result is not ready.') |
| 210 | self.__log_traceback = False |
| 211 | if self._exception is not None: |
| 212 | raise self._exception.with_traceback(self._exception_tb) |
| 213 | return self._result |
| 214 | |
| 215 | def exception(self): |
| 216 | """Return the exception that was set on this future. |