ó
    Eñi "  ã                  ó¶   • S r SSKJr  SSKrSSKrSSKJr  SSKJr  SSK	J
r
  \(       a  SSKrSSKJrJr  SS	KJr  SS
KJr   " S S5      r " S S5      rSS/rg)zIAsync wrapper around :class:`SoftReadWriteLock` for use with ``asyncio``.é    )ÚannotationsN)Úasynccontextmanager)ÚTYPE_CHECKINGé   )ÚSoftReadWriteLock)ÚAsyncGeneratorÚCallable)Úfutures)ÚTracebackTypec                  óF   • \ rS rSrSrSS jrS	S jr        S
S jrSrg)Ú$AsyncAcquireSoftReadWriteReturnProxyé   zTAsync context-aware object that releases an :class:`AsyncSoftReadWriteLock` on exit.c                ó   • Xl         g ©N©Úlock)Úselfr   s     ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/filelock/_soft_rw/_async.pyÚ__init__Ú-AsyncAcquireSoftReadWriteReturnProxy.__init__   s   € Ø�	ó    c              ƒ  ó"   #   • U R                   $ 7fr   r   ©r   s    r   Ú
__aenter__Ú/AsyncAcquireSoftReadWriteReturnProxy.__aenter__   s   é € Ø�y‰yÐùs   ‚c              ƒ  óT   #   • U R                   R                  5       I S h  v•N   g  N7fr   )r   Úrelease)r   Úexc_typeÚ	exc_valueÚ	tracebacks       r   Ú	__aexit__Ú.AsyncAcquireSoftReadWriteReturnProxy.__aexit__   s   é € ð �i‰i×ÑÓ!×!Ó!ùs   ‚( &¡(r   N)r   ÚAsyncSoftReadWriteLockÚreturnÚNone)r$   r#   )r   ztype[BaseException] | Noner   zBaseException | Noner    zTracebackType | Noner$   r%   )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r!   Ú__static_attributes__© r   r   r   r      s:   † Ù^ôôð"à,ð"ð (ð"ð (ð	"ð
 
÷"r   r   c            	      óp  • \ rS rSrSr SSSSSSSSS.                   SS jjjr\SS	 j5       r\SS
 j5       r\SS j5       r	\SS j5       r
\SS j5       r S SS.     S!S jjjr S SS.     S!S jjjrSS.S"S jjr\S SS.S#S jjj5       r\S SS.S#S jjj5       rS$S jrS%S jrSrg)&r#   é%   aŸ  
Async wrapper around :class:`SoftReadWriteLock` for ``asyncio`` applications.

The sync class's blocking filesystem operations run on a thread pool via ``loop.run_in_executor()``.
Reentrancy, upgrade/downgrade rules, fork handling, heartbeat and TTL stale detection, and singleton
behavior are delegated to the underlying :class:`SoftReadWriteLock`.

:param lock_file: path to the lock file; sidecar state/write/readers live next to it
:param timeout: maximum wait time in seconds; ``-1`` means block indefinitely
:param blocking: if ``False``, raise :class:`~filelock.Timeout` immediately on contention
:param is_singleton: if ``True``, reuse existing :class:`SoftReadWriteLock` instances per resolved path
:param heartbeat_interval: seconds between heartbeat refreshes; default 30 s
:param stale_threshold: seconds of mtime inactivity before a marker is stale; defaults to ``3 * heartbeat_interval``
:param poll_interval: seconds between acquire retries under contention; default 0.25 s
:param loop: event loop for ``run_in_executor``; ``None`` uses the running loop
:param executor: executor for ``run_in_executor``; ``None`` uses the default executor

.. versionadded:: 3.27.0

Tg      >@Ng      Ð?)ÚblockingÚis_singletonÚheartbeat_intervalÚstale_thresholdÚpoll_intervalÚloopÚexecutorc          
     óD   • [        UUUUUUUS9U l        X€l        X�l        g )N)r/   r0   r1   r2   r3   )r   Ú_lockÚ_loopÚ	_executor)
r   Ú	lock_fileÚtimeoutr/   r0   r1   r2   r3   r4   r5   s
             r   r   ÚAsyncSoftReadWriteLock.__init__;   s1   € ô 'ØØØØ%Ø1Ø+Ø'ñ
