<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> from __future__ import print_function <EOL> from __future__ import division <EOL> from urwid . main_loop import ExitMainLoop <EOL> from pycopia import asyncio <EOL> from pycopia import scheduler <EOL> class PycopiaEventLoop ( object ) : <EOL> def __init__ ( self ) : <EOL> self . _idle_handle = <NUM_LIT:0> <EOL> self . _idle_callbacks = { } <EOL> def alarm ( self , seconds , callback ) : <EOL> """<STR_LIT>""" <EOL> return scheduler . get_scheduler ( ) . add ( seconds , callback = callback ) <EOL> def remove_alarm ( self , handle ) : <EOL> """<STR_LIT>""" <EOL> return scheduler . get_scheduler ( ) . remove ( handle ) <EOL> def watch_file ( self , fd , callback ) : <EOL> """<STR_LIT>""" <EOL> asyncio . poller . register_fd ( fd , asyncio . EPOLLIN , callback ) <EOL> return fd <EOL> def remove_watch_file ( self , handle ) : <EOL> """<STR_LIT>""" <EOL> return asyncio . poller . unregister_fd ( handle ) <EOL> def enter_idle ( self , callback ) : <EOL> """<STR_LIT>""" <EOL> return asyncio . poller . register_idle ( callback ) <EOL> def remove_enter_idle ( self , handle ) : <EOL> """<STR_LIT>""" <EOL> return asyncio . poller . unregister_idle ( handle ) <EOL> def run ( self ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> asyncio . poller . loop ( ) <EOL> except ExitMainLoop : <EOL> pass </s>
