§
    ‹ŸjlC  ã                   óD  — d dl Z d dlZd dlZd dlmZmZ d dlmZmZ d dl	m
Z
mZmZmZmZ d dl	Z	e	j        rd dl	mZmZ g d¢Z G d„ d¦  «        Z G d	„ d
e¦  «        Z G d„ d¦  «        Z G d„ d¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ d¦  «        ZdS )é    N)ÚgenÚioloop)ÚFutureÚ"future_set_result_unless_cancelled)ÚUnionÚOptionalÚTypeÚAnyÚ	Awaitable)ÚDequeÚSet)Ú	ConditionÚEventÚ	SemaphoreÚBoundedSemaphoreÚLockc                   ó"   — e Zd ZdZdd„Zdd„ZdS )Ú_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....')
    ÚreturnNc                 óD   — t          j        ¦   «         | _        d| _        d S )Nr   )ÚcollectionsÚdequeÚ_waitersÚ	_timeouts©Úselfs    úZ/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/tornado/locks.pyÚ__init__z!_TimeoutGarbageCollector.__init__)   s   € Ý#Ô)Ñ+Ô+ˆŒØˆŒˆˆó    c                 óž   — | xj         dz  c_         | j         dk    r1d| _         t          j        d„ | j        D ¦   «         ¦  «        | _        d S d S )Né   éd   r   c              3   óB   K  — | ]}|                      ¦   «         °|V — Œd S ©N)Údone)Ú.0Úws     r   ú	<genexpr>z<_TimeoutGarbageCollector._garbage_collect.<locals>.<genexpr>2   s/   è è € Ð-WÐ-W°AÈaÏfÊfÉhÌhÐ-W¨aÐ-WÐ-WÐ-WÐ-WÐ-WÐ-Wr   )r   r   r   r   r   s    r   Ú_garbage_collectz)_TimeoutGarbageCollector._garbage_collect-   sU   € àˆŒ˜!ÑˆŒØŒ>˜CÒÐØˆDŒNÝ'Ô-Ð-WÐ-W¸¼Ð-WÑ-WÔ-WÑWÔWˆDŒMˆMˆMð  Ðr   ©r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r)   © r   r   r   r      sL   € € € € € ðð ðð ð ð ðXð Xð Xð Xð Xð Xr   r   c                   ó~   — e Zd ZdZdefd„Z	 ddeeee	j
        f                  dee         fd„Zddeddfd	„Zdd
