+
    G8
kÉ   ã                   óÂ  € R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RIH
t
Ht ^ RIHt ]P                  ! R4      t ! R R]4      t]P$                  t]	P$                  ]3tR	 R
 lt ! R R]	P*                  4      t]! 4       tR R lt]! 4       tR R ltR R ltR R ltR R lt]P>                  R R l4       t ]P>                  R R l4       t R R lt R# )a¨  Utilities for working with ``Future`` objects.

Tornado previously provided its own ``Future`` class, but now uses
`asyncio.Future`. This module contains utility functions for working
with `asyncio.Future` in a way that is backwards-compatible with
Tornado's old ``Future`` implementation.

While this module is an important part of Tornado's internal
implementation, applications rarely need to interact with it
directly.

N©ÚCallable)Úfutures)ÚAnyÚUnion)Úapp_logÚ_Tc                   ó   € ] tR t^*tRtR# )ÚReturnValueIgnoredError© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   ó    Ú‰/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/tornado/concurrent.pyr
   r
   *   s   † ãr   r
   c                ó0   € V ^8„  d   QhR\         R\        /# )é   ÚxÚreturn)r   Úbool)Úformats   "r   Ú__annotate__r   4   s   € ÷ "ñ "”ð "œñ "r   c                 ó"   € \        V \        4      # ©N)Ú
isinstanceÚFUTURES)r   s   &r   Ú	is_futurer   4   s   € Ü�aœÓ!Ð!r   c                   óH   a € ] tR t^8t o V 3R lR ltRV 3R lR lltRtV tR# )ÚDummyExecutorc                óD   <€ V ^8„  d   QhRS[ RS[3,          RS[RS[RR/# )r   Úfn.ÚargsÚkwargsr   úfutures.Future[_T])r   r   r   )r   Ú__classdict__s   "€r   r   ÚDummyExecutor.__annotate__9   s6   ø€ ÷ ñ Ù˜3¡˜7Õ#ðÙ,/ðÙ;>ðà	ñr   c                ó¶   € \         P                  ! 4       p \        WA! V/ VB 4       V#   \         d$    \	        T\
        P                  ! 4       4        T# i ; ir   )r   ÚFutureÚ"future_set_result_unless_cancelledÚ	ExceptionÚfuture_set_exc_infoÚsysÚexc_info)Úselfr"   r#   r$   Úfutures   &&*, r   ÚsubmitÚDummyExecutor.submit9   sV   € ô &-§^¢^Ó%5ˆð	8Ü.¨v°r¸4Ð7JÀ6Ñ7JÔKð ˆøô ô 	8Ü ¬¯ª«Õ7Øˆð	8ús   —* ª*AÁAc                ó*   <€ V ^8„  d   QhRS[ RS[ RR/# )r   ÚwaitÚcancel_futuresr   N)r   )r   r&   s   "€r   r   r'   C   s"   ø€ ÷ ñ ™Tð ¹$ð È4ñ r   c                ó   € R # r   r   )r/   r4   r5   s   &&&r   ÚshutdownÚDummyExecutor.shutdownC   s   € Ùr   r   N)TF)r   r   r   r   r1   r7   r   Ú__classdictcell__)r&   s   @r   r    r    8   s   ø‡ € ÷ð ÷÷ ð r   r    c                ó<   € V ^8„  d   QhR\         R\         R\        /# )r   r#   r$   r   )r   r   )r   s   "r   r   r   J   s!   € ÷ =%ñ =%œ3ð =%¬#ð =%´(ñ =%r   c                 óä   a€ R V3R llpV '       d   S'       d   \        R4      h\        V 4      ^8X  d   V! V ^ ,          4      # \        V 4      ^ 8w  d   \        R\        V 4      ,          4      hV# )aÙ  Decorator to run a synchronous method asynchronously on an executor.

Returns a future.

The executor to be used is determined by the ``executor``
attributes of ``self``. To use a different attribute name, pass a
keyword argument to the decorator::

    @run_on_executor(executor='_thread_pool')
    def foo(self):
        pass

This decorator should not be confused with the similarly-named
`.IOLoop.run_in_executor`. In general, using ``run_in_executor``
when *calling* a blocking method is recommended instead of using
this decorator when *defining* a method. If compatibility with older
versions of Tornado is required, consider defining an executor
and using ``executor.submit()`` at the call site.

.. versionchanged:: 4.2
   Added keyword arguments to use alternative attributes.

.. versionchanged:: 5.0
   Always uses the current IOLoop instead of ``self.io_loop``.

.. versionchanged:: 5.1
   Returns a `.Future` compatible with ``await`` instead of a
   `concurrent.futures.Future`.

.. deprecated:: 5.1

   The ``callback`` argument is deprecated and will be removed in
   6.0. The decorator itself is discouraged in new code but will
   not be removed in 6.0.

.. versionchanged:: 6.0

   The ``callback`` argument was removed.
