+
    "i	                    n    R t ^ RIHt ^ RIt^ RIHt ^ RIt^ RIHt ^RI	H
t
 ^RIHt ]t ! R R4      tR# )	The QueueManager class.)annotationsN)	Coroutine)HomeAssistant)HacsExecutionStillInProgress)LOGGERc                  z    ] tR t^tRtR R lt]R R l4       t]R R l4       tR R	 lt	R
 R lt
RR R lltRtR# )QueueManagerr   c                    V ^8  d   QhRRRR/# )   hassr   returnNone )formats   "5/config/custom_components/hacs/utils/queue_manager.py__annotate__QueueManager.__annotate__   s      ] t     c                	.    Wn         . V n        R V n        R# )FNr   queuerunning)selfr   s   &&r   __init__QueueManager.__init__   s    	&(
r   c                   V ^8  d   QhRR/# )r   r   intr   )r   s   "r   r   r      s      s r   c                ,    \        V P                  4      # z-Return a count of pending tasks in the queue.)lenr   r   s   &r   pending_tasksQueueManager.pending_tasks   s     4::r   c                   V ^8  d   QhRR/# )r   r   boolr   )r   s   "r   r   r      s     ' '4 'r   c                     V P                   ^ 8g  # r   )r"   r!   s   &r   has_pending_tasksQueueManager.has_pending_tasks   s     !!Q&&r   c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   r   #   s      t r   c                    . V n         R# )zClear the queue.N)r   r!   s   &r   clearQueueManager.clear#   s	    
r   c                    V ^8  d   QhRRRR/# )r   taskr   r   r   r   )r   s   "r   r   r   '   s        	  d  r   c                <    V P                   P                  V4       R# )zAdd a task to the queue.N)r   append)r   r.   s   &&r   addQueueManager.add'   s    

$r   Nc                    V ^8  d   QhRRRR/# )r   number_of_tasksz
int | Noner   r   r   )r   s   "r   r   r   +   s     ' 'Z '4 'r   c                  "   V P                   '       d   \        P                  R4       \        h\	        V P
                  4      ^ 8X  d   \        P                  R4       R# RV n         \        P                  R4       . pV'       d)   V P
                  RV  F  pVP                  V4       K  	  M$V P
                   F  pVP                  V4       K  	  \        P                  R\	        V4      4       \        P                  ! 4       p\        P                  ! VRR/ G Rj  xL
 pV F1  p\        V\        4      '       g   K  \        P                  RV4       K3  	  \        P                  ! 4       V,
          pV F  pV P
                  P                  V4       K   	  \        P                  R	\	        V4      V4       V P                  '       d*   \        P                  R
\	        V P
                  4      4       RV n         R#  L5i)zExecute the tasks in the queue.z+<QueueManager> Execution is already runningz!<QueueManager> The queue is emptyNTz,<QueueManager> Checking out tasks to executez4<QueueManager> Starting queue execution for %s tasksreturn_exceptionsz<QueueManager> %szM<QueueManager> Queue execution finished for %s tasks finished in %.2f secondsz.<QueueManager> %s tasks remaining in the queueF)r   _LOGGERdebugr   r    r   r0   timeasynciogather
isinstance	Exceptionerrorremover'   )r   r4   local_queuer.   startresultentryends   &&      r   executeQueueManager.execute+   s|    <<<MMGH..tzz?aMM=>DE

#3O4""4( 5 

""4( # 	LcR]N^_		~~{KdKKE%++159  iikE!DJJd#   	[	

 !!!MMJCPTPZPZO\! Ls    BHBH H !HB?Hr   )N)__name__
__module____qualname____firstlineno____doc__r   propertyr"   r'   r+   r1   rE   __static_attributes__r   r   r   r	   r	      sF    !
   ' ' ' 'r   r	   )rK   
__future__r   r:   collections.abcr   r9   homeassistant.corer   
exceptionsr   loggerr   r7   r	   r   r   r   <module>rS      s.     "  %  , 5 
A Ar   