ˆŒ
ð Œ
Ø!�r   c                ó.   • U R                   R                  $ )z>:returns: the path to the lock file passed to the constructor.)r7   r:   r   s    r   r:   Ú AsyncSoftReadWriteLock.lock_fileT   s   € ð �z‰z×#Ñ#Ð#r   c                ó.   • U R                   R                  $ )zf:returns: the default timeout applied when ``acquire_read`` / ``acquire_write`` is called without one.)r7   r;   r   s    r   r;   ÚAsyncSoftReadWriteLock.timeoutY   s   € ð �z‰z×!Ñ!Ð!r   c                ó.   • U R                   R                  $ )zc:returns: whether ``acquire_*`` defaults to blocking; ``False`` makes contention raise immediately.)r7   r/   r   s    r   r/   ÚAsyncSoftReadWriteLock.blocking^   s   € ð �z‰z×"Ñ"Ð"r   c                ó   • U R                   $ )zX:returns: the event loop used for ``run_in_executor``, or ``None`` for the running loop.)r8   r   s    r   r4   ÚAsyncSoftReadWriteLock.loopc   s   € ð �z‰zÐr   c                ó   • U R                   $ )zZ:returns: the executor used for ``run_in_executor``, or ``None`` for the default executor.)r9   r   s    r   r5   ÚAsyncSoftReadWriteLock.executorh   s   € ð �~‰~Ðr   ©r/   c             ƒ  óx   #   • U R                  U R                  R                  XS9I Sh  v•N   [        U S9$  N7f)aë  
Acquire a shared read lock.

See :meth:`SoftReadWriteLock.acquire_read` for the full reentrancy / upgrade / fork semantics. The blocking
work runs inside ``run_in_executor`` so other coroutines on the same loop continue to progress while this
call waits.

:param timeout: maximum wait time in seconds, or ``None`` to use the instance default
:param blocking: if ``False``, raise :class:`~filelock.Timeout` immediately; ``None`` uses the instance default

:returns: a proxy usable as an async context manager to release the lock

:raises RuntimeError: if a write lock is already held, if this instance was invalidated by
    :func:`os.fork`, or if :meth:`close` was called
:raises Timeout: if the lock cannot be acquired within *timeout* seconds

rG   Nr   )Ú_runr7   Úacquire_readr   ©r   r;   r/   s      r   rJ   Ú#AsyncSoftReadWriteLock.acquire_readm   s8   é € ð( �i‰i˜Ÿ
™
×/Ñ/°ˆiÐL×LÐLÜ3¸Ñ>Ð>ñ 	Mùó   ‚(:ª8«:c             ƒ  óx   #   • U R                  U R                  R                  XS9I Sh  v•N   [        U S9$  N7f)aÊ  
Acquire an exclusive write lock.

See :meth:`SoftReadWriteLock.acquire_write` for the two-phase writer-preferring semantics. The blocking
work runs inside ``run_in_executor``.

:param timeout: maximum wait time in seconds, or ``None`` to use the instance default
:param blocking: if ``False``, raise :class:`~filelock.Timeout` immediately; ``None`` uses the instance default

:returns: a proxy usable as an async context manager to release the lock

:raises RuntimeError: if a read lock is already held, if a write lock is held by a different thread, if
    this instance was invalidated by :func:`os.fork`, or if :meth:`close` was called
:raises Timeout: if the lock cannot be acquired within *timeout* seconds

rG   Nr   )rI   r7   Úacquire_writer   rK   s      r   rO   Ú$AsyncSoftReadWriteLock.acquire_write„   s8   é € ð& �i‰i˜Ÿ
™
×0Ñ0°'ˆiÐM×MÐMÜ3¸Ñ>Ð>ñ 	NùrM   F©Úforcec             ƒ  óh   #   • U R                  U R                  R                  US9I Sh  v•N   g N7f)zÓ
Release one level of the current lock.

:param force: if ``True``, release the lock completely regardless of the current lock level

:raises RuntimeError: if no lock is currently held and *force* is ``False``

rQ   N)rI   r7   r   )r   rR   s     r   r   ÚAsyncSoftReadWriteLock.releaseš   s'   é € ð �i‰i˜Ÿ
™
×*Ñ*°%ˆiÐ8×8Ó8ùs   ‚(2ª0«2c              óº   #   • U R                  XS9I Sh  v•N    S7v •  U R                  5       I Sh  v•N   g N# N! U R                  5       I Sh  v•N    f = f7f)aŸ  
Async context manager that acquires and releases a shared read lock.

:param timeout: maximum wait time in seconds, or ``None`` to use the instance default
:param blocking: if ``False``, raise :class:`~filelock.Timeout` immediately; ``None`` uses the instance default

:raises RuntimeError: if a write lock is already held on this instance
:raises Timeout: if the lock cannot be acquired within *timeout* seconds

rG   N)rJ   r   rK   s      r   Ú	read_lockÚ AsyncSoftReadWriteLock.read_lock¥   sN   é € ð ×Ñ ÐÐ;×;Ð;ð	!Üà—,‘,“.× Ñ ñ	 	<ñ !ø�$—,‘,“.× Ò üó<   ‚A•9–A›=  A³;´A»A½AÁAÁAÁAc              óº   #   • U R                  XS9I Sh  v•N    S7v •  U R                  5       I Sh  v•N   g N# N! U R                  5       I Sh  v•N    f = f7f)aÁ  
Async context manager that acquires and releases an exclusive write lock.