„ZdS )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`.
    r   c                 ól   — d| j         j        › �}| j        r|dt          | j        ¦  «        z  z  }|dz   S )Nú<z waiters[%s]ú>)Ú	__class__r+   r   Úlen)r   Úresults     r   Ú__repr__zCondition.__repr__q   sA   € Ø.�T”^Ô,Ð.Ð.ˆØŒ=ð 	:Ø�n¥s¨4¬=Ñ'9Ô'9Ñ9Ñ9ˆFØ˜‰|Ðr   NÚtimeoutc                 ó
  ‡ ‡‡‡— t          ¦   «         Š‰ j                             ‰¦  «         |rTdˆ ˆfd„}t          j                             ¦   «         Š‰                     ||¦  «        Š‰                     ˆˆfd„¦  «         ‰S )z”Wait for `.notify`.

        Returns a `.Future` that resolves ``True`` if the condition is notified,
        or ``False`` after a timeout.
        r   Nc                  óx   •— ‰                      ¦   «         st          ‰d¦  «         ‰                      ¦   «          d S ©NF)r%   r   r)   ©r   Úwaiters   €€r   Ú
on_timeoutz"Condition.wait.<locals>.on_timeoutƒ   s<   ø€ Ø—{’{‘}”}ð FÝ6°v¸uÑEÔEÐEØ×%Ò%Ñ'Ô'Ð'Ð'Ð'r   c                 ó.   •— ‰                      ‰¦  «        S r$   ©Úremove_timeout©Ú_Úio_loopÚtimeout_handles    €€r   ú<lambda>z Condition.wait.<locals>.<lambda>Š   s   ø€ ¨w×/EÒ/EÀnÑ/UÔ/U€ r   r*   )r   r   Úappendr   ÚIOLoopÚcurrentÚadd_timeoutÚadd_done_callback©r   r8   r>   rD   rE   r=   s   `  @@@r   ÚwaitzCondition.waitw   s£   øøøø€ õ ‘”ˆØŒ×Ò˜VÑ$Ô$Ð$Øð 		Wð(ð (ð (ð (ð (ð (ð (õ
 ”m×+Ò+Ñ-Ô-ˆGØ$×0Ò0°¸*ÑEÔEˆNØ×$Ò$Ð%UÐ%UÐ%UÐ%UÐ%UÑVÔVÐVØˆr   r!   Únc                 óæ   — g }|rW| j         rP| j                              ¦   «         }|                     ¦   «         s|dz  }|                     |¦  «         |r| j         °P|D ]}t	          |d¦  «         ŒdS )zWake ``n`` waiters.r!   TN)r   Úpopleftr%   rG   r   )r   rN   Úwaitersr=   s       r   ÚnotifyzCondition.notify�   s—   € àˆØð 	'�D”Mð 	'Ø”]×*Ò*Ñ,Ô,ˆFØ—;’;‘=”=ð 'Ø�Q‘�Ø—’˜vÑ&Ô&Ð&ð	 ð 	'�D”Mð 	'ð ð 	=ð 	=ˆFÝ.¨v°tÑ<Ô<Ð<Ð<ð	=ð 	=r   c                 óT   — |                       t          | j        ¦  «        ¦  «         dS )zWake all waiters.N)rR   r5   r   r   s    r   Ú
