ó
    EñiO  ã                  óÂ   • 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
  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)zEAsync wrapper around :class:`ReadWriteLock` for use with ``asyncio``.é    )ÚannotationsN)ÚThreadPoolExecutor)Úasynccontextmanager)ÚTYPE_CHECKINGé   )ÚReadWriteLock)Ú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)Ú AsyncAcquireReadWriteReturnProxyé   zEContext-aware object that releases the async read/write lock on exit.c                ó   • Xl         g ©N©Úlock)Úselfr   s     ÚW/home/mande/repo/quber/.venv/lib/python3.13/site-packages/filelock/_async_read_write.pyÚ__init__Ú)AsyncAcquireReadWriteReturnProxy.__init__   s   € Ø�	ó    c              ƒ  ó"   #   • U R                   $ 7fr   r   ©r   s    r   Ú
__aenter__Ú+AsyncAcquireReadWriteReturnProxy.__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__Ú*AsyncAcquireReadWriteReturnProxy.__aexit__   s   é € ð �i‰i×ÑÓ!×!Ó!ùs   ‚( &¡(r   N)r   ÚAsyncReadWriteLockÚ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:   † ÙOôôð"à,ð"ð (ð"ð (ð	"ð
 
÷"r   r   c                  óF  • \ rS rSrSr 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 j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rg)$r$   é&   a‰  
Async wrapper around :class:`ReadWriteLock` for use in ``asyncio`` applications.

Because Python's :mod:`sqlite3` module has no async API, all blocking SQLite operations are dispatched to a thread
pool via ``loop.run_in_executor()``. Reentrancy, upgrade/downgrade rules, and singleton behavior are delegated
to the underlying :class:`ReadWriteLock`.

:param lock_file: path to the SQLite database file used as the lock
:param timeout: maximum wait time in seconds; ``-1`` means block indefinitely
:param blocking: if ``False``, raise :class:`~filelock.Timeout` immediately when the lock is unavailable
:param is_singleton: if ``True``, reuse existing :class:`ReadWriteLock` instances for the same resolved path
: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.21.0

TN)ÚblockingÚis_singletonÚloopÚexecutorc               ón   • [        XX4S9U l        XPl        US L U l        U=(       d	    [	        SS9U l        g )N)r0   r1   r   )Úmax_workers)r   Ú_lockÚ_loopÚ_owns_executorr   Ú	_executor)r   Ú	lock_fileÚtimeoutr0   r1   r2   r3   s          r   r   ÚAsyncReadWriteLock.__init__9   s6   € ô # 9ÀÑdˆŒ
ØŒ
Ø&¨$Ð.ˆÔØ!×FÔ%7ÀAÑ%Fˆ�r   c                ó.   • U R                   R                  $ )z$:returns: the path to the lock file.)r6   r:   r   s    r   r:   ÚAsyncReadWriteLock.lock_fileH   s   € ð �z‰z×#Ñ#Ð#r   c                ó.   • U R                   R                  $ )z:returns: the default timeout.)r6   r;   r   s    r   r;   ÚAsyncReadWriteLock.timeoutM   s   € ð �z‰z×!Ñ!Ð!r   c                ó.   • U R                   R                  $ )z1:returns: whether blocking is enabled by default.)r6   r0   r   s    r   r0   ÚAsyncReadWriteLock.blockingR   s   € ð �z‰z×"Ñ"Ð"r   c                ó   • U R                   $ )z<:returns: the event loop (or ``None`` for the running loop).)r7   r   s    r   r2   ÚAsyncReadWriteLock.loopW   s   € ð �z‰zÐr   c                ó   • U R                   $ )z5:returns: the executor (or ``None`` for the default).)r9   r   s    r   r3   ÚAsyncReadWriteLock.executor\   s   € ð �~‰~Ðr   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   )r7   ÚasyncioÚget_running_loopÚrun_in_executorr9   Ú	functoolsÚpartial)r   ÚfuncÚargsÚkwargsr2   s        r   Ú_runÚAsyncReadWriteLock._runa   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)©r0   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:`ReadWriteLock.acquire_read` for full semantics.

:param timeout: maximum wait time in seconds; ``-1`` means block indefinitely
:param blocking: if ``False``, raise :class:`~filelock.Timeout` immediately when the lock is unavailable

:returns: a proxy that can be used as an async context manager to release the lock

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

rR   Nr   )rP   r6   Úacquire_readr   ©r   r;   r0   s      r   rT   ÚAsyncReadWriteLock.acquire_reade   s8   é € ð �i‰i˜Ÿ
™
×/Ñ/°ˆiÐL×LÐLÜ/°TÑ:Ð:ñ 	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:`ReadWriteLock.acquire_write` for full semantics.

