+
    G8
kÎE  ã                   óø   € ^ RI t ^ RIt^ RIt^ RIHt ^ RIHtHtHt ^ RI	H
t
Ht ^ RIHtHt . ROt ! R R4      t ! R R]4      t ! R R4      t ! R R4      t ! R R]4      t ! R R	]4      t ! R R
4      tR# )é    N)Ú	Awaitable)ÚAnyÚOptionalÚType)ÚgenÚioloop)ÚFutureÚ"future_set_result_unless_cancelledÚ	ConditionÚEventÚ	SemaphoreÚBoundedSemaphoreÚLockc                   óH   a € ] tR t^t o RtV 3R lR ltV 3R lR ltRtV tR# )Ú_TimeoutGarbageCollectorzÍBase class for objects that periodically clean up timed-out waiters.

Avoids memory leak in a common pattern like:

    while True:
        yield condition.wait(short_timeout)
        print('looping....')
c                ó   <€ V ^8„  d   QhRR/# ©é   ÚreturnN© )ÚformatÚ__classdict__s   "€Ú„/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/tornado/locks.pyÚ__annotate__Ú%_TimeoutGarbageCollector.__annotate__%   s   ø€ ÷ ñ ˜$ñ ó    c                óH   € \         P                  ! 4       V n        ^ V n        R# )r   N)ÚcollectionsÚdequeÚ_waitersÚ	_timeouts©Úselfs   &r   Ú__init__Ú!_TimeoutGarbageCollector.__init__%   s   € Ü3>×3DÒ3DÓ3FˆŒØˆŽr   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r   )   s   ø€ ÷ Xñ X $ñ Xr   c                óÄ   € V ;P                   ^,          un         V P                   ^d8”  d6   ^ V n         \        P                  ! R V P                   4       4      V n        R# R# )é   c              3   óT   "  € T F  qP                  4       '       d   K  Vx € K   	  R # 5i©N)Údone)Ú.0Úws   & r   Ú	<genexpr>Ú<_TimeoutGarbageCollector._garbage_collect.<locals>.<genexpr>.   s   é € Ð-W¹°AÏfÉfÏh¯aªa»ùs   ‚(ž
(N)r!   r   r   r    r"   s   &r   Ú_garbage_collectÚ)_TimeoutGarbageCollector._garbage_collect)   sD   € à�Š˜!Õ�Ø�>‰>˜CÔØˆDŒNÜ'×-Ò-Ñ-W¸¿ºÓ-WÓWˆDŽMñ  r   )r!   r    N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r$   r0   Ú__static_attributes__Ú__classdictcell__©r   s   @r   r   r      s    ø‡ € ñ÷ð ÷Xö Xr   r   c                   ót   a € ] tR t^1t o RtV 3R lR ltRV 3R lR lltRV 3R lR lltV 3R	 lR
 ltRt	V t
R# )r   a  A condition allows one or more coroutines to wait until notified.

Like a standard `threading.Condition`, but does not need an underlying lock
that is acquired and released.

With a `Condition`, coroutines can wait to be notified by other coroutines:

.. testcode::

    import asyncio
    from tornado import gen
    from tornado.locks import Condition

    condition = Condition()

    async def waiter():
        print("I'll wait right here")
        await condition.wait()
        print("I'm done waiting")

    async def notifier():
        print("About to notify")
        condition.notify()
        print("Done notifying")

    async def runner():
        # Wait for waiter() and notifier() in parallel
        await gen.multi([waiter(), notifier()])

    asyncio.run(runner())

.. testoutput::

    I'll wait right here
    About to notify
    Done notifying
    I'm done waiting

`wait` takes an optional ``timeout`` argument, which is either an absolute
timestamp::

    io_loop = IOLoop.current()

    # Wait up to 1 second for a notification.
    await condition.wait(timeout=io_loop.time() + 1)

...or a `datetime.timedelta` for a timeout relative to the current time::

    # Wait up to 1 second.
    await condition.wait(timeout=datetime.timedelta(seconds=1))