notify_allzCondition.notify_all™   s$   € à�Š•C˜œÑ&Ô&Ñ'Ô'Ð'Ð'Ð'r   r$   ©r!   r*   )r+   r,   r-   r.   Ústrr7   r   r   ÚfloatÚdatetimeÚ	timedeltar   ÚboolrM   ÚintrR   rT   r/   r   r   r   r   5   s»   € € € € € ð9ð 9ðv˜#ð ð ð ð ð EIðð Ø  e¨XÔ-?Ð&?Ô @ÔAðà	�4Œðð ð ð ð,
=ð 
=˜ð 
= Dð 
=ð 
=ð 
=ð 
=ð(ð (ð (ð (ð (ð (r   r   c                   óˆ   — e Zd ZdZdd„Zdefd„Zdefd„Zdd„Z	dd„Z
	 dd	eeeej        f                  ded         fd
„ZdS )r   až  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
    r   Nc                 ó:   — d| _         t          ¦   «         | _        d S r;   )Ú_valueÚsetr   r   s    r   r   zEvent.__init__Æ   s   € ØˆŒÝ™œˆŒˆˆr   c                 ón   — d                      | j        j        |                      ¦   «         rdnd¦  «        S )Nz<{} {}>r_   Úclear)Úformatr4   r+   Úis_setr   s    r   r7   zEvent.__repr__Ê   s6   € Ø×ÒØŒNÔ#Ø—[’[‘]”]Ð/ˆEˆE¨ñ
ô 
ð 	
r   c                 ó   — | j         S )z-Return ``True`` if the internal flag is true.©r^   r   s    r   rc   zEvent.is_setÐ   s
   € àŒ{Ðr   c                 óŒ   — | j         s:d| _         | j        D ]-}|                     ¦   «         s|                     d¦  «         Œ,dS dS )zƒSet 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_   z	Event.setÔ   s]   € ð
 Œ{ð 	)ØˆDŒKà”}ð )ð )�Ø—x’x‘z”zð )Ø—N’N 4Ñ(Ô(Ð(øð	)ð 	)ð)ð )r   c                 ó   — d| _         dS )zkReset the internal flag to ``False``.

        Calls to `.wait` will block until `.set` is called.
        FNre   r   s    r   ra   zEvent.clearà   s   € ð
 ˆŒˆˆr   r8   c                 ó(  ‡ ‡— t          ¦   «         Š‰ j        r‰                     d¦  «         ‰S ‰ j                             ‰¦  «         ‰                     ˆ fd„¦  «         |€‰S t          j        |‰¦  «        }|                     ˆfd„¦  «         |S )z�Block until the internal flag is true.

        Returns an awaitable, which raises `tornado.util.TimeoutError` after a
        timeout.
        Nc                 ó8   •— ‰j                              | ¦  «        S r$   )r   Úremove)rh   r   s    €r   rF   zEvent.wait.<locals>.<lambda>ô   s   ø€ ¨$¬-×*>Ò*>¸sÑ*CÔ*C€ r   c                 óX   •— ‰                      ¦   «         s‰                     ¦   «         nd S r$   )r%   Úcancel)Útfrh   s    €r   rF   zEvent.wait.<locals>.<lambda>ý   s    ø€ ¨s¯xªx©z¬zÐC˜3Ÿ:š:™<œ<˜<¸t€ r   )r   r^   rg   r   ÚaddrK   r   Úwith_timeout)r   r8   Útimeout_futrh   s   `  @r   rM   z
Event.waitç   s®   øø€ õ ‰hŒhˆØŒ;ð 	Ø�NŠN˜4Ñ Ô Ð ØˆJØŒ×Ò˜#ÑÔÐØ×ÒÐCÐCÐCÐCÑDÔDÐDØˆ?ØˆJåÔ*¨7°CÑ8Ô8ˆKð ×)Ò)ØCÐCÐCÐCñô ð ð Ðr   r*   r$   )r+   r,   r-   r.   r   rV   r7   rZ   rc   r_   ra   r   r   rW   rX   rY   r   rM   r/   r   r   r   r   ž   s×   € € € € € ð%ð %ðNð ð ð ð
˜#ð 
ð 
ð 
ð 
ð˜ð ð ð ð ð
)ð 
)ð 
)ð 
)ðð ð ð ð EIðð Ø  e¨XÔ-?Ð&?Ô @ÔAðà	�4Œðð ð ð ð ð r   r   c                   ód   — e Zd ZdZdeddfd„Zdd„Zddd	ee         d
ee	j
                 ddfd„ZdS )Ú_ReleasingContextManagerz§Releases a Lock or Semaphore at the end of a "with" statement.

    with (yield semaphore.acquire()):
        pass

    # Now semaphore.release() has been called.
    Úobjr   Nc                 ó   — || _         d S r$   )Ú_obj)r   ru   s     r   r   z!_ReleasingContextManager.__init__  s   € ØˆŒ	ˆ	ˆ	r   c                 ó   — d S r$   r/   r   s    r   Ú	__enter__z"_ReleasingContextManager.__enter__  s   € Øˆr   Úexc_typeúOptional[Type[BaseException]]Úexc_valÚexc_tbc                 ó8   — | j                              ¦   «          d S r$   )rw   Úrelease)r   rz   r|   r}   s       r   Ú__exit__z!_ReleasingContextManager.__exit__  s   € ð 	Œ	×ÒÑÔÐÐÐr   r*   )r+   r,   r-   r.   r
   r   ry   r   ÚBaseExceptionÚtypesÚTracebackTyper€   r/   r   r   rt   rt     s›   € € € € € ðð ð˜Cð  Dð ð ð ð ðð ð ð ðà1ðð ˜-Ô(ðð ˜Ô,Ô-ð	ð
 
ðð ð ð ð ð r   rt   c                   ó  ‡ — e Zd ZdZddeddfˆ fd„Zdefˆ fd„Zdd„Z	 dd	e	e
eej        f                  dee         fd
„Zdd„Zddde	e         de	ej                 ddfd„Zdd„Zddde	e         de	ej                 ddfd„Zˆ xZS )r   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.

    r!   Úvaluer   Nc                 ó€   •— t          ¦   «                              ¦   «          |dk     rt          d¦  «        ‚|| _        d S )Nr   z$semaphore initial value must be >= 0)Úsuperr   Ú
ValueErrorr^   ©r   r…   r4   s     €r   r   zSemaphore.__init__  s<   ø€ Ý‰Œ×ÒÑÔÐØ�1Š9ˆ9ÝÐCÑDÔDÐDàˆŒˆˆr   c                 óÔ   •— t          ¦   «                              ¦   «         }| j        dk    rdn	d| j        › �}| j        r|› dt	          | j        ¦  «        › �}d|dd…         › d|› d	�S )
Nr   Úlockedzunlocked,value:z	,waiters:r2   r!   éÿÿÿÿz [z]>)r‡   r7   r^   r   r5   )r   ÚresÚextrar4   s      €r   r7   zSemaphore.__repr__†  s€   ø€ Ý‰gŒg×ÒÑ Ô ˆØ œK¨1Ò,Ð,��Ð2QÀDÄKÐ2QÐ2QˆØŒ=ð 	<ØÐ;Ð;¥s¨4¬=Ñ'9Ô'9Ð;Ð;ˆEØ)�3�q˜�t”9Ð)Ð) Ð)Ð)Ð)Ð)r   c                 ó  — | xj         dz  c_         | j        rj| j                             ¦   «         }|                     ¦   «         s4| xj         dz  c_         |                     t          | ¦  «        ¦  «         dS | j        °hdS dS )ú*Increment the counter and wake one waiter.r!   N)r^   r   rP   r%   rg   rt   r<   s     r   r   zSemaphore.release�  s“   € àˆŒ�qÑˆŒØŒmð 	Ø”]×*Ò*Ñ,Ô,ˆFØ—;’;‘=”=ð 
Ø�”˜qÑ �”ð ×!Ò!Õ":¸4Ñ"@Ô"@ÑAÔAÐAØ�ð Œmð 	ð 	ð 	ð 	ð 	r   r8   c                 ó†  ‡ ‡‡‡— t          ¦   «         Š‰ j        dk    r3‰ xj        dz  c_        ‰                     t          ‰ ¦  «        ¦  «         np‰ j                             ‰¦  «         |rTdˆ ˆfd„}t          j                             ¦   «         Š‰ 	                    ||¦  «        Š‰ 
                    ˆˆfd„¦  «         ‰S )z·Decrement the counter. Returns an awaitable.

        Block if the counter is zero and wait for a `.release`. The awaitable
        raises `.TimeoutError` after the deadline.
        r   r!   r   Nc                  ó¤   •— ‰                      ¦   «         s&‰                     t          j        ¦   «         ¦  «         ‰                      ¦   «          d S r$   )r%   Úset_exceptionr   ÚTimeoutErrorr)   r<   s   €€r   r>   z%Semaphore.acquire.<locals>.on_timeout®  sI   ø€ Ø!Ÿ;š;™=œ=ð AØ×,Ò,­SÔ-=Ñ-?Ô-?Ñ@Ô@Ð@Ø×)Ò)Ñ+Ô+Ð+Ð+Ð+r   c                 ó.   •— ‰                      ‰¦  «        S r$   r@   rB   s    €€r   rF   z#Semaphore.acquire.<locals>.<lambda>¶  s   ø€ ˜g×4Ò4°^ÑDÔD€ r   r*   )r   r^   rg   rt   r   rG   r   rH   rI   rJ   rK   rL   s   `  @@@r   ÚacquirezSemaphore.acquirež  så   øøøø€ õ ‘”ˆØŒ;˜Š?ˆ?ØˆKŒK˜1ÑˆKŒKØ×ÒÕ6°tÑ<Ô<Ñ=Ô=Ð=Ð=àŒM× Ò  Ñ(Ô(Ð(Øð ð,ð ,ð ,ð ,ð ,ð ,ð ,õ
 !œ-×/Ò/Ñ1Ô1�Ø!(×!4Ò!4°W¸jÑ!IÔ!I�Ø×(Ò(ØDÐDÐDÐDÐDñô ð ð ˆr   c                 ó    — t          d¦  «        ‚)Nz0Use 'async with' instead of 'with' for Semaphore©ÚRuntimeErrorr   s    r   ry   zSemaphore.__enter__º  s   € ÝÐMÑNÔNÐNr   Útypr{   Ú	tracebackc                 ó.   — |                       ¦   «          d S r$   ©ry   )r   rš   r…   r›   s       r   r€   zSemaphore.__exit__½  ó   € ð 	�ŠÑÔÐÐÐr   c              ƒ   ó>   K  — |                       ¦   «         ƒ d {V —† d S r$   ©r–   r   s    r   Ú
__aenter__zSemaphore.__aenter__Å  ó,   è è € Ø�lŠl‰nŒnÐÐÐÐÐÐÐÐÐr   Útbc              ƒ   ó2   K  — |                       ¦   «          d S r$   ©r   ©r   rš   r…   r£   s       r   Ú	__aexit__zSemaphore.__aexit__È  ó   è è € ð 	�Š‰Œˆˆˆr   rU   r*   r$   )r+   r,   r-   r.   r[   r   rV   r7   r   r   r   rW   rX   rY   r   rt   r–   ry   r�   r‚   rƒ   r€   r¡   r§   Ú__classcell__©r4   s   @r   r   r     s˜  ø€ € € € € ðbð bðHð ˜cð ¨$ð ð ð ð ð ð ð*˜#ð *ð *ð *ð *ð *ð *ðð ð ð ð$ EIðð Ø  e¨XÔ-?Ð&?Ô @ÔAðà	Ð+Ô	,ðð ð ð ð8Oð Oð Oð Oðà,ðð ˜Ô&ðð ˜EÔ/Ô0ð	ð
 
ðð ð ð ðð ð ð ðà,ðð ˜Ô&ðð �UÔ(Ô)ð	ð
 
ðð ð ð ð ð ð ð r   r   c                   ó:   ‡ — e Zd ZdZddeddfˆ fd„Zd	ˆ fd„Zˆ xZS )
r   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.
    r!   r…   r   Nc                 óZ   •— t          ¦   «                              |¬¦  «         || _        d S )N©r…   )r‡   r   Ú_initial_valuer‰   s     €r   r   zBoundedSemaphore.__init__Ú  s,   ø€ Ý‰Œ×Ò˜uÐÑ%Ô%Ð%Ø#ˆÔÐÐr   c                 ó†   •— | j         | j        k    rt          d¦  «        ‚t          ¦   «                              ¦   «          dS )r�   z!Semaphore released too many timesN)r^   r®   rˆ   r‡   r   )r   r4   s    €r   r   zBoundedSemaphore.releaseÞ  s<   ø€ àŒ;˜$Ô-Ò-Ð-ÝÐ@ÑAÔAÐAÝ‰Œ�ŠÑÔÐÐÐr   rU   r*   )r+   r,   r-   r.   r[   r   r   r©   rª   s   @r   r   r   Ñ  sx   ø€ € € € € ðð ð$ð $˜cð $¨$ð $ð $ð $ð $ð $ð $ðð ð ð ð ð ð ð ð ð r   r   c                   óø   — e Zd ZdZdd„Zdefd„Z	 ddeee	e
j        f                  dee         fd„Zdd„Zdd	„Zd
ddee         deej                 ddfd„Zdd„Zd
ddee         deej                 ddfd„ZdS )r   aÏ  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.

    r   Nc                 ó0   — t          d¬¦  «        | _        d S )Nr!   r­   )r   Ú_blockr   s    r   r   zLock.__init__
  s   € Ý&¨QÐ/Ñ/Ô/ˆŒˆˆr   c                 ó2   — d| j         j        › d| j        › d�S )Nr2   z _block=r3   )r4   r+   r²   r   s    r   r7   zLock.__repr__  s"   € ØB�4”>Ô*ÐBÐB°D´KÐBÐBÐBÐBr   r8   c                 ó6   — | j                              |¦  «        S )z�Attempt to lock. Returns an awaitable.

        Returns an awaitable, which raises `tornado.util.TimeoutError` after a
        timeout.
        )r²   r–   )r   r8   s     r   r–   zLock.acquire  s   € ð Œ{×"Ò" 7Ñ+Ô+Ð+r   c                 ót   — 	 | j                              ¦   «          dS # t          $ r t          d¦  «        ‚w xY w)zŠUnlock.

        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   zLock.release  sK   € ð	8ØŒK×ÒÑ!Ô!Ð!Ð!Ð!øÝð 	8ð 	8ð 	8ÝÐ6Ñ7Ô7Ð7ð	8øøøs   ‚ �7c                 ó    — t          d¦  «        ‚)Nz+Use `async with` instead of `with` for Lockr˜   r   s    r   ry   zLock.__enter__&  s   € ÝÐHÑIÔIÐIr   rš   r{   r…   r£   c                 ó.   — |                       ¦   «          d S r$   r�   r¦   s       r   r€   zLock.__exit__)  rž   r   c              ƒ   ó>   K  — |                       ¦   «         ƒ d {V —† d S r$   r    r   s    r   r¡   zLock.__aenter__1  r¢   r   c              ƒ   ó2   K  — |                       ¦   «          d S r$   r¥   r¦   s       r   r§   zLock.__aexit__4  r¨   r   r*   r$   )r+   r,   r-   r.   r   rV   r7   r   r   rW   rX   rY   r   rt   r–   r   ry   r�   r‚   rƒ   r€   r¡   r§   r/   r   r   r   r   å  si  € € € € € ð"ð "ðH0ð 0ð 0ð 0ðC˜#ð Cð Cð Cð Cð EIð,ð ,Ø  e¨XÔ-?Ð&?Ô @ÔAð,à	Ð+Ô	,ð,ð ,ð ,ð ,ð
