%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/utils/ |
Current File : //lib/python2.7/site-packages/salt/utils/asynchronous.pyo |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l m Z e j d � � Z d e f d � � YZ d S( u; Helpers/utils for working with tornado asynchronous stuff i ( t absolute_importt print_functiont unicode_literalsN( t zeromqc c@ s7 t j j j � } | j � z d VWd | j � Xd S( uW A context manager that will set the current ioloop to io_loop for the context N( t tornadot ioloopt IOLoopt currentt make_current( t io_loopt orig_loop( ( s; /usr/lib/python2.7/site-packages/salt/utils/asynchronous.pyt current_ioloop s t SyncWrapperc B@ s; e Z d Z e � d d � Z d � Z d � Z d � Z RS( u� A wrapper to make Async classes synchronous This is uses as a simple wrapper, for example: asynchronous = AsyncClass() # this method would reguarly return a future future = asynchronous.async_method() sync = SyncWrapper(async_factory_method, (arg1, arg2), {'kwarg1': 'val'}) # the sync wrapper will automatically wait on the future ret = sync.async_method() c C@ s] | d k r i } n t j � | _ | j | d <t | j � � | | | � | _ Wd QXd S( Nu io_loop( t NoneR t ZMQDefaultLoopR R t asynchronous( t selft methodt argst kwargs( ( s; /usr/lib/python2.7/site-packages/salt/utils/asynchronous.pyt __init__) s c @ s~ y t j � | � SWn( t k r>