+
    2j;!                        R t ^ RIHt ^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t
 ^RIHt ]
'       d   ^ RIt^ RIHtHt ^ RIHt ^ R	IHt  ! R
 R4      t ! R R4      tRR.tR# )zEAsync wrapper around :class:`ReadWriteLock` for use with ``asyncio``.)annotationsN)ThreadPoolExecutor)asynccontextmanager)TYPE_CHECKING)ReadWriteLock)AsyncGeneratorCallable)futures)TracebackTypec                  >    ] tR t^tRtR R ltR R ltR R ltRtR	# )
 AsyncAcquireReadWriteReturnProxyzEContext-aware object that releases the async read/write lock on exit.c                    V ^8  d   QhRRRR/# )   lockAsyncReadWriteLockreturnNone )formats   ":lib/python3.14/site-packages/filelock/_async_read_write.py__annotate__-AsyncAcquireReadWriteReturnProxy.__annotate__   s      / D     c                	    Wn         R # Nr   )selfr   s   &&r   __init__)AsyncAcquireReadWriteReturnProxy.__init__   s    	r   c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   r      s      "4 r   c                	"   "   V P                   # 5ir   r   r   s   &r   
__aenter__+AsyncAcquireReadWriteReturnProxy.__aenter__   s     yys   c               (    V ^8  d   QhRRRRRRRR/# )	r   exc_typeztype[BaseException] | None	exc_valuezBaseException | None	tracebackzTracebackType | Noner   r   r   )r   s   "r   r   r      s2     " "," (" (	"
 
"r   c                	V   "   V P                   P                  4       G R j  xL
  R #  L5ir   )r   release)r   r%   r&   r'   s   &&&&r   	__aexit__*AsyncAcquireReadWriteReturnProxy.__aexit__   s      ii!!!s   )')r   N)	__name__
__module____qualname____firstlineno____doc__r   r"   r*   __static_attributes__r   r   r   r   r      s    O" "r   r   c            	      X   ] tR t^&tRtR'RRRRRRRR/R R	 lllt]R
 R l4       t]R R l4       t]R R l4       t	]R R l4       t
]R R l4       tR R ltR'RR/R R llltR'RR/R R llltRR/R R llt]R(RR/R R lll4       t]R(RR/R  R! lll4       tR" R# ltR$ R% ltR&tR# ))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``. When ``None`` a dedicated single-thread executor is created
    and owned by this lock, ensuring every operation runs on the same thread (required for SQLite affinity); it
    is shut down by :meth:`close`. A caller-supplied executor is used as-is and never shut down here, so when no
    executor is passed remember to call :meth:`close` to release the owned one.

.. versionadded:: 3.21.0

blockingTis_singletonloopNexecutorc               4    V ^8  d   QhRRRRRRRRRR	R
RRR/# )r   	lock_filezstr | os.PathLike[str]timeoutfloatr3   boolr4   r5    asyncio.AbstractEventLoop | Noner6   zfutures.Executor | Noner   r   r   )r   s   "r   r   AsyncReadWriteLock.__annotate__<   sY     G G)G G
 G G /G *G 
Gr   c               	~    \        WW4R 7      V n        WPn        VRJ V n        T;'       g    \	        ^R7      V n        R# ))r3   r4   N)max_workers)r   _lock_loop_owns_executorr   	_executor)r   r8   r9   r3   r4   r5   r6   s   &&&$$$$r   r   AsyncReadWriteLock.__init__<   s9     #9d

&$.!FF%7A%Fr   c                   V ^8  d   QhRR/# )r   r   strr   )r   s   "r   r   r=   L   s     $ $3 $r   c                .    V P                   P                  # )z$:returns: the path to the lock file.)r@   r8   r!   s   &r   r8   AsyncReadWriteLock.lock_fileK   s     zz###r   c                   V ^8  d   QhRR/# )r   r   r:   r   )r   s   "r   r   r=   Q   s     " " "r   c                .    V P                   P                  # )z:returns: the default timeout.)r@   r9   r!   s   &r   r9   AsyncReadWriteLock.timeoutP   s     zz!!!r   c                   V ^8  d   QhRR/# )r   r   r;   r   )r   s   "r   r   r=   V   s     # #$ #r   c                .    V P                   P                  # )z1:returns: whether blocking is enabled by default.)r@   r3   r!   s   &r   r3   AsyncReadWriteLock.blockingU   s     zz"""r   c                   V ^8  d   QhRR/# )r   r   r<   r   )r   s   "r   r   r=   [   s      6 r   c                    V P                   # )z<:returns: the event loop (or ``None`` for the running loop).)rA   r!   s   &r   r5   AsyncReadWriteLock.loopZ   s     zzr   c                   V ^8  d   QhRR/# )r   r   zfutures.Executorr   )r   s   "r   r   r=   `   s      * r   c                    V P                   # )zi:returns: the executor used for ``run_in_executor`` (a dedicated single-thread one if none was supplied).)rC   r!   s   &r   r6   AsyncReadWriteLock.executor_   s     ~~r   c               (    V ^8  d   QhRRRRRRRR/# )r   funczCallable[..., object]argsobjectkwargsr   r   )r   s   "r   r   r=   d   s0     d d4 dV dv dZ` dr   c                	   "   V P                   ;'       g    \        P                  ! 4       pVP                  V P                  \
        P                  ! V.VO5/ VB 4      G R j  xL
 #  L5ir   )rA   asyncioget_running_looprun_in_executorrC   	functoolspartial)r   rV   rW   rY   r5   s   &&*, r   _runAsyncReadWriteLock._rund   sS     zz77W557))$..):K:KD:bSW:b[a:bccccs   A!A*#A($A*c               $    V ^8  d   QhRRRRRR/# r   r9   r:   r3   r;   r   r   r   )r   s   "r   r   r=   h   s"     ; ;% ;4 ;Ss ;r   c                  "   V P                  V P                  P                  WR7      G Rj  xL
  \        V R7      #  L5i)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

r3   Nr   )r`   r@   acquire_readr   r   r9   r3   s   &&$r   rf   AsyncReadWriteLock.acquire_readh   s8      ii

//iLLL/T:: 	M   +A >A c               $    V ^8  d   QhRRRRRR/# rc   r   )r   s   "r   r   r=   z   s"     ; ;5 ;D ;Tt ;r   c                  "   V P                  V P                  P                  WR7      G Rj  xL
  \        V R7      #  L5i)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

re   Nr   )r`   r@   acquire_writer   rg   s   &&$r   rl    AsyncReadWriteLock.acquire_writez   s8      ii