8ð 
8ð 
8ð 
8ðJð Jð Jð Jðà,ðð ˜Ô&ðð �UÔ(Ô)ð	ð
 
ðð ð ð ðð ð ð ðà,ðð ˜Ô&ðð �UÔ(Ô)ð	ð
 
ðð ð ð ð ð r   r   )r   rX   r‚   Útornador   r   Útornado.concurrentr   r   Útypingr   r   r	   r
   r   ÚTYPE_CHECKINGr   r   Ú__all__r   r   r   rt   r   r   r   r/   r   r   ú<module>r¿      s  ðð Ð Ð Ð Ø €€€Ø €€€à Ð Ð Ð Ð Ð Ð Ð Ø IÐ IÐ IÐ IÐ IÐ IÐ IÐ Ià 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø €€€à	Ôð "Ø!Ð!Ð!Ð!Ð!Ð!Ð!Ð!à
IÐ
IÐ
I€ðXð Xð Xð Xð Xñ Xô Xð Xð,f(ð f(ð f(ð f(ð f(Ð(ñ f(ô f(ð f(ðRað að að að añ aô að aðHð ð ð ð ñ ô ð ð0tð tð tð tð tÐ(ñ tô tð tðnð ð ð ð �yñ ô ð ð(Uð Uð Uð Uð Uñ Uô Uð Uð Uð Ur   