CancellationToken
yosoi.cancellation.CancellationToken
class CancellationToken:
Share a caller-controlled cancellation signal with SDK operations.
Operations observe the signal cooperatively. Cancelling does not roll back completed work or guarantee that external effects are undone. Keep the token and pass it to operations that should share the same cancellation boundary.
Source: python/yosoi/cancellation.py:8
Members below are declared on this class. Inherited Pydantic methods and generated constructor signatures are not expanded.
Methods
Section titled “Methods”def __init__(self) -> None:
Create an independent token whose cancellation signal is unset.
Source: python/yosoi/cancellation.py:16
cancelled
Section titled “cancelled”@property
def cancelled(self) -> bool:
Return whether cancellation has been requested for this token.
Source: python/yosoi/cancellation.py:21
cancel
Section titled “cancel”def cancel(self) -> None:
Request cancellation for operations sharing this token.
Calling this method repeatedly is harmless. It returns immediately; operations finish observing cancellation asynchronously.