%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib64/python2.7/site-packages/tornado/
Upload File :
Create Path :
Current File : //lib64/python2.7/site-packages/tornado/gen.pyc

�
��L]c@�sOdZddlmZmZmZmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZmZmZddlmZddlmZddlmZddlmZydd	lmZWnAek
r)Zydd	lmZWq*ek
r%dZq*XnXd
efd��YZdefd
��YZdefd��YZ defd��YZ!defd��YZ"defd��YZ#d�Z$e%d�Z&d�Z'd�Z(defd��YZ)de*fd��YZ+de*fd��YZ,d e,fd!��YZ-d"e,fd#��YZ.d$e,fd%��YZ/d&�Z0d'e,fd(��YZ1d)e,fd*��YZ2d7d+�Z3d,�Z4dd8d-�Z5d.�Z6e
�Z7e7j8d�e
�Z9d/e9_e9j8d�d0e*fd1��YZ:ej;d2d3d4g�Z<d5�Z=d6�Z>edk	rKee>�Z>ndS(9s�	``tornado.gen`` is a generator-based interface to make it easier to
work in an asynchronous environment.  Code using the ``gen`` module
is technically asynchronous, but it is written as a single generator
instead of a collection of separate functions.

For example, the following asynchronous handler:

.. testcode::

    class AsyncHandler(RequestHandler):
        @asynchronous
        def get(self):
            http_client = AsyncHTTPClient()
            http_client.fetch("http://example.com",
                              callback=self.on_fetch)

        def on_fetch(self, response):
            do_something_with_response(response)
            self.render("template.html")

.. testoutput::
   :hide:

could be written with ``gen`` as:

.. testcode::

    class GenAsyncHandler(RequestHandler):
        @gen.coroutine
        def get(self):
            http_client = AsyncHTTPClient()
            response = yield http_client.fetch("http://example.com")
            do_something_with_response(response)
            self.render("template.html")

.. testoutput::
   :hide:

Most asynchronous functions in Tornado return a `.Future`;
yielding this object returns its `~.Future.result`.

You can also yield a list or dict of ``Futures``, which will be
started at the same time and run in parallel; a list or dict of results will
be returned when they are all finished:

.. testcode::

    @gen.coroutine
    def get(self):
        http_client = AsyncHTTPClient()
        response1, response2 = yield [http_client.fetch(url1),
                                      http_client.fetch(url2)]
        response_dict = yield dict(response3=http_client.fetch(url3),
                                   response4=http_client.fetch(url4))
        response3 = response_dict['response3']
        response4 = response_dict['response4']

.. testoutput::
   :hide:

If the `~functools.singledispatch` library is available (standard in
Python 3.4, available via the `singledispatch
<https://pypi.python.org/pypi/singledispatch>`_ package on older
versions), additional types of objects may be yielded. Tornado includes
support for ``asyncio.Future`` and Twisted's ``Deferred`` class when
``tornado.platform.asyncio`` and ``tornado.platform.twisted`` are imported.
See the `convert_yielded` function to extend this mechanism.

.. versionchanged:: 3.2
   Dict support added.

.. versionchanged:: 4.1
   Support added for yielding ``asyncio`` Futures and Twisted Deferreds
   via ``singledispatch``.

i(tabsolute_importtdivisiontprint_functiontwith_statementN(tFuturetTracebackFuturet	is_futuretchain_future(tIOLoop(tapp_log(t
stack_context(traise_exc_info(tsingledispatcht
KeyReuseErrorcB�seZRS((t__name__t
__module__(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR
estUnknownKeyErrorcB�seZRS((RR(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRistLeakedCallbackErrorcB�seZRS((RR(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRmst
BadYieldErrorcB�seZRS((RR(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRqstReturnValueIgnoredErrorcB�seZRS((RR(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRustTimeoutErrorcB�seZdZRS(s%Exception raised by ``with_timeout``.(RRt__doc__(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRysc�s4t�dt��tj���fd��}|S(s�Callback-oriented decorator for asynchronous generators.

    This is an older interface; for new code that does not need to be
    compatible with versions of Tornado older than 3.0 the
    `coroutine` decorator is recommended instead.

    This decorator is similar to `coroutine`, except it does not
    return a `.Future` and the ``callback`` argument is not treated
    specially.

    In most cases, functions decorated with `engine` should take
    a ``callback`` argument and invoke it with their result when
    they are finished.  One notable exception is the
    `~tornado.web.RequestHandler` :ref:`HTTP verb methods <verbs>`,
    which use ``self.finish()`` in place of a callback argument.
    treplace_callbackc�s2�||�}d�}|jtj|��dS(NcS�s2|j�dk	r.td|j�f��ndS(Ns.@gen.engine functions cannot return values: %r(tresulttNoneR(tfuture((s1/usr/lib64/python2.7/site-packages/tornado/gen.pytfinal_callback�s(tadd_done_callbackR
twrap(targstkwargsRR(tfunc(s1/usr/lib64/python2.7/site-packages/tornado/gen.pytwrapper�s	(t_make_coroutine_wrappertFalset	functoolstwraps(RR ((Rs1/usr/lib64/python2.7/site-packages/tornado/gen.pytengine}s
cC�st|dt�S(s>Decorator for asynchronous generators.

    Any generator that yields objects from this module must be wrapped
    in either this decorator or `engine`.

    Coroutines may "return" by raising the special exception
    `Return(value) <Return>`.  In Python 3.3+, it is also possible for
    the function to simply use the ``return value`` statement (prior to
    Python 3.3 generators were not allowed to also return values).
    In all versions of Python a coroutine that simply wishes to exit
    early may use the ``return`` statement without a value.

    Functions with this decorator return a `.Future`.  Additionally,
    they may be called with a ``callback`` keyword argument, which
    will be invoked with the future's result when it resolves.  If the
    coroutine fails, the callback will not be run and an exception
    will be raised into the surrounding `.StackContext`.  The
    ``callback`` argument is not visible inside the decorated
    function; it is handled by the decorator itself.

    From the caller's perspective, ``@gen.coroutine`` is similar to
    the combination of ``@return_future`` and ``@gen.engine``.

    .. warning::

       When exceptions occur inside a coroutine, the exception
       information will be stored in the `.Future` object. You must
       examine the result of the `.Future` object, or the exception
       may go unnoticed by your code. This means yielding the function
       if called from another coroutine, using something like
       `.IOLoop.run_sync` for top-level calls, or passing the `.Future`
       to `.IOLoop.add_future`.

    R(R!tTrue(RR((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyt	coroutine�s#c�s=�}tj|���fd��}||_t|_|S(s�The inner workings of ``@gen.coroutine`` and ``@gen.engine``.

    The two decorators differ in their treatment of the ``callback``
    argument, so we cannot simply implement ``@engine`` in terms of
    ``@coroutine``.
    c�s�t�}�rLd|krL|jd��tj�j|�fd��ny�||�}WnOttfk
r�}t|dd�}nt	k
r�|j
tj��|SXt
|tj�r�yPtjj}t|�}tjj|k	rt�}|jtjd��nWnUttfk
rG}|jt|dd��n4t	k
rj|j
tj��nXt|||�z|SWdd}Xn|j|�|S(Ntcallbackc�s�|j��S(N(R(R(R((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyt<lambda>�stvaluesYstack_context inconsistency (probably caused by yield within a "with StackContext" block)(RtpopRtcurrentt
add_futuretReturnt
StopIterationtgetattrRt	Exceptiontset_exc_infotsystexc_infot
isinstancettypest
GeneratorTypeR
t_statetcontextstnextt
set_exceptiontStackContextInconsistentErrort
set_resulttRunner(RRRRtetorig_stack_contextstyielded(RR(R(s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR �s>	
	



(R#R$t__wrapped__R&t__tornado_coroutine__(RRtwrappedR ((RRs1/usr/lib64/python2.7/site-packages/tornado/gen.pyR!�s
!5		cC�st|dt�S(sgReturn whether *func* is a coroutine function, i.e. a function
    wrapped with `~.gen.coroutine`.
    RC(R0R"(R((s1/usr/lib64/python2.7/site-packages/tornado/gen.pytis_coroutine_function	sR.cB�seZdZdd�ZRS(s�Special exception to return a value from a `coroutine`.

    If this exception is raised, its value argument is used as the
    result of the coroutine::

        @gen.coroutine
        def fetch_json(url):
            response = yield AsyncHTTPClient().fetch(url)
            raise gen.Return(json_decode(response.body))

    In Python 3.3, this exception is no longer necessary: the ``return``
    statement can be used directly to return a value (previously
    ``yield`` and ``return`` with a value could not be combined in the
    same function).

    By analogy with the return statement, the value argument is optional,
    but it is never necessary to ``raise gen.Return()``.  The ``return``
    statement can be used with no arguments instead.
    cC�s tt|�j�||_dS(N(tsuperR.t__init__R*(tselfR*((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRG$sN(RRRRRG(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR.stWaitIteratorcB�s;eZdZd�Zd�Zd�Zd�Zd�ZRS(sAProvides an iterator to yield the results of futures as they finish.

    Yielding a set of futures like this:

    ``results = yield [future1, future2]``

    pauses the coroutine until both ``future1`` and ``future2``
    return, and then restarts the coroutine with the results of both
    futures. If either future is an exception, the expression will
    raise that exception and all the results will be lost.

    If you need to get the result of each future as soon as possible,
    or if you need the result of some futures even if others produce
    errors, you can use ``WaitIterator``::

      wait_iterator = gen.WaitIterator(future1, future2)
      while not wait_iterator.done():
          try:
              result = yield wait_iterator.next()
          except Exception as e:
              print("Error {} from {}".format(e, wait_iterator.current_future))
          else:
              print("Result {} received from {} at {}".format(
                  result, wait_iterator.current_future,
                  wait_iterator.current_index))

    Because results are returned as soon as they are available the
    output from the iterator *will not be in the same order as the
    input arguments*. If you need to know which future produced the
    current result, you can use the attributes
    ``WaitIterator.current_future``, or ``WaitIterator.current_index``
    to get the index of the future from the input list. (if keyword
    arguments were used in the construction of the `WaitIterator`,
    ``current_index`` will use the corresponding keyword).

    .. versionadded:: 4.1
    cO�s�|r|rtd��n|rUtd�|j�D��|_t|j��}n%td�t|�D��|_|}tj�|_	d|_|_d|_
x|D]}|j|j�q�WdS(Ns)You must provide args or kwargs, not bothcs�s!|]\}}||fVqdS(N((t.0tktf((s1/usr/lib64/python2.7/site-packages/tornado/gen.pys	<genexpr>Uscs�s!|]\}}||fVqdS(N((RJtiRL((s1/usr/lib64/python2.7/site-packages/tornado/gen.pys	<genexpr>Xs(t
ValueErrortdicttitemst_unfinishedtlisttvaluest	enumeratetcollectionstdequet	_finishedRt
current_indextcurrent_futuret_running_futureRt_done_callback(RHRRtfuturesR((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRGOs	
cC�s*|js|jrtSd|_|_tS(s2Returns True if this iterator has no more results.N(RWRQR"RRXRYR&(RH((s1/usr/lib64/python2.7/site-packages/tornado/gen.pytdonebscC�s5t�|_|jr.|j|jj��n|jS(s�Returns a `.Future` that will yield the next available result.

        Note that this `.Future` will not be the same object as any of
        the inputs.
        (RRZRWt_return_resulttpopleft(RH((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR:js	cC�s=|jr)|jj�r)|j|�n|jj|�dS(N(RZR]R^RWtappend(RHR]((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR[wscC�s2t||j�||_|jj|�|_dS(s�Called set the returned future's state that of the future
        we yielded, and set the current future for the iterator.
        N(RRZRYRQR+RX(RHR]((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR^}s	(RRRRGR]R:R[R^(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRI)s%			
	t
YieldPointcB�s)eZdZd�Zd�Zd�ZRS(s�Base class for objects that may be yielded from the generator.

    .. deprecated:: 4.0
       Use `Futures <.Future>` instead.
    cC�s
t��dS(s�Called by the runner after the generator has yielded.

        No other methods will be called on this object before ``start``.
        N(tNotImplementedError(RHtrunner((s1/usr/lib64/python2.7/site-packages/tornado/gen.pytstart�scC�s
t��dS(s�Called by the runner to determine whether to resume the generator.

        Returns a boolean; may be called more than once.
        N(Rb(RH((s1/usr/lib64/python2.7/site-packages/tornado/gen.pytis_ready�scC�s
t��dS(s�Returns the value to use as the result of the yield expression.

        This method will only be called once, and only after `is_ready`
        has returned true.
        N(Rb(RH((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyt
get_result�s(RRRRdReRf(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRa�s		tCallbackcB�s2eZdZd�Zd�Zd�Zd�ZRS(saReturns a callable object that will allow a matching `Wait` to proceed.

    The key may be any value suitable for use as a dictionary key, and is
    used to match ``Callbacks`` to their corresponding ``Waits``.  The key
    must be unique among outstanding callbacks within a single run of the
    generator function, but may be reused across different runs of the same
    function (so constants generally work fine).

    The callback may be called with zero or one arguments; if an argument
    is given it will be returned by `Wait`.

    .. deprecated:: 4.0
       Use `Futures <.Future>` instead.
    cC�s
||_dS(N(tkey(RHRh((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRG�scC�s||_|j|j�dS(N(Rctregister_callbackRh(RHRc((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRd�s	cC�stS(N(R&(RH((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRe�scC�s|jj|j�S(N(Rctresult_callbackRh(RH((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRf�s(RRRRGRdReRf(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRg�s
			tWaitcB�s2eZdZd�Zd�Zd�Zd�ZRS(s�Returns the argument passed to the result of a previous `Callback`.

    .. deprecated:: 4.0
       Use `Futures <.Future>` instead.
    cC�s
||_dS(N(Rh(RHRh((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRG�scC�s
||_dS(N(Rc(RHRc((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRd�scC�s|jj|j�S(N(RcReRh(RH((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRe�scC�s|jj|j�S(N(Rct
pop_resultRh(RH((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRf�s(RRRRGRdReRf(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRk�s
			tWaitAllcB�s2eZdZd�Zd�Zd�Zd�ZRS(s8Returns the results of multiple previous `Callbacks <Callback>`.

    The argument is a sequence of `Callback` keys, and the result is
    a list of results in the same order.

    `WaitAll` is equivalent to yielding a list of `Wait` objects.

    .. deprecated:: 4.0
       Use `Futures <.Future>` instead.
    cC�s
||_dS(N(tkeys(RHRn((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRG�scC�s
||_dS(N(Rc(RHRc((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRd�sc�st�fd��jD��S(Nc3�s!|]}�jj|�VqdS(N(RcRe(RJRh(RH(s1/usr/lib64/python2.7/site-packages/tornado/gen.pys	<genexpr>�s(tallRn(RH((RHs1/usr/lib64/python2.7/site-packages/tornado/gen.pyRe�scC�s&g|jD]}|jj|�^q
S(N(RnRcRl(RHRh((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRf�s(RRRRGRdReRf(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRm�s

			c	�sZt���fd�}�fd�}tj|��|dt|�||�WdQX�S(s�Adapts a callback-based asynchronous function for use in coroutines.

    Takes a function (and optional additional arguments) and runs it with
    those arguments plus a ``callback`` keyword argument.  The argument passed
    to the callback is returned as the result of the yield expression.

    .. versionchanged:: 4.0
       ``gen.Task`` is now a function that returns a `.Future`, instead of
       a subclass of `YieldPoint`.  It still behaves the same way when
       yielded.
    c�s*�j�rtS�j|||f�tS(N(R]R"R2R&(ttypR*ttb(R(s1/usr/lib64/python2.7/site-packages/tornado/gen.pythandle_exception�sc�s!�j�rdS�j|�dS(N(R]R=(R(R(s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR=sR(N(RR
tExceptionStackContextt_argument_adapter(RRRRrR=((Rs1/usr/lib64/python2.7/site-packages/tornado/gen.pytTask�s	tYieldFuturecB�s/eZdd�Zd�Zd�Zd�ZRS(cC�s"||_|ptj�|_dS(s�Adapts a `.Future` to the `YieldPoint` interface.

        .. versionchanged:: 4.1
           The ``io_loop`` argument is deprecated.
        N(RRR,tio_loop(RHRRw((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRG
s	cC�su|jj�sY||_t�|_|j|j�|jj|j|j|j��nd|_|jj
|_dS(N(RR]RctobjectRhRiRwR-RjRRt	result_fn(RHRc((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRds	%	cC�s*|jdk	r"|jj|j�StSdS(N(RcRReRhR&(RH((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRescC�s6|jdk	r(|jj|j�j�S|j�SdS(N(RcRRlRhRRy(RH((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRf#sN(RRRRGRdReRf(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRv	s		
	tMulticB�s5eZdZdd�Zd�Zd�Zd�ZRS(sRuns multiple asynchronous operations in parallel.

    Takes a list of ``YieldPoints`` or ``Futures`` and returns a list of
    their responses.  It is not necessary to call `Multi` explicitly,
    since the engine will do so automatically when the generator yields
    a list of ``YieldPoints`` or a mixture of ``YieldPoints`` and ``Futures``.

    Instead of a list, the argument may also be a dictionary whose values are
    Futures, in which case a parallel dictionary is returned mapping the same
    keys to their results.

    It is not normally necessary to call this class directly, as it
    will be created automatically as needed. However, calling it directly
    allows you to use the ``quiet_exceptions`` argument to control
    the logging of multiple exceptions.

    .. versionchanged:: 4.2
       If multiple ``YieldPoints`` fail, any exceptions after the first
       (which is raised) will be logged. Added the ``quiet_exceptions``
       argument to suppress this logging for selected exception types.
    cC�s�d|_t|t�r<t|j��|_|j�}ng|_x9|D]1}t|�rmt|�}n|jj	|�qLWt
d�|jD��s�t�t|j�|_
||_dS(Ncs�s|]}t|t�VqdS(N(R5Ra(RJRM((s1/usr/lib64/python2.7/site-packages/tornado/gen.pys	<genexpr>Js(RRnR5RORRRStchildrenRRvR`RotAssertionErrortsettunfinished_childrentquiet_exceptions(RHR{RRM((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRG@s		
cC�s%x|jD]}|j|�q
WdS(N(R{Rd(RHRcRM((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRdNscC�s6ttjd�|j��}|jj|�|jS(NcS�s
|j�S(N(Re(RM((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR)Ts(RRt	itertoolst	takewhileR~tdifference_update(RHtfinished((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyReRs	cC�s�g}d}x�|jD]v}y|j|j��Wqtk
r�}|dkr`tj�}q�t||j�s�t	j
ddt�q�qXqW|dk	r�t|�n|j
dk	r�tt|j
|��St|�SdS(Ns!Multiple exceptions in yield listR4(RR{R`RfR1R3R4R5RR	terrorR&RRnROtzipRR(RHtresult_listR4RLR?((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRfXs 
((RRRRGRdReRf(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRz*s
		c�s�t�t�r0t�j����j��nd�td��D��sRt�t���t	���s��j
�dk	r�ing�n�����fd�}t�}x7�D]/}||kr�|j|�|j|�q�q�W�S(s�Wait for multiple asynchronous futures in parallel.

    Takes a list of ``Futures`` (but *not* other ``YieldPoints``) and returns
    a new Future that resolves when all the other Futures are done.
    If all the ``Futures`` succeeded, the returned Future's result is a list
    of their results.  If any failed, the returned Future raises the exception
    of the first one to fail.

    Instead of a list, the argument may also be a dictionary whose values are
    Futures, in which case a parallel dictionary is returned mapping the same
    keys to their results.

    It is not normally necessary to call `multi_future` explcitly,
    since the engine will do so automatically when the generator
    yields a list of ``Futures``. However, calling it directly
    allows you to use the ``quiet_exceptions`` argument to control
    the logging of multiple exceptions.

    This function is faster than the `Multi` `YieldPoint` because it
    does not require the creation of a stack context.

    .. versionadded:: 4.0

    .. versionchanged:: 4.2
       If multiple ``Futures`` fail, any exceptions after the first (which is
       raised) will be logged. Added the ``quiet_exceptions``
       argument to suppress this logging for selected exception types.
    cs�s|]}t|�VqdS(N(R(RJRM((s1/usr/lib64/python2.7/site-packages/tornado/gen.pys	<genexpr>�sc�s��j|��s�g}x��D]z}y|j|j��Wq tk
r�}�j�r�t|��s�tjddt�q�q��j	t
j��q Xq W�j�s��dk	r��j
tt�|���q��j
|�q�ndS(Ns!Multiple exceptions in yield listR4(tremoveR`RR1R]R5R	R�R&R2R3R4RR=ROR�(RLR�R?(R{RRnRR~(s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR(�s 


N(
R5RORRRnRSRRoR|R}RR=taddR(R{RR(t	listeningRL((R{RRnRR~s1/usr/lib64/python2.7/site-packages/tornado/gen.pytmulti_futurems 	"	

cC�s.t|�r|St�}|j|�|SdS(s Converts ``x`` into a `.Future`.

    If ``x`` is already a `.Future`, it is simply returned; otherwise
    it is wrapped in a new `.Future`.  This is suitable for use as
    ``result = yield gen.maybe_future(f())`` when you don't know whether
    ``f()`` returns a `.Future` or not.
    N(RRR=(txtfut((s1/usr/lib64/python2.7/site-packages/tornado/gen.pytmaybe_future�s
	
c�s�t��t����dkr1tj��n�fd�����fd�}�j||��t�t�r��j��fd��n�j���fd���S(s�Wraps a `.Future` in a timeout.

    Raises `TimeoutError` if the input future does not complete before
    ``timeout``, which may be specified in any form allowed by
    `.IOLoop.add_timeout` (i.e. a `datetime.timedelta` or an absolute time
    relative to `.IOLoop.time`)

    If the wrapped `.Future` fails after it has timed out, the exception
    will be logged unless it is of a type contained in ``quiet_exceptions``
    (which may be an exception type or a sequence of types).

    Currently only supports Futures, not other `YieldPoint` classes.

    .. versionadded:: 4.0

    .. versionchanged:: 4.1
       Added the ``quiet_exceptions`` argument and the logging of unhandled
       exceptions.
    c�sPy|j�Wn;tk
rK}t|��sLtjd|dt�qLnXdS(Ns$Exception in Future %r after timeoutR4(RR1R5R	R�R&(RR?(R(s1/usr/lib64/python2.7/site-packages/tornado/gen.pyterror_callback�s	c�s$�jtd���j��dS(NtTimeout(R;RR((R�RR(s1/usr/lib64/python2.7/site-packages/tornado/gen.pyttimeout_callback�sc�s
�j��S(N(tremove_timeout(R(Rwttimeout_handle(s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR)�sc�s
�j��S(N(R�(R(RwR�(s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR)�sN(	RRRRR,tadd_timeoutR5RR-(ttimeoutRRwRR�((R�RRwRRR�s1/usr/lib64/python2.7/site-packages/tornado/gen.pytwith_timeout�s	
c�s,t��tj�j|�fd���S(s�Return a `.Future` that resolves after the given number of seconds.

    When used with ``yield`` in a coroutine, this is a non-blocking
    analogue to `time.sleep` (which should not be used in coroutines
    because it is blocking)::

        yield gen.sleep(0.5)

    Note that calling this function on its own does nothing; you must
    wait on the `.Future` it returns (usually by yielding it).

    .. versionadded:: 4.1
    c�s
�jd�S(N(R=R((RL(s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR)s(RRR,t
call_later(tduration((RLs1/usr/lib64/python2.7/site-packages/tornado/gen.pytsleep�s	sA special object which may be yielded to allow the IOLoop to run for
one iteration.

This is not needed in normal use but it can be helpful in long-running
coroutines that are likely to yield Futures that are ready instantly.

Usage: ``yield gen.moment``

.. versionadded:: 4.0
R>cB�sheZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZRS(s�Internal implementation of `tornado.gen.engine`.

    Maintains information about pending callbacks and their results.

    The results of the generator are stored in ``result_future`` (a
    `.TracebackFuture`)
    cC�s�||_||_t|_d|_d|_d|_t|_	t|_
t|_tj
�|_d|_|j|�r�|j�ndS(N(tgent
result_futuret_null_futureRRtyield_pointtpending_callbackstresultsR"trunningR�t
had_exceptionRR,Rwtstack_context_deactivatethandle_yieldtrun(RHR�R�t
first_yielded((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRG,s										cC�s`|jdkr't�|_i|_n||jkrLtd|f��n|jj|�dS(s&Adds ``key`` to the list of callbacks.skey %r is already pendingN(R�RR}R�R
R�(RHRh((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRi@scC�sA|jdks||jkr4td|f��n||jkS(s2Returns true if a result is available for ``key``.skey %r is not pendingN(R�RRR�(RHRh((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyReJscC�s�||j|<|jdk	r~|jj�r~y|jj|jj��Wn|jjtj	��nXd|_|j
�ndS(sASets the result for ``key`` and attempts to resume the generator.N(R�R�RReRR=RfR2R3R4R�(RHRhR((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR=Ps
	cC�s |jj|�|jj|�S(s2Returns the result for ``key`` and unregisters it.(R�R�R�R+(RHRh((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRl[scC�s�|js|jrdSz�t|_x�tr�|j}|j�sDdSd|_y�tjj}d}y|j	�}Wn&t
k
r�t|_tj
�}nX|dk	r�|jj|�}d}n|jj|�}tjj|k	r|jjtjd��nWn�ttfk
r�}t|_t|_|jrV|jrVtd|j��n|jjt|dd��d|_|j�dSt
k
r�t|_t|_|jjtj
��d|_|j�dSX|j|�s%dSq%WWdt|_XdS(skStarts or resumes the generator, running until it reaches a
        yield point that is not ready.
        NsYstack_context inconsistency (probably caused by yield within a "with StackContext" block)s)finished without waiting for callbacks %rR*(R�R�R&RR]RR
R8R9RR1R�R3R4R�tthrowtsendR<R/R.R�R�RR�R=R0t_deactivate_stack_contextR2R�R"(RHRR@R4R*RAR?((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR�`s\				
						

			
c�s�t�t�r4td��D��r4t���n:t�t�rntd��j�D��rnt���nt�t�rt��_��fd���j	dkr�tj�j
��6}|�_	��fd�}�jj|�tSWdQXqJ��nIyt���_Wn3tk
rIt��_�jjtj��nX�jj�si�jtkr��jj�j�fd��tStS(Ncs�s|]}t|t�VqdS(N(R5Ra(RJRL((s1/usr/lib64/python2.7/site-packages/tornado/gen.pys	<genexpr>�scs�s|]}t|t�VqdS(N(R5Ra(RJRL((s1/usr/lib64/python2.7/site-packages/tornado/gen.pys	<genexpr>�sc�syy?�j���j�r5�jj�j��n	��_Wn3tk
rtt��_�jjt	j
��nXdS(N(RdReRR=RfR�R1RR2R3R4((RHRA(s1/usr/lib64/python2.7/site-packages/tornado/gen.pytstart_yield_point�s
	

c�s���j�dS(N(R�((RHR�(s1/usr/lib64/python2.7/site-packages/tornado/gen.pytcb�sc�s
�j�S(N(R�(RL(RH(s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR)�s(R5RRtanyRzRORSRaRRR�RR
RsRrRwtadd_callbackR"tconvert_yieldedRR2R3R4R]tmomentR-R&(RHRAt
deactivateR�((RHR�RAs1/usr/lib64/python2.7/site-packages/tornado/gen.pyR��s6	


	cC�s"tjttj|j|���S(N(R
RRtR#tpartialR=(RHRh((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRj�s	cC�sO|jrG|jrGt�|_|jj|||f�|j�tStSdS(N(R�R�RRR2R�R&R"(RHRpR*Rq((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRr�s
cC�s)|jdk	r%|j�d|_ndS(N(R�R(RH((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR��s
(
RRRRGRiReR=RlR�R�RjRrR�(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR>$s		
				=	6			t	ArgumentsRRc�s�fd�}|S(sReturns a function that when invoked runs ``callback`` with one arg.

    If the function returned by this function is called with exactly
    one argument, that argument is passed to ``callback``.  Otherwise
    the args tuple and kwargs dict are wrapped in an `Arguments` object.
    c�sS|st|�dkr.�t||��n!|rE�|d�n
�d�dS(Nii(tlenR�R(RR(R((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR �s
((R(R ((R(s1/usr/lib64/python2.7/site-packages/tornado/gen.pyRt�scC�sFt|ttf�rt|�St|�r/|Std|f��dS(s�Convert a yielded object into a `.Future`.

    The default implementation accepts lists, dictionaries, and Futures.

    If the `~functools.singledispatch` library is available, this function
    may be extended to support additional types. For example::

        @convert_yielded.register(asyncio.Future)
        def _(asyncio_future):
            return tornado.platform.asyncio.to_tornado_future(asyncio_future)

    .. versionadded:: 4.1
    syielded unknown object %rN(R5RRROR�RR(RA((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyR��s

(((?Rt
__future__RRRRRUR#R�R3R6tweakrefttornado.concurrentRRRRttornado.ioloopRttornado.logR	ttornadoR
ttornado.utilRRtImportErrorR?RR1R
RRRRRR%R&R'R!RER.RxRIRaRgRkRmRuRvRzR�R�R�R�R�R=R�R>t
namedtupleR�RtR�(((s1/usr/lib64/python2.7/site-packages/tornado/gen.pyt<module>Lsj""
	#&	C	^	!CE	=		
		
�		

Zerion Mini Shell 1.0