c                óJ   € V ^8„  d   QhR\         R\         R\        3,          /# )r   r"   r   .)r   r)   )r   s   "r   r   Ú%run_on_executor.<locals>.__annotate__u   s#   € ÷ 
ñ 
¤hð 
´8¸CÄ¸KÕ3Hñ 
r   c                 óv   <a a€ SP                  R R 4      o\        P                  ! S 4      R VV 3R ll4       pV# )Úexecutorc                óH   € V ^8„  d   QhR\         R\         R\         R\        /# )r   r/   r#   r$   r   )r   r)   )r   s   "r   r   ÚHrun_on_executor.<locals>.run_on_executor_decorator.<locals>.__annotate__y   s(   € ÷ 	 ñ 	 œ#ð 	 ¤cð 	 ´Sð 	 ¼Vñ 	 r   c                 ót   <€ \        4       p\        V S4      P                  ! SV .VO5/ VB p\        WC4       V# r   )r)   Úgetattrr1   Úchain_future)r/   r#   r$   Úasync_futureÚconc_futurer?   r"   s   &*,  €€r   ÚwrapperÚCrun_on_executor.<locals>.run_on_executor_decorator.<locals>.wrapperx   s;   ø€ ä#)£8ˆLÜ! $¨Ó1×8Ò8¸¸TÐSÀDÒSÈFÑSˆKÜ˜Ô3ØÐr   )ÚgetÚ	functoolsÚwraps)r"   rG   r?   r$   s   f @€r   Úrun_on_executor_decoratorÚ2run_on_executor.<locals>.run_on_executor_decoratoru   s:   ú€ Ø—:‘:˜j¨*Ó5ˆä	�Š˜Ó	÷	 ð 	 ó 
ð	 ð ˆr   z*cannot combine positional and keyword argszexpected 1 argument, got %d)Ú
ValueErrorÚlen)r#   r$   rL   s   *l r   Úrun_on_executorrP   J   sa   ø€ ÷V
ð 
÷ —ÜÐEÓFÐFÜ
ˆ4ƒy�A„~Ù(¨¨a­Ó1Ð1Ü	ˆT‹�aŒÜÐ6¼¸T»ÕBÓCÐCØ$Ð$r   c                óP   € V ^8„  d   QhR\         R,          R\         R,          RR/# )r   ÚaÚbr   N)ú
Future[_T]r%   )r   )r   s   "r   r   r   �   s2   € ÷ *-ñ *-ÜÐ/Õ0ð*-äÐ/Õ0ð*-ð 
ñ*-r   c                óª   a€ R V3R llp\        V \        4      '       d   \        W4       R# ^ RIHp VP                  4       P                  W4       R# )aÌ  Chain two futures together so that when one completes, so does the other.

The result (success or failure) of ``a`` will be copied to ``b``, unless
``b`` has already been completed or cancelled by the time ``a`` finishes.

.. versionchanged:: 5.0

   Now accepts both Tornado/asyncio `Future` objects and
   `concurrent.futures.Future`.

.. versionchanged:: 6.6

   If ``a`` is cancelled, ``b`` is now cancelled too. Previously ``b``
   would never complete.

c                ó    € V ^8„  d   QhRRRR/# )r   rR   rT   r   Nr   )r   s   "r   r   Ú"chain_future.<locals>.__annotate__¢   s   € ÷ )ñ )�ð ) ñ )r   c                 ó”  <€ SP                  4       '       d   R # V P                  4       '       d   SP                  4        R # \        V R4      '       d/   V P	                  4       e   \        SV P	                  4       4       R # V P                  4       pVe   SP                  V4       R # SP                  V P                  4       4       R # )Nr.   )
ÚdoneÚ	cancelledÚcancelÚhasattrr.   r,   Ú	exceptionÚset_exceptionÚ
set_resultÚresult)rR   Úa_excrS   s   & €r   ÚcopyÚchain_future.<locals>.copy¢   s   ø€ Ø�6‰6�8Š8ÙØ�;‰;�=Š=Ø�H‰HŒJÙÜ�1�j×!Ò! a§j¡j£lÒ&>Ü  1§:¡:£<Ö0à—K‘K“MˆEØÒ Ø—‘ Ö&à—‘˜QŸX™X›ZÖ(r   )ÚIOLoopN)r   r)   Úfuture_add_done_callbackÚtornado.iolooprd   ÚcurrentÚ
add_future)rR   rS   rb   rd   s   &f  r   rD   rD   �   s>   ø€ ÷*)ð )ô �!”V×ÒÜ  Ö)õ 	*à�‰Ó×#Ñ# AÖ,r   c                ó,   € V ^8„  d   QhRRR\         RR/# )r   r0   ú%Union[futures.Future[_T], Future[_T]]Úvaluer   N)r   )r   s   "r   r   r   º   s$   € ÷ !ñ !Ø3ð!Ü<>ð!à	ñ!r   c                óX   € V P                  4       '       g   V P                  V4       R# R# )zÀSet the given ``value`` as the `Future`'s result, if not cancelled.