:param timeout: maximum wait time in seconds, or ``None`` to use the instance default
:param blocking: if ``False``, raise :class:`~filelock.Timeout` immediately; ``None`` uses the instance default

:raises RuntimeError: if a read lock is already held, or a write lock is held by a different thread
:raises Timeout: if the lock cannot be acquired within *timeout* seconds

rG   N)rO   r   rK   s      r   Ú
write_lockÚ!AsyncSoftReadWriteLock.write_lock·   sN   é € ð × Ñ  Ð Ð<×<Ð<ð	!Üà—,‘,“.× Ñ ñ	 	=ñ !ø�$—,‘,“.× Ò ürX   c              ƒ  ój   #   • U R                  U R                  R                  5      I Sh  v•N   g N7f)zRRelease any held lock and release the underlying filesystem resources. Idempotent.N)rI   r7   Úcloser   s    r   r]   ÚAsyncSoftReadWriteLock.closeÉ   s!   é € à�i‰i˜Ÿ
™
×(Ñ(Ó)×)Ó)ùs   ‚)3«1¬3c              �  óÖ   #   • U R                   =(       d    [        R                  " 5       nUR                  U R                  [
        R                  " U/UQ70 UD65      I S h  v•N $  N7fr   )r8   ÚasyncioÚget_running_loopÚrun_in_executorr9   Ú	functoolsÚpartial)r   ÚfuncÚargsÚkwargsr4   s        r   rI   ÚAsyncSoftReadWriteLock._runÍ   sP   é € Ø�z‰z×7œW×5Ò5Ó7ˆØ×)Ñ)¨$¯.©.¼)×:KÒ:KÈDÐ:bÐSWÒ:bÐ[aÑ:bÓc×cÐcÑcùs   ‚A A)Á"A'Á#A))r9   r7   r8   )éÿÿÿÿ)r:   zstr | os.PathLike[str]r;   Úfloatr/   Úboolr0   rk   r1   rj   r2   úfloat | Noner3   rj   r4   ú asyncio.AbstractEventLoop | Noner5   úfutures.Executor | Noner$   r%   )r$   Ústr)r$   rj   )r$   rk   )r$   rm   )r$   rn   r   )r;   rl   r/   úbool | Noner$   r   )rR   rk   r$   r%   )r;   rl   r/   rp   r$   zAsyncGenerator[None])r$   r%   )re   zCallable[..., object]rf   Úobjectrg   rq   r$   rq   )r&   r'   r(   r)   r*   r   Úpropertyr:   r;   r/   r4   r5   rJ   rO   r   r   rV   rZ   r]   rI   r+   r,   r   r   r#   r#   %   s”  † ñð0 ð"ð
 Ø!Ø$(Ø(,Ø#Ø15Ø,0ñ"à)ð"ð ð"ð
 ð"ð ð"ð "ð"ð &ð"ð ð"ð /ð"ð *ð"ð 
ö"ð2 ó$ó ð$ð ó"ó ð"ð ó#ó ð#ð óó ðð óó ðð
 '+ð?ØGKñ?Ø#ð?Ø9Dð?à	-ö?ð0 '+ð?ØGKñ?Ø#ð?Ø9Dð?à	-ö?ð, .3÷ 	9ð ð!ÐW[÷ !ó ð!ð" ð!ÐX\÷ !ó ð!ô"*÷dr   r#   )r*   Ú
__future__r   r`   rc   Ú
contextlibr   Útypingr   Ú_syncr   ÚosÚcollections.abcr   r	   Ú
concurrentr
   Útypesr   r   r#   Ú__all__r,   r   r   Ú<module>r|      sQ   ðÙ Oå "ã Û Ý *Ý  å $æÛß8Ý"Ý#÷"ñ "÷$jdñ jdð\ +Øð�r   