SimpleToken
The base token is SimpleToken
. It has no built-in automation that can cancel it. The only way to cancel SimpleToken
is to explicitly call the cancel()
method from it.
from cantok import SimpleToken
token = SimpleToken()
print(token.cancelled) # False
token.cancel()
print(token.cancelled) # True
SimpleToken
is also implicitly generated by the operation of summing two other tokens:
from cantok import CounterToken, TimeoutToken
print(repr(CounterToken(5) + TimeoutToken(5)))
# SimpleToken(CounterToken(5, direct=True), TimeoutToken(5, monotonic=False))
There is not much more to tell about it if you have read the story about tokens in general.