Decorator which causes KeyboardInterrupt exceptions to be ignored during execution of the decorated function. This is used by the inputhook functions to handle the event where the user presses CTRL+C while IPython is idle, and the inputhook loop is running. In this case, we want to
(func)
| 9 | |
| 10 | |
| 11 | def ignore_keyboardinterrupts(func): |
| 12 | """Decorator which causes KeyboardInterrupt exceptions to be ignored during |
| 13 | execution of the decorated function. |
| 14 | |
| 15 | This is used by the inputhook functions to handle the event where the user |
| 16 | presses CTRL+C while IPython is idle, and the inputhook loop is running. In |
| 17 | this case, we want to ignore interrupts. |
| 18 | """ |
| 19 | def wrapper(*args, **kwargs): |
| 20 | try: |
| 21 | func(*args, **kwargs) |
| 22 | except KeyboardInterrupt: |
| 23 | pass |
| 24 | return wrapper |
| 25 | |
| 26 | |
| 27 | @ignore_keyboardinterrupts |
nothing calls this directly
no outgoing calls
no test coverage detected