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

Method cancel

Lib/asyncio/futures.py:152–165  ·  view source on GitHub ↗

Cancel the future and schedule callbacks. If the future is already done or cancelled, return False. Otherwise, change the future's state to cancelled, schedule the callbacks and return True.

(self, msg=None)

Source from the content-addressed store, hash-verified

150 return exc
151
152 def cancel(self, msg=None):
153 """Cancel the future and schedule callbacks.
154
155 If the future is already done or cancelled, return False. Otherwise,
156 change the future's state to cancelled, schedule the callbacks and
157 return True.
158 """
159 self.__log_traceback = False
160 if self._state != _PENDING:
161 return False
162 self._state = _CANCELLED
163 self._cancel_message = msg
164 self.__schedule_callbacks()
165 return True
166
167 def __schedule_callbacks(self):
168 """Internal: Ask the event loop to call all callbacks.

Calls 1

__schedule_callbacksMethod · 0.95