Avoids ``asyncio.InvalidStateError`` when calling ``set_result()`` on
a cancelled `asyncio.Future`.

.. versionadded:: 5.0
N)rZ   r_   )r0   rk   s   &&r   r*   r*   º   s&   € ð ×Ñ×ÒØ×Ñ˜%Ö ñ r   c                ó,   € V ^8„  d   QhRRR\         RR/# )r   r0   rj   Úexcr   N)ÚBaseException)r   s   "r   r   r   È   s)   € ÷ Lñ LØ3ðLÜ:GðLà	ñLr   c                óˆ   € V P                  4       '       g   V P                  V4       R# \        P                  ! RVR7       R# )a‰  Set the given ``exc`` as the `Future`'s exception.

If the Future is already canceled, logs the exception instead. If
this logging is not desired, the caller should explicitly check
the state of the Future and call ``Future.set_exception`` instead of
this wrapper.

Avoids ``asyncio.InvalidStateError`` when calling ``set_exception()`` on
a cancelled `asyncio.Future`.

.. versionadded:: 6.0

z$Exception after Future was cancelled)r.   N)rZ   r^   r   Úerror)r0   rn   s   &&r   Ú%future_set_exception_unless_cancelledrr   È   s0   € ð  ×Ñ×ÒØ×Ñ˜SÖ!ä�ŠÐ<Às×Kr   c                ó–   € V ^8„  d   QhRRR\         \        R,          \        R,          \        P                  R,          3,          RR/# )r   r0   rj   r.   Nr   )ÚtupleÚtypero   ÚtypesÚTracebackType)r   s   "r   r   r   Þ   sF   € ÷ ?ñ ?Ø3ð?ä”D˜4•K¤°Õ!5´u×7JÑ7JÈTÕ7QÐQÕRð?ð 
ñ?r   c                óV   € V^,          f   \        R4      h\        W^,          4       R# )ae  Set the given ``exc_info`` as the `Future`'s exception.

Understands both `asyncio.Future` and the extensions in older
versions of Tornado to enable better tracebacks on Python 2.

.. versionadded:: 5.0

.. versionchanged:: 6.0

   If the future is already cancelled, this function is a no-op.
   (previously ``asyncio.InvalidStateError`` would be raised)

Nz,future_set_exc_info called with no exception)r+   rr   )r0   r.   s   &&r   r,   r,   Þ   s&   € ð" �…{ÒÜÐFÓGÐGÜ)¨&¸1µ+Ö>r   c                ó@   € V ^8„  d   QhRRR\         R.R3,          RR/# )r   r0   r%   ÚcallbackNr   r   )r   s   "r   r   r   õ   s2   € ÷ 	ñ 	Ø ð	Ü,4Ð6JÐ5KÈTÐ5QÕ,Rð	à	ñ	r   c                 ó   € R # r   r   ©r0   rz   s   &&r   re   re   ô   ó   € ñ 	r   c                ó@   € V ^8„  d   QhRRR\         R.R3,          RR/# )r   r0   rT   rz   Nr   r   )r   s   "r   r   r   ü   s0   € ÷ 	ñ 	Øð	Ü$,¨l¨^¸TÐ-AÕ$Bð	à	ñ	r   c                 ó   € R # r   r   r|   s   &&r   re   re   û   r}   r   c                ó:   € V ^8„  d   QhRRR\         R,          RR/# )r   r0   rj   rz   Nr   ).Nr   )r   s   "r   r   r     s)   € ÷ +ñ +Ø3ð+Ü?GÈ	Õ?Rð+à	ñ+r   c                óh   € V P                  4       '       d   V! V 4       R# V P                  V4       R# )a4  Arrange to call ``callback`` when ``future`` is complete.

``callback`` is invoked with one argument, the ``future``.

If ``future`` is already done, ``callback`` is invoked immediately.
This may differ from the behavior of ``Future.add_done_callback``,
which makes no such guarantee.

.. versionadded:: 5.0
N)rY   Úadd_done_callbackr|   s   &&r   re   re     s%   € ð ‡{�{‡}‚}Ù�Öà× Ñ  Ö*r   )!Ú__doc__ÚasynciorJ   r-   rv   ÚtypingÚcollections.abcr   Ú
concurrentr   r   r   Útornado.logr   ÚTypeVarr   r+   r
   r)   r   r   ÚExecutorr    Údummy_executorrP   ÚobjectÚ
_NO_RESULTrD   r*   rr   r,   Úoverloadre   r   r   r   Ú<module>r�      sÔ   ðñó Û Û 
Û Û Ý $Ý ß å à‡^‚^�DÓ€ô	˜iô 	ð
 
�‰€à�>‰>˜6Ð
"€õ"ô�G×$Ñ$ô ñ “€õ=%ñ@ ‹X€
õ*-õZ!õLõ,?ð, ‡�ô	ó ð	ð ‡�ô	ó ð	÷+r   