:param timeout: maximum wait time in seconds; ``-1`` means block indefinitely
:param blocking: if ``False``, raise :class:`~filelock.Timeout` immediately when the lock is unavailable

:returns: a proxy that can be used as an async context manager to release the lock

: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

rR   Nr   )rP   r6   Úacquire_writer   rU   s      r   rY   Ú AsyncReadWriteLock.acquire_writew   s8   é € ð �i‰i˜Ÿ
™
×0Ñ0°'ˆiÐM×MÐMÜ/°TÑ:Ð:ñ 	NùrW   F©Úforcec             ƒ  óh   #   • U R                  U R                  R                  US9I Sh  v•N   g N7f)a
  
Release one level of the current lock.

See :meth:`ReadWriteLock.release` for full semantics.

: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``

r[   N)rP   r6   r   )r   r\   s     r   r   ÚAsyncReadWriteLock.release‰   s'   é € ð �i‰i˜Ÿ
™
×*Ñ*°%ˆiÐ8×8Ó8ùs   ‚(2ª0«2c              ó  #   • Uc  U R                   R                  nUc  U R                   R                  n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.

Falls back to instance defaults for *timeout* and *blocking* when ``None``.

: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

NrR   )r6   r;   r0   rT   r   rU   s      r   Ú	read_lockÚAsyncReadWriteLock.read_lock–   sw   é € ð ‰?Ø—j‘j×(Ñ(ˆGØÑØ—z‘z×*Ñ*ˆHØ×Ñ ÐÐ;×;Ð;ð	!Üà—,‘,“.× Ñ ñ	 	<ñ !ø�$—,‘,“.× Ò üóH   ‚ABÁA+ÁBÁA/ ÁBÁ%A-Á&BÁ-BÁ/B
ÂBÂB
Â
Bc              ó  #   • Uc  U R                   R                  nUc  U R                   R                  n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.

Falls back to instance defaults for *timeout* and *blocking* when ``None``.

: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

NrR   )r6   r;   r0   rY   r   rU   s      r   Ú
write_lockÚAsyncReadWriteLock.write_lock«   sw   é € ð ‰?Ø—j‘j×(Ñ(ˆGØÑØ—z‘z×*Ñ*ˆHØ× Ñ  Ð Ð<×<Ð<ð	!Üà—,‘,“.× Ñ ñ	 	=ñ !ø�$—,‘,“.× Ò ürb   c              ƒ  óÀ   #   • U R                  U R                  R                  5      I Sh  v•N   U R                  (       a  U R                  R                  SS9  gg N07f)zŒ
Release the lock (if held) and close the underlying SQLite connection.

After calling this method, the lock instance is no longer usable.

NF)Úwait)rP   r6   Úcloser8   r9   Úshutdownr   s    r   rh   ÚAsyncReadWriteLock.closeÀ   sK   é € ð �i‰i˜Ÿ
™
×(Ñ(Ó)×)Ð)Ø××Ø�N‰N×#Ñ#¨Ð#Ò/ð ñ 	*ùs   ‚)A«A¬1A)r9   r6   r7   r8   )éÿÿÿÿ)r:   zstr | os.PathLike[str]r;   Úfloatr0   Úboolr1   rm   r2   ú asyncio.AbstractEventLoop | Noner3   úfutures.Executor | Noner%   r&   )r%   Ústr)r%   rl   )r%   rm   )r%   rn   )r%   ro   )rM   zCallable[..., object]rN   ÚobjectrO   rq   r%   rq   )r;   rl   r0   rm   r%   r   )r\   rm   r%   r&   r   )r;   zfloat | Noner0   zbool | Noner%   zAsyncGenerator[None])r%   r&   )r'   r(   r)   r*   r+   r   Úpropertyr:   r;   r0   r2   r3   rP   rT   rY   r   r   r`   rd   rh   r,   r-   r   r   r$   r$   &   sD  † ñð* ðGð
 Ø!Ø15Ø,0ñGà)ðGð ðGð
 ðGð ðGð /ðGð *ðGð 
öGð ó$ó ð$ð ó"ó ð"ð ó#ó ð#ð óó ðð óó ðôdð;È$÷ ;ð ;ð$;È4÷ ;ð ;ð$ .3÷ 9ð ð!ÐW[÷ !ó ð!ð( ð!ÐX\÷ !ó ð!÷(	0r   r$   )r+   Ú
__future__r   rH   rK   Úconcurrent.futuresr   Ú
contextlibr   Útypingr   Ú_read_writer   ÚosÚcollections.abcr	   r
   Ú
concurrentr   Útypesr   r   r$   Ú__all__r-   r   r   Ú<module>r}      sR   ðÙ Kå "ã Û Ý 1Ý *Ý  å &æÛß8Ý"Ý#÷"ñ "÷$c0ñ c0ðN 'Øð�r   