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

Method cancel

Lib/concurrent/futures/_base.py:364–381  ·  view source on GitHub ↗

Cancel the future if possible. Returns True if the future was cancelled, False otherwise. A future cannot be cancelled if it is running or has already completed.

(self)

Source from the content-addressed store, hash-verified

362 _STATE_TO_DESCRIPTION_MAP[self._state])
363
364 def cancel(self):
365 """Cancel the future if possible.
366
367 Returns True if the future was cancelled, False otherwise. A future
368 cannot be cancelled if it is running or has already completed.
369 """
370 with self._condition:
371 if self._state in [RUNNING, FINISHED]:
372 return False
373
374 if self._state in [CANCELLED, CANCELLED_AND_NOTIFIED]:
375 return True
376
377 self._state = CANCELLED
378 self._condition.notify_all()
379
380 self._invoke_callbacks()
381 return True
382
383 def cancelled(self):
384 """Return True if the future was cancelled."""

Callers 4

_result_or_cancelFunction · 0.45
result_iteratorMethod · 0.45
shutdownMethod · 0.45

Calls 2

_invoke_callbacksMethod · 0.95
notify_allMethod · 0.45

Tested by

no test coverage detected