How to use the yaspin.kbi_safe_yaspin function in yaspin

To help you get started, we’ve selected a few yaspin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pavdmyt / yaspin / tests / test_signals.py View on Github external
def test_kbi_safe_yaspin():
    sp = kbi_safe_yaspin()

    try:
        sp.start()

        handler = signal.getsignal(signal.SIGINT)
        # Handler function is wrapped into ``partial`` and
        # is accesible via ``func`` attribute.
        assert handler.func == sp._sigmap[signal.SIGINT]
    finally:
        sp.stop()
github pavdmyt / yaspin / examples / signals.py View on Github external
def simple_keyboard_interrupt_handling():
    with kbi_safe_yaspin(text=DEFAULT_TEXT):
        time.sleep(5)