a
     d                     @   s   d dl Z d dlZd dlZd dlZd dlZejdkr@d dlmZ nd dlmZ edZ	edZ
ejejef ddddZeje
e	f e
je
je	d	d
dZG dd deZeje	 e	dddZeje	 eje	 dddZdS )    N)   
   )	ParamSpecTP)argsreturnc               	      s   t dt t 4 I d H ^ tjg tjf d d fdd}| D ]"\}} |t	j
|fi | qBW d   I d H  q1 I d H s0    Y  d S )NzOrun_until_first_complete is deprecated and will be removed in a future version.)funcr   c                    s   |  I d H   j   d S N)Zcancel_scopecancel)r	   Z
task_group ^/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/starlette/concurrency.pyrun   s    z%run_until_first_complete.<locals>.run)warningswarnDeprecationWarninganyioZcreate_task_grouptypingCallable	CoroutineZ
start_soon	functoolspartial)r   r   r	   kwargsr   r   r   run_until_first_complete   s     r   )r	   r   r   r   c                    s0   |rt j| fi |} tjj| g|R  I d H S r
   )r   r   r   	to_threadrun_sync)r	   r   r   r   r   r   run_in_threadpool#   s    r   c                   @   s   e Zd ZdS )_StopIterationN)__name__
__module____qualname__r   r   r   r   r   ,   s   r   )iteratorr   c                 C   s&   z
t | W S  ty    tY n0 d S r
   )nextStopIterationr   r"   r   r   r   _next0   s    
r&   c                 C  s8   zt jt| I d H V  W q  ty0   Y q4Y q 0 q d S r
   )r   r   r   r&   r   r%   r   r   r   iterate_in_threadpool:   s    r'   )r   sysr   r   r   version_infor   Ztyping_extensionsTypeVarr   r   Tupler   dictr   r   r   r   	Exceptionr   Iteratorr&   AsyncIteratorr'   r   r   r   r   <module>   s$   

	