
    ʆh7
                    p    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J	r	J
r
  \
" S5      r " S S\	\   5      rg)	u   :module: watchdog.utils.delayed_queue
:author: thomas.amland@gmail.com (Thomas Amland)
:author: contact@tiger-222.fr (Mickaël Schoentgen)
    )annotationsN)deque)CallableGenericTypeVarTc                  N    \ rS rSrSS jrSS.SS jjrSS jrSS jrSS jrS	r	g
)DelayedQueue   c                    Xl         [        R                  " 5       U l        [        R                  " U R                  5      U l        [        5       U l        SU l        g )NF)		delay_sec	threadingLock_lock	Condition
_not_emptyr   _queue_closed)selfdelays     T/opt/services/DDDS/venv/lib/python3.13/site-packages/watchdog/utils/delayed_queue.py__init__DelayedQueue.__init__   s;    ^^%
#--djj949G    F)r   c                  U R                   R                  5         U R                  R                  U[        R                  " 5       U45        U R
                  R                  5         U R                   R                  5         g)zAdd element to queue.N)r   acquirer   appendtimer   notifyrelease)r   elementr   s      r   putDelayedQueue.put   sQ    

GTYY[%89 

r   c                    SU l         U R                  R                  5         U R                  R                  5         U R                  R	                  5         g)z4Close queue, indicating no more items will be added.TN)r   r   r   r   r    )r   s    r   closeDelayedQueue.close   s9    ! !r   c                    U R                   R                  5         [        U R                  5      S:X  aW  U R                  (       dF  U R                   R                  5         [        U R                  5      S:X  a  U R                  (       d  MF  U R                  (       a  U R                   R                  5         gU R                  S   u  pnU R                   R                  5         U(       al  X R                  -   [        R                  " 5       -
  nUS:  aB  [        R                  " U5        X R                  -   [        R                  " 5       -
  nUS:  a  MB  U R                     [        U R                  5      S:  a:  U R                  S   S   UL a%  U R                  R                  5         UsSSS5        $ SSS5        GM  ! , (       d  f       N= f)zgRemove and return an element from the queue, or this queue has been
closed raise the Closed exception.
r   N)r   r   lenr   r   waitr    r   r   sleepr   popleft)r   headinsert_timer   	time_lefts        r   getDelayedQueue.get'   s=    OO##%dkk"a'$$& dkk"a' ||'')'+{{1~$DuOO##% '..8499;F	!mJJy) +nn <tyy{ JI  !m
 t{{#a'DKKN1,=,EKK'') ) ( s   #A
G
Gc                    U R                      [        U R                  5       H.  u  ntp4U" U5      (       d  M  U R                  U	 Us  sSSS5        $    SSS5        g! , (       d  f       g= f)zORemove and return the first items for which predicate is True,
ignoring delay.
N)r   	enumerater   )r   	predicateielem_s        r   removeDelayedQueue.removeD   sY     ZZ!*4;;!7:DT??AK	 Z!7 
  Z
 s   (AAA
A,)r   r   r   r   r   N)r   floatreturnNone)r!   r   r   boolr:   r;   )r:   r;   )r:   T | None)r3   zCallable[[T], bool]r:   r=   )
__name__
__module____qualname____firstlineno__r   r"   r%   r/   r7   __static_attributes__ r   r   r
   r
      s      05 " :	r   r
   )__doc__
__future__r   r   r   collectionsr   typingr   r   r   r   r
   rC   r   r   <module>rH      s7   
 #    - -CL=71: =r   