nanover.utilities.cli module

class nanover.utilities.cli.CancellationToken

Bases: object

cancel()

Cancel this token.

property is_cancelled

Has this token been cancelled?

wait_cancellation(interval=0.1)

Sleep until this token is cancelled.

Parameters:

interval – the interval in seconds between waking up to check cancellation.

nanover.utilities.cli.suppress_keyboard_interrupt_as_cancellation()

Context manager that suppresses KeyboardInterrupt and instead yields a cancellation token that can be polled to check if a keyboard interrupt has occurred during the lifetime of the context.