<s> """<STR_LIT>""" <EOL> from . . ext . ipy_inputhook import inputhook_manager , InputHookBase , stdin_ready <EOL> def set_interactive ( enabled = True , app = None ) : <EOL> """<STR_LIT>""" <EOL> if enabled : <EOL> inputhook_manager . enable_gui ( '<STR_LIT>' , app ) <EOL> else : <EOL> inputhook_manager . disable_gui ( ) <EOL> @ inputhook_manager . register ( '<STR_LIT>' ) <EOL> class VisPyInputHook ( InputHookBase ) : <EOL> """<STR_LIT>""" <EOL> def enable ( self , app = None ) : <EOL> """<STR_LIT>""" <EOL> from . . import app as _app <EOL> self . app = app or _app . use_app ( ) <EOL> self . manager . set_inputhook ( self . _vispy_inputhook ) <EOL> return app <EOL> def _vispy_inputhook ( self ) : <EOL> try : <EOL> while not stdin_ready ( ) : <EOL> self . app . process_events ( ) <EOL> self . app . sleep ( duration_sec = <NUM_LIT> ) <EOL> except KeyboardInterrupt : <EOL> pass <EOL> return <NUM_LIT:0> </s>
