<s> from gevent . event import Event , AsyncResult , Timeout <EOL> from six . moves import xrange <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> class AsyncResultWrapper ( object ) : <EOL> def __init__ ( self ) : <EOL> self . async_result = None <EOL> def create ( self ) : <EOL> if self . async_result is not None : <EOL> assert False , '<STR_LIT>' <EOL> self . async_result = AsyncResult ( ) <EOL> def get ( self , * args , ** kwargs ) : <EOL> try : <EOL> result = self . async_result . get ( * args , ** kwargs ) <EOL> except Timeout : <EOL> result = None <EOL> self . async_result = None <EOL> return result <EOL> def set ( self , * args , ** kwargs ) : <EOL> if self . async_result is not None : <EOL> self . async_result . set ( * args , ** kwargs ) <EOL> class Events : <EOL> shutdown_required = Event ( ) <EOL> state_changed = Event ( ) <EOL> core_start_ready = Event ( ) <EOL> class AsyncResults : <EOL> remote_directory_listing = AsyncResultWrapper ( ) <EOL> class DaemonState : <EOL> ( <EOL> AUTHORIZATION_REQUIRED , <EOL> AUTHORIZATION_OK , <EOL> OFFLINE , <EOL> ROOT_FOLDER_MISSING , <EOL> ) = xrange ( <NUM_LIT:4> ) <EOL> current = None </s>