00'iMMM/T:: 	Nri   forceFc                    V ^8  d   QhRRRR/# )r   rn   r;   r   r   r   )r   s   "r   r   r=      s     9 9d 9t 9r   c               p   "   V P                  V P                  P                  VR7      G Rj  xL
  R#  L5i)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``

)rn   N)r`   r@   r)   )r   rn   s   &$r   r)   AsyncReadWriteLock.release   s'      ii

**%i888s   +646c               $    V ^8  d   QhRRRRRR/# r   r9   zfloat | Noner3   zbool | Noner   zAsyncGenerator[None]r   )r   s   "r   r   r=      s"     ! !| ! !`t !r   c              *  "   Vf   V P                   P                  pVf   V P                   P                  pV P                  WR7      G Rj  xL
   R5x  V P	                  4       G Rj  xL
  R#  L$ L  T P	                  4       G Rj  xL 
  i ; i5i)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

Nre   )r@   r9   r3   rf   r)   rg   s   &&$r   	read_lockAsyncReadWriteLock.read_lock   sw      ?jj((Gzz**H;;;	!,,.  	 	< !$,,.  H   A
BA1BA5 B*A3+B3B5B	B
BBc               $    V ^8  d   QhRRRRRR/# rs   r   )r   s   "r   r   r=      s"     ! ! !+ !au !r   c              *  "   Vf   V P                   P                  pVf   V P                   P                  pV P                  WR7      G Rj  xL
   R5x  V P	                  4       G Rj  xL
  R#  L$ L  T P	                  4       G Rj  xL 
  i ; i5i)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

Nre   )r@   r9   r3   rl   r)   rg   s   &&$r   
write_lockAsyncReadWriteLock.write_lock   sw      ?jj((Gzz**H   <<<	!,,.  	 	= !$,,.  rw   c                   V ^8  d   QhRR/# r   r   r   r   )r   s   "r   r   r=      s     	0 	0T 	0r   c                   "   V P                  V P                  P                  4      G Rj  xL
  V P                  '       d   V P                  P                  RR7       R# R#  L65i)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)r`   r@   closerB   rC   shutdownr!   s   &r   r   AsyncReadWriteLock.close   sN      ii

(()))NN###/  	*s   )A$A"A$!A$c                   V ^8  d   QhRR/# r}   r   )r   s   "r   r   r=      s     0 0 0r   c                	h    \        V R R4      '       d   V P                  P                  RR7       R# R# )rB   Fr   N)getattrrC   r   r!   s   &r   __del__AsyncReadWriteLock.__del__   s.     4)511NN###/ 2r   )rC   r@   rA   rB   )r   )r,   r-   r.   r/   r0   r   propertyr8   r9   r3   r5   r6   r`   rf   rl   r)   r   ru   rz   r   r   r1   r   r   r   r   r   &   s   *G
 G "G 26G -1G G $ $ " " # #    d;$ ; ;$;4 ; ;$9U 9 !W[ ! !( !X\ ! !(	00 0r   r   )r0   
__future__r   r[   r^   concurrent.futuresr   
contextlibr   typingr   _read_writer   oscollections.abcr   r   
concurrentr	   typesr
   r   r   __all__r   r   r   <module>r      sR    K "   1 *   &8"#" "$l0 l0` 'r   