The method returns False if there's no notification before the deadline.

.. versionchanged:: 5.0
   Previously, waiters could be notified synchronously from within
   `notify`. Now, the notification will always be received on the
   next iteration of the `.IOLoop`.
c                ó    <€ V ^8„  d   QhRS[ /# ©r   r   ©Ústr)r   r   s   "€r   r   ÚCondition.__annotate__m   s   ø€ ÷ ñ ™#ñ r   c                ó°   € R V P                   P                   2pV P                  '       d$   VR\        V P                  4      ,          ,          pVR,           # )Ú<z waiters[%s]Ú>)Ú	__class__r2   r    Úlen)r#   Úresults   & r   Ú__repr__ÚCondition.__repr__m   sD   € Ø�T—^‘^×,Ñ,Ð-Ð.ˆØ�=�=ˆ=Ø�n¤s¨4¯=©=Ó'9Õ9Õ9ˆFØ˜�|Ðr   Nc                óh   <€ V ^8„  d   QhRS[ S[P                  ,          R,          RS[S[,          /# ©r   ÚtimeoutNr   )ÚfloatÚdatetimeÚ	timedeltar   Úbool)r   r   s   "€r   r   r?   s   s1   ø€ ÷ ñ Ù™x×1Ñ1Õ1°DÕ8ðá	‘4�ñr   c                óþ   a aaa€ \        4       oS P                  P                  S4       VeP   R V V3R llp\        P                  P                  4       oSP                  W4      oSP                  VV3R l4       S# )a'  Wait for `.notify`.

Returns a `.Future` that resolves ``True`` if the condition is notified,
or ``False`` after a timeout.

.. versionchanged:: 6.6
   A ``timeout`` argument of zero will either return or raise immediately.
   Previously, zero was treated equivalent to ``None`` (wait forever).
c                ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   Ú$Condition.wait.<locals>.__annotate__ƒ   s   € ÷ (ñ ( ñ (r   c                  ól   <€ SP                  4       '       g   \        SR 4       S P                  4        R# ©FN)r+   r
   r0   ©r#   Úwaiters   €€r   Ú
on_timeoutÚ"Condition.wait.<locals>.on_timeoutƒ   s$   ø€ Ø—{‘{—}’}Ü6°v¸uÔEØ×%Ñ%Ö'r   c                 ó&   <€ SP                  S4      # r*   ©Úremove_timeout©Ú_Úio_loopÚtimeout_handles   &€€r   Ú<lambda>Ú Condition.wait.<locals>.<lambda>Š   s   ø€ ¨w×/EÑ/EÀnÔ/Ur   )r	   r    Úappendr   ÚIOLoopÚcurrentÚadd_timeoutÚadd_done_callback©r#   rJ   rV   r]   r^   rU   s   f& @@@r   ÚwaitÚCondition.waits   sf   û€ ô  &›xˆØ�‰×Ñ˜VÔ$ØÒ÷(ñ (ô
 —m‘m×+Ñ+Ó-ˆGØ$×0Ñ0°ÓEˆNØ×$Ñ$Õ%UÔVØˆr   c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   Únr   N©Úint)r   r   s   "€r   r   r?   �   s   ø€ ÷ 
=ñ 
=™ð 
= Dñ 
=r   c                ó  € . pV'       da   V P                   '       dO   V P                   P                  4       pVP                  4       '       d   KL  V^,          pVP                  V4       Kh  V F  p\	        VR4       K  	  R# )zWake ``n`` waiters.TN)r    Úpopleftr+   ra   r
   )r#   rj   ÚwaitersrU   s   &&  r   ÚnotifyÚCondition.notify�   sX   € àˆß�D—M—M�MØ—]‘]×*Ñ*Ó,ˆFØ—;‘;—=”=Ø�Q•�Ø—‘˜vÖ&ãˆFÜ.¨v°tÖ<ó r   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r?   ™   s   ø€ ÷ (ñ (˜Dñ (r   c                óN   € V P                  \        V P                  4      4       R# )zWake all waiters.N)rp   rD   r    r"   s   &r   Ú
notify_allÚCondition.notify_all™   s   € à�‰”C˜Ÿ™Ó&Ö'r   r   r*   ©r(   )r2   r3   r4   r5   r6   rF   rg   rp   rt   r7   r8   r9   s   @r   r   r   1   s3   ø‡ € ñ9÷vð ÷ò ÷4
=ò 
=÷(ö (r   c                   ó”   a € ] tR t^žt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	RV 3R lR llt
RtV tR# )r   a6  An event blocks coroutines until its internal flag is set to True.

Similar to `threading.Event`.

A coroutine can wait for an event to be set. Once it is set, calls to
``yield event.wait()`` will not block unless the event has been cleared:

.. testcode::

    import asyncio
    from tornado import gen
    from tornado.locks import Event

    event = Event()

    async def waiter():
        print("Waiting for event")
        await event.wait()
        print("Not waiting this time")
        await event.wait()
        print("Done")

    async def setter():
        print("About to set the event")
        event.set()

    async def runner():
        await gen.multi([waiter(), setter()])

    asyncio.run(runner())

.. testoutput::

    Waiting for event
    About to set the event
    Not waiting this time
    Done
c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   ÚEvent.__annotate__Æ   s   ø€ ÷ 1ñ 1˜$ñ 1r   c                ó2   € R V n         \        4       V n        R# rS   )Ú_valueÚsetr    r"   s   &r   r$   ÚEvent.__init__Æ   s   € ØˆŒÜ+.«5ˆŽr   c                ó    <€ V ^8„  d   QhRS[ /# r<   r=   )r   r   s   "€r   r   ry   Ê   s   ø€ ÷ 
ñ 
™#ñ 
r   c                ó†   € R P                  V P                  P                  V P                  4       '       d   R4      # R4      # )z<{} {}>r|   Úclear)r   rC   r2   Úis_setr"   s   &r   rF   ÚEvent.__repr__Ê   s<   € Ø×ÑØ�N‰N×#Ñ#Ø—[‘[—]’]ˆEó
ð 	
à(/ó
ð 	
r   c                ó    <€ V ^8„  d   QhRS[ /# r<   )rN   )r   r   s   "€r   r   ry   Ð   s   ø€ ÷ ñ ™ñ r   c                ó   € V P                   # )z-Return ``True`` if the internal flag is true.©r{   r"   s   &r   r�   ÚEvent.is_setÐ   s   € à�{‰{Ðr   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   ry   Ô   s   ø€ ÷ 
)ñ 
)�Tñ 
)r   c                ó´   € V P                   '       gF   RV n         V P                   F,  pVP                  4       '       d   K  VP                  R4       K.  	  R# R# )zsSet the internal flag to ``True``. All waiters are awakened.

Calling `.wait` once the flag is set will not block.
TN)r{   r    r+   Ú
set_result)r#   Úfuts   & r   r|   Ú	Event.setÔ   s>   € ð
 �{�{ˆ{ØˆDŒKà—}”}�Ø—x‘x—z”zØ—N‘N 4Ö(ó %ñ r   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   ry   à   s   ø€ ÷ ñ �tñ r   c                ó   € RV n         R# )z[Reset the internal flag to ``False``.

Calls to `.wait` will block until `.set` is called.
FNr…   r"   s   &r   r€   ÚEvent.clearà   s   € ð
 ˆŽr   Nc                óf   <€ V ^8„  d   QhRS[ S[P                  ,          R,          RS[R,          /# rI   )rK   rL   rM   r   )r   r   s   "€r   r   ry   ç   s1   ø€ ÷ ñ Ù™x×1Ñ1Õ1°DÕ8ðá	�4�ñr   c                ó,  a a€ \        4       oS P                  '       d   SP                  R4       S# S P                  P	                  S4       SP                  V 3R l4       Vf   S# \        P                  ! VS4      pVP                  V3R l4       V# )a  Block until the internal flag is true.

Returns an awaitable, which raises `TimeoutError` after a
timeout.

.. versionchanged:: 6.6
   A ``timeout`` argument of zero will either return or raise immediately.
   Previously, zero was treated equivalent to ``None`` (wait forever).
Nc                 ó:   <€ SP                   P                  V 4      # r*   )r    Úremove)rŠ   r#   s   &€r   r_   ÚEvent.wait.<locals>.<lambda>ø   s   ø€ ¨$¯-©-×*>Ñ*>¸sÔ*Cr   c                 óT   <€ SP                  4       '       g   SP                  4       # R # r*   )r+   Úcancel)ÚtfrŠ   s   &€r   r_   r“     s   ø€ ¨s¯x©x¯zªz˜3Ÿ:™:›<ÐC¸tÐCr   )r	   r{   r‰   r    Úaddre   r   Úwith_timeout)r#   rJ   Útimeout_futrŠ   s   f& @r   rg   Ú
Event.waitç   s~   ù€ ô #›HˆØ�;�;ˆ;Ø�N‰N˜4Ô ØˆJØ�‰×Ñ˜#ÔØ×ÑÔCÔDØŠ?ØˆJä×*Ò*¨7°CÓ8ˆKð ×)Ñ)ÜCôð Ðr   )r{   r    r*   )r2   r3   r4   r5   r6   r$   rF   r�   r|   r€   rg   r7   r8   r9   s   @r   r   r   ž   sL   ø‡ € ñ%÷N1ð 1÷
ð 
÷ð ÷
)ð 
)÷ð ÷÷ ð r   c                   óZ   a € ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltR	tV t	R
# )Ú_ReleasingContextManageri  z—Releases a Lock or Semaphore at the end of a "with" statement.

with (yield semaphore.acquire()):
    pass

# Now semaphore.release() has been called.
c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   Úobjr   N)r   )r   r   s   "€r   r   Ú%_ReleasingContextManager.__annotate__  s   ø€ ÷ ñ ™Cð  Dñ r   c                ó   € Wn         R # r*   ©Ú_obj)r#   rž   s   &&r   r$   Ú!_ReleasingContextManager.__init__  s   € ØŽ	r   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   rŸ     s   ø€ ÷ ñ ˜4ñ r   c                ó   € R # r*   r   r"   s   &r   Ú	__enter__Ú"_ReleasingContextManager.__enter__  s   € Ùr   c                ó^   <€ V ^8„  d   QhRRRS[ R,          RS[P                  R,          RR/# )r   Úexc_typeúOptional[Type[BaseException]]Úexc_valNÚexc_tbr   ©ÚBaseExceptionÚtypesÚTracebackType)r   r   s   "€r   r   rŸ     sC   ø€ ÷ ñ à1ðñ  Õ%ðñ ×#Ñ# dÕ*ð	ð
 
ñr   c                ó:   € V P                   P                  4        R # r*   )r¢   Úrelease)r#   r©   r«   r¬   s   &&&&r   Ú__exit__Ú!_ReleasingContextManager.__exit__  s   € ð 	�	‰	×ÑÖr   r¡   N)
r2   r3   r4   r5   r6   r$   r¦   r³   r7   r8   r9   s   @r   rœ   rœ     s(   ø‡ € ñ÷ð ÷ð ÷ö r   rœ   c                   óÎ   a a€ ] tR tRt oRtRV3R lV 3R llltV3R lV 3R lltV3R lR ltRV3R	 lR
 lltV3R lR lt	V3R lR lt
V3R lR ltV3R lR ltRtVtV ;t# )r   i  a®
  A lock that can be acquired a fixed number of times before blocking.

A Semaphore manages a counter representing the number of `.release` calls
minus the number of `.acquire` calls, plus an initial value. The `.acquire`
method blocks if necessary until it can return without making the counter
negative.

Semaphores limit access to a shared resource. To allow access for two
workers at a time:

.. testsetup:: semaphore

   from collections import deque

   from tornado import gen
   from tornado.ioloop import IOLoop
   from tornado.concurrent import Future

   inited = False

   async def simulator(futures):
       for f in futures:
           # simulate the asynchronous passage of time
           await gen.sleep(0)
           await gen.sleep(0)
           f.set_result(None)

   def use_some_resource():
       global inited
       global futures_q
       if not inited:
           inited = True
           # Ensure reliable doctest output: resolve Futures one at a time.
           futures_q = deque([Future() for _ in range(3)])
           IOLoop.current().add_callback(simulator, list(futures_q))

       return futures_q.popleft()

.. testcode:: semaphore

    import asyncio
    from tornado import gen
    from tornado.locks import Semaphore

    sem = Semaphore(2)

    async def worker(worker_id):
        await sem.acquire()
        try:
            print("Worker %d is working" % worker_id)
            await use_some_resource()
        finally:
            print("Worker %d is done" % worker_id)
            sem.release()

    async def runner():
        # Join all workers.
        await gen.multi([worker(i) for i in range(3)])

    asyncio.run(runner())

.. testoutput:: semaphore

    Worker 0 is working
    Worker 1 is working
    Worker 0 is done
    Worker 2 is working
    Worker 1 is done
    Worker 2 is done

Workers 0 and 1 are allowed to run concurrently, but worker 2 waits until
the semaphore has been released once, by worker 0.

The semaphore can be used as an async context manager::

    async def worker(worker_id):
        async with sem:
            print("Worker %d is working" % worker_id)
            await use_some_resource()

        # Now the semaphore has been released.
        print("Worker %d is done" % worker_id)

For compatibility with older versions of Python, `.acquire` is a
context manager, so ``worker`` could also be written as::

    @gen.coroutine
    def worker(worker_id):
        with (yield sem.acquire()):
            print("Worker %d is working" % worker_id)
            yield use_some_resource()

        # Now the semaphore has been released.
        print("Worker %d is done" % worker_id)

.. versionchanged:: 4.3
   Added ``async with`` support in Python 3.5.

c                ó$   <€ V ^8„  d   QhRS[ RR/# ©r   Úvaluer   Nrk   )r   r   s   "€r   r   ÚSemaphore.__annotate__ƒ  s   ø€ ÷ ñ ™cð ¨$ñ r   c                óT   <€ \         SV `  4        V^ 8  d   \        R4      hWn        R# )r   z$semaphore initial value must be >= 0N)Úsuperr$   Ú
ValueErrorr{   ©r#   r¸   rC   s   &&€r   r$   ÚSemaphore.__init__ƒ  s&   ø€ Ü‰ÑÔØ�1Œ9ÜÐCÓDÐDàŽr   c                ó    <€ V ^8„  d   QhRS[ /# r<   r=   )r   r   s   "€r   r   r¹   Š  s   ø€ ÷ *ñ *™#ñ *r   c                óÔ   <€ \         SV `  4       pV P                  ^ 8X  d   RMRV P                   2pV P                  '       d   V R\	        V P                  4       2pRV^R  RV R2# )r   Úlockedzunlocked,value:z	,waiters:rA   z [z]>éÿÿÿÿ)r»   rF   r{   r    rD   )r#   ÚresÚextrarC   s   &  €r   rF   ÚSemaphore.__repr__Š  sk   ø€ Ü‰gÑÓ ˆØ ŸK™K¨1Ô,‘°OÀDÇKÁKÀ=Ð2QˆØ�=�=ˆ=Ø�g˜Y¤s¨4¯=©=Ó'9Ð&:Ð;ˆEØ�3�q˜�9�+˜R ˜w bÐ)Ð)r   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r¹   ‘  s   ø€ ÷ ñ ˜ñ r   c                ó*  € V ;P                   ^,          un         V P                  '       dh   V P                  P                  4       pVP                  4       '       d   KD  V ;P                   ^,          un         VP	                  \        V 4      4       R# R# )ú*Increment the counter and wake one waiter.N)r{   r    rn   r+   r‰   rœ   rT   s   & r   r²   ÚSemaphore.release‘  sb   € à�Š�qÕ�Ø�m�mˆmØ—]‘]×*Ñ*Ó,ˆFØ—;‘;—=”=Ø—’˜qÕ •ð ×!Ñ!Ô":¸4Ó"@ÔAÙñ r   c                óh   <€ V ^8„  d   QhRS[ S[P                  ,          R,          RS[S[,          /# rI   ©rK   rL   rM   r   rœ   )r   r   s   "€r   r   r¹   ¢  s3   ø€ ÷ ñ Ù™x×1Ñ1Õ1°DÕ8ðá	Ñ+Õ	,ñr   c                óŠ  a aaa€ \        4       oS P                  ^ 8”  d6   S ;P                  ^,          un        SP                  \        S 4      4       S# S P                  P                  S4       VeP   R V V3R llp\        P                  P                  4       oSP                  W4      oSP                  VV3R l4       S# )aI  Decrement the counter. Returns an awaitable.

Block if the counter is zero and wait for a `.release`. The awaitable
raises `TimeoutError` after the deadline.

.. versionchanged:: 6.6
   A ``timeout`` argument of zero will either return or raise immediately.
   Previously, zero was treated equivalent to ``None`` (wait forever).
c                ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   Ú'Semaphore.acquire.<locals>.__annotate__¶  s   € ÷ ,ñ , Dñ ,r   c                  ó†   <€ SP                  4       '       g   SP                  \        4       4       S P                  4        R # r*   )r+   Úset_exceptionÚTimeoutErrorr0   rT   s   €€r   rV   Ú%Semaphore.acquire.<locals>.on_timeout¶  s*   ø€ Ø!Ÿ;™;Ÿ=š=Ø×,Ñ,¬\«^Ô<Ø×)Ñ)Ö+r   c                 ó&   <€ SP                  S4      # r*   rY   r[   s   &€€r   r_   Ú#Semaphore.acquire.<locals>.<lambda>¾  s   ø€ ˜g×4Ñ4°^ÔDr   )r	   r{   r‰   rœ   r    ra   r   rb   rc   rd   re   rf   s   f& @@@r   ÚacquireÚSemaphore.acquire¢  s    û€ ô 4:³8ˆØ�;‰;˜Œ?Ø�KŠK˜1Õ�KØ×ÑÔ6°tÓ<Ô=ð ˆð �M‰M× Ñ  Ô(ØÒ"÷,ñ ,ô
 !Ÿ-™-×/Ñ/Ó1�Ø!(×!4Ñ!4°WÓ!I�Ø×(Ñ(ÝDôð ˆr   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r¹   Â  s   ø€ ÷ Oñ O˜4ñ Or   c                ó   € \        R 4      h)z0Use 'async with' instead of 'with' for Semaphore©ÚRuntimeErrorr"   s   &r   r¦   ÚSemaphore.__enter__Â  s   € ÜÐMÓNÐNr   c                ó^   <€ V ^8„  d   QhRRRS[ R,          RS[P                  R,          RR/# )r   Útyprª   r¸   NÚ	tracebackr   r­   )r   r   s   "€r   r   r¹   Å  sC   ø€ ÷ ñ à,ðñ ˜tÕ#ðñ ×&Ñ&¨Õ-ð	ð
 
ñr   c                ó&   € V P                  4        R # r*   ©r¦   )r#   rÝ   r¸   rÞ   s   &&&&r   r³   ÚSemaphore.__exit__Å  ó   € ð 	�‰Ör   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r¹   Í  ó   ø€ ÷ ñ  $ñ r   c              ƒ  óB   "  € V P                  4       G R j  x€L
  R #  L5ir*   ©rÕ   r"   s   &r   Ú
__aenter__ÚSemaphore.__aenter__Í  ó   é € Ø�l‰l‹n×Ôùó   ‚–—c                ó^   <€ V ^8„  d   QhRRRS[ R,          RS[P                  R,          RR/# ©r   rÝ   rª   r¸   NÚtbr   r­   )r   r   s   "€r   r   r¹   Ð  óC   ø€ ÷ ñ à,ðñ ˜tÕ#ðñ ×Ñ $Õ&ð	ð
 
ñr   c              ƒ  ó.   "  € V P                  4        R # 5ir*   ©r²   ©r#   rÝ   r¸   rí   s   &&&&r   Ú	__aexit__ÚSemaphore.__aexit__Ð  ó   é € ð 	�‰Žùó   ‚r…   rv   r*   )r2   r3   r4   r5   r6   r$   rF   r²   rÕ   r¦   r³   rç   rò   r7   r8   Ú__classcell__©rC   r   s   @@r   r   r     sd   ù‡ € ñb÷Hõ ÷*ó *÷ð ÷"ò ÷@Oð O÷ð ÷ð ÷÷ ð r   c                   ó^   a a€ ] tR tRt oRtRV3R lV 3R llltV3R lV 3R lltRtVtV ;t	# )	r   iÙ  a&  A semaphore that prevents release() being called too many times.

If `.release` would increment the semaphore's value past the initial
value, it raises `ValueError`. Semaphores are mostly used to guard
resources with limited capacity, so a semaphore released too many times
is a sign of a bug.
c                ó$   <€ V ^8„  d   QhRS[ RR/# r·   rk   )r   r   s   "€r   r   ÚBoundedSemaphore.__annotate__â  s   ø€ ÷ $ñ $™cð $¨$ñ $r   c                ó4   <€ \         SV `  VR 7       Wn        R# )©r¸   N)r»   r$   Ú_initial_valuer½   s   &&€r   r$   ÚBoundedSemaphore.__init__â  s   ø€ Ü‰Ñ˜uÐÔ%Ø#Ör   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   rú   æ  s   ø€ ÷ ñ ˜ñ r   c                óp   <€ V P                   V P                  8¼  d   \        R4      h\        SV `  4        R# )rÈ   z!Semaphore released too many timesN)r{   rý   r¼   r»   r²   )r#   rC   s   &€r   r²   ÚBoundedSemaphore.releaseæ  s+   ø€ à�;‰;˜$×-Ñ-Ô-ÜÐ@ÓAÐAÜ‰‰Ör   )rý   rv   )
r2   r3   r4   r5   r6   r$   r²   r7   r8   rö   r÷   s   @@r   r   r   Ù  s#   ù‡ € ñ÷$õ $÷÷ ó r   c                   ó¸   a € ] tR tRt o RtV 3R lR ltV 3R lR ltRV 3R lR	 lltV 3R
 lR ltV 3R lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltRtV tR# )r   ií  ag  A lock for coroutines.

A Lock begins unlocked, and `acquire` locks it immediately. While it is
locked, a coroutine that yields `acquire` waits until another coroutine
calls `release`.

Releasing an unlocked lock raises `RuntimeError`.

A Lock can be used as an async context manager with the ``async
with`` statement:

>>> from tornado import locks
>>> lock = locks.Lock()
>>>
>>> async def f():
...    async with lock:
...        # Do something holding the lock.
...        pass
...
...    # Now the lock is released.

For compatibility with older versions of Python, the `.acquire`
method asynchronously returns a regular context manager:

>>> async def f2():
...    with (yield lock.acquire()):
...        # Do something holding the lock.
...        pass
...
...    # Now the lock is released.

.. versionchanged:: 4.3
   Added ``async with`` support in Python 3.5.

c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   ÚLock.__annotate__  s   ø€ ÷ 0ñ 0˜$ñ 0r   c                ó(   € \        ^R7      V n        R# )r(   rü   N)r   Ú_blockr"   s   &r   r$   ÚLock.__init__  s   € Ü&¨QÔ/ˆŽr   c                ó    <€ V ^8„  d   QhRS[ /# r<   r=   )r   r   s   "€r   r   r    s   ø€ ÷ Cñ C™#ñ Cr   c                óP   € R V P                   P                   RV P                   R2# )rA   z _block=rB   )rC   r2   r  r"   s   &r   rF   ÚLock.__repr__  s&   € Ø�4—>‘>×*Ñ*Ð+¨8°D·K±K°=ÀÐBÐBr   Nc                óh   <€ V ^8„  d   QhRS[ S[P                  ,          R,          RS[S[,          /# rI   rË   )r   r   s   "€r   r   r    s3   ø€ ÷ ,ñ ,Ù™x×1Ñ1Õ1°DÕ8ð,á	Ñ+Õ	,ñ,r   c                ó8   € V P                   P                  V4      # )a  Attempt to lock. Returns an awaitable.

Returns an awaitable, which raises `TimeoutError` after a
timeout.

.. versionchanged:: 6.6
   A ``timeout`` argument of zero will either return or raise immediately.
   Previously, zero was treated equivalent to ``None`` (wait forever).
)r  rÕ   )r#   rJ   s   &&r   rÕ   ÚLock.acquire  s   € ð �{‰{×"Ñ" 7Ó+Ð+r   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r  &  s   ø€ ÷ 
8ñ 
8˜ñ 
8r   c                óp   €  V P                   P                  4        R#   \         d    \        R4      hi ; i)zrUnlock.

The first coroutine in line waiting for `acquire` gets the lock.

If not locked, raise a `RuntimeError`.
zrelease unlocked lockN)r  r²   r¼   rÚ   r"   s   &r   r²   ÚLock.release&  s2   € ð	8Ø�K‰K×ÑÖ!øÜô 	8ÜÐ6Ó7Ð7ð	8ús   ‚ ž5c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r  2  s   ø€ ÷ Jñ J˜4ñ Jr   c                ó   € \        R 4      h)z+Use `async with` instead of `with` for LockrÙ   r"   s   &r   r¦   ÚLock.__enter__2  s   € ÜÐHÓIÐIr   c                ó^   <€ V ^8„  d   QhRRRS[ R,          RS[P                  R,          RR/# rì   r­   )r   r   s   "€r   r   r  5  sC   ø€ ÷ ñ à,ðñ ˜tÕ#ðñ ×Ñ $Õ&ð	ð
 
ñr   c                ó&   € V P                  4        R # r*   rà   rñ   s   &&&&r   r³   ÚLock.__exit__5  râ   r   c                ó   <€ V ^8„  d   QhRR/# r   r   )r   r   s   "€r   r   r  =  rä   r   c              ƒ  óB   "  € V P                  4       G R j  x€L
  R #  L5ir*   ræ   r"   s   &r   rç   ÚLock.__aenter__=  ré   rê   c                ó^   <€ V ^8„  d   QhRRRS[ R,          RS[P                  R,          RR/# rì   r­   )r   r   s   "€r   r   r  @  rî   r   c              ƒ  ó.   "  € V P                  4        R # 5ir*   rð   rñ   s   &&&&r   rò   ÚLock.__aexit__@  rô   rõ   )r  r*   )r2   r3   r4   r5   r6   r$   rF   rÕ   r²   r¦   r³   rç   rò   r7   r8   r9   s   @r   r   r   í  s_   ø‡ € ñ"÷H0ð 0÷Cð C÷,ò ,÷
8ð 
8÷Jð J÷ð ÷ð ÷ö r   )r   r   r   r   r   )r   rL   r¯   Úcollections.abcr   Útypingr   r   r   Útornador   r   Útornado.concurrentr	   r
   Ú__all__r   r   r   rœ   r   r   r   r   r   r   Ú<module>r"     s   ðó Û Û Ý %ß &Ñ &ç ß Iâ
I€÷Xñ Xô,j(Ð(ô j(÷Zeñ e÷Pñ ô0xÐ(ô xôv�yô ÷(Yó Yr   