MCPcopy Index your code
hub / github.com/RustPython/RustPython / result

Method result

Lib/concurrent/futures/_base.py:428–461  ·  view source on GitHub ↗

Return the result of the call that the future represents. Args: timeout: The number of seconds to wait for the result if the future isn't done. If None, then there is no limit on the wait time. Returns: The result of the call that the future

(self, timeout=None)

Source from the content-addressed store, hash-verified

426 LOGGER.exception('exception calling callback for %r', self)
427
428 def result(self, timeout=None):
429 """Return the result of the call that the future represents.
430
431 Args:
432 timeout: The number of seconds to wait for the result if the future
433 isn't done. If None, then there is no limit on the wait time.
434
435 Returns:
436 The result of the call that the future represents.
437
438 Raises:
439 CancelledError: If the future was cancelled.
440 TimeoutError: If the future didn't finish executing before the given
441 timeout.
442 Exception: If the call raised then that exception will be raised.
443 """
444 try:
445 with self._condition:
446 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
447 raise CancelledError()
448 elif self._state == FINISHED:
449 return self.__get_result()
450
451 self._condition.wait(timeout)
452
453 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
454 raise CancelledError()
455 elif self._state == FINISHED:
456 return self.__get_result()
457 else:
458 raise TimeoutError()
459 finally:
460 # Break a reference cycle with the exception in self._exception
461 self = None
462
463 def exception(self, timeout=None):
464 """Return the exception raised by the call that the future represents.

Callers 1

_result_or_cancelFunction · 0.45

Calls 4

__get_resultMethod · 0.95
TimeoutErrorClass · 0.85
CancelledErrorClass · 0.70
waitMethod · 0.45

Tested by

no test coverage detected