
   ʀ+(                   ,   	 d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddd	ej	        ej
        g ej        f                  d
ej        e         dej        dej        ej        ej        e         ej        ej        e                  f         fdZdS ))staggered_race    N   )events)
exceptions)locks)tasks)loopcoro_fnsdelayr	   returnc          	      P  	
K   	 pt          j                    t          |           	d d g 
g dt          j        t
          j                 dd f	
fd                     d                     }                    |           	 d}|t                    k    r@t          j                   d {V \  }}t          |          }	 |t                    k    @
fD ]}|                                 S # D ]}|                                 w xY w)Nprevious_failedr   c                   K   | ct          j        t          j                  5  t	          j        |                                 	           d {V  d d d            n# 1 swxY w Y   	 t          
          \  }}n# t          $ r Y d S w xY wt          j
                    }                     |                    }                    |                               d            	  |             d {V }||t                    D ]\  }}||k    r|                                  d S # t          t           f$ r  t"          $ r$}||<   |                                 Y d }~d S d }~ww xY w)N)
contextlibsuppressexceptions_modTimeoutErrorr   wait_forwaitnextStopIterationr   Eventcreate_taskappend	enumeratecancel
SystemExitKeyboardInterruptBaseExceptionset)r   
this_indexcoro_fnthis_failed	next_taskresultiter   enum_coro_fnsr   r	   run_one_cororunning_taskswinner_indexwinner_results            _/nix/store/c6yb989sl77467xxwhylnkph1pqyi47p-python3-3.11.15/lib/python3.11/asyncio/staggered.pyr*   z$staggered_race.<locals>.run_one_coroR   s      &$^%@AA D D
 n_%9%9%;%;UCCCCCCCCCD D D D D D D D D D D D D D D	"&}"5"5J 	 	 	FF	 kmm$$\\+%>%>??	Y''' 	$	"799______F &L"M "-00  1
??HHJJJ % -. 	 	 	 	 	 	%&Jz"OO	s;   .AA"%A"*A= =
B
B*D/ /E.
E))E.r   )r   get_running_loopr   typingOptionalr   r   r   r   lenr   r   done	cancelled	exceptionr   )r
   r   r	   
first_task
done_countr3   _dr'   r)   r   r*   r+   r,   r-   s    ``      @@@@@@r.   r   r      s     1f ,6*,,Dh''MMLJM.#_U[9.>B. . . . . . . . . . . . .` !!,,t"4"455J$$$ 
C....!J}55555555GD!TJ, C.... lJ6  	 	AHHJJJJ	 	 	AHHJJJJ	s   AD
 
D%)__all__r   r0    r   r   r   r   r   IterableCallable	Awaitabler1   floatAbstractEventLoopTupleAnyintList	Exceptionr        r.   <module>rH      s   L
            * * * * * *             *.	G G G/&/"f6F2F"GHGu%G &	G
 \
J
OC
K	*+,G G G G G GrG   