
    MKic                        S SK Jr  S SKrS SKrS SKrS SKrS SKJr  S SKJ	r	   " S S\R                  5      r " S S\R                  5      r " S	 S
5      rg)    )annotationsN)deque)	monotonicc                  "    \ rS rSrSrSS jrSrg)
AsyncQueue   zhAsync unbounded FIFO queue with a wait() method.

Subclassed from asyncio.Queue, adding a wait() method.c                  #    U R                  5       (       a\  U R                  5       R                  5       nU R                  R	                  U5         UI Sh  vN   U R                  5       (       a  M[  gg N! [
         a    UR                  5          U R                  R                  U5        O! [         a     Of = fU R                  5       (       d0  UR                  5       (       d  U R                  U R                  5        e f = f7f)zIf queue is empty, wait until an item is available.

Copied from Queue.get(), removing the call to .get_nowait(),
ie. this doesn't consume the item, just waits for it.
N)empty	_get_loopcreate_future_gettersappendBaseExceptioncancelremove
ValueError	cancelled_wakeup_next)selfgetters     \/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/langgraph/_internal/_queue.pywaitAsyncQueue.wait   s      jjll^^%335FMM  (	 jjll   MM((0!   zz||F,<,<,>,> %%dmm4s[   ADA7 A5A7 D3D5A7 7DB.-D.
B;8D:B;;A
DD N)returnNone__name__
__module____qualname____firstlineno____doc__r   __static_attributes__r       r   r   r      s    >r$   r   c                  &    \ rS rSrSrSSS jjrSrg)	Semaphore,   z(Semaphore subclass with a wait() method.Nc                d   U(       d  Ub  [        S5      eSnSnU R                     U R                  S:X  a]  U(       d  OWUb%  Uc  [        5       U-   nOU[        5       -
  nUS::  a  O/U R                  R	                  U5        U R                  S:X  a  M]  SnSSS5        U$ ! , (       d  f       U$ = f)z@Block until the semaphore can be acquired, but don't acquire it.Nz.can't specify timeout for non-blocking acquireFr   T)r   _cond_valuer   r   )r   blockingtimeoutrcendtimes        r   r   Semaphore.wait/   s    G/MNNZZ++"&"++"7")IK"7"a<!

( ++"   	 Z 	s   A,B B  
B/r   TN)r+   boolr,   zfloat | Noner   r   r$   r   r&   r&   ,   s    2 r$   r&   c                  l    \ rS rSrSrS rSS jrSS jrSS jrS r	S	 r
\" \R                  5      rS
rg)	SyncQueueF   ziUnbounded FIFO queue with a wait() method.
Adapted from pure Python implementation of queue.SimpleQueue.
c                B    [        5       U l        [        S5      U l        g )Nr   )r   _queuer&   _countr   s    r   __init__SyncQueue.__init__K   s    glr$   Nc                n    U R                   R                  U5        U R                  R                  5         g)zPut the item on the queue.

The optional 'block' and 'timeout' arguments are ignored, as this method
never blocks.  They are provided for compatibility with the Queue class.
N)r6   r   r7   release)r   itemblockr,   s       r   putSyncQueue.putO   s&     	4 r$   c                    Ub  US:  a  [        S5      eU R                  R                  X5      (       d  [        R                  e U R
                  R                  5       $ ! [         a    [        R                  ef = f)a  Remove and return an item from the queue.

If optional args 'block' is true and 'timeout' is None (the default),
block if necessary until an item is available. If 'timeout' is
a non-negative number, it blocks at most 'timeout' seconds and raises
the Empty exception if no item was available within that time.
Otherwise ('block' is false), return an item if one is immediately
available, else raise the Empty exception ('timeout' is ignored
in that case).
r   ''timeout' must be a non-negative number)r   r7   acquirequeueEmptyr6   popleft
IndexErrorr   r>   r,   s      r   getSyncQueue.getX   sl     7Q;FGG{{""522++	;;&&(( 	++	s   A   A;c                b    Ub  US:  a  [        S5      eU R                  R                  X5        g)zPIf queue is empty, wait until an item maybe is available,
but don't consume it.
Nr   rB   )r   r7   r   rH   s      r   r   SyncQueue.waitl   s.     7Q;FGG(r$   c                2    [        U R                  5      S:H  $ )zCReturn True if the queue is empty, False otherwise (not reliable!).r   lenr6   r8   s    r   r
   SyncQueue.emptyt   s    4;;1$$r$   c                ,    [        U R                  5      $ )z9Return the approximate size of the queue (not reliable!).rN   r8   s    r   qsizeSyncQueue.qsizex   s    4;;r$   )r7   r6   r0   )FN)r   r   r    r!   r"   r9   r?   rI   r   r
   rR   classmethodtypesGenericAlias__class_getitem__r#   r   r$   r   r3   r3   F   s8    #()%  $E$6$67r$   r3   )
__future__r   asynciorD   	threadingrU   collectionsr   timer   Queuer   r&   r3   r   r$   r   <module>r^      sG    "       @	## 468 68r$   