o
     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
dejejef ddfdd	Zd
eje
e	f de
jde
jde	fddZG dd deZdeje	 de	fddZdeje	 deje	 fddZdS )    N)   
   )	ParamSpecTPargsreturnc               	      s   t dt t 4 I d H 1 dtjg tjf dd f fdd}| D ]\}} |t	j
|fi | q#W d   I d H  d S 1 I d H sFw   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)cancel_scopecancel)r	   
task_group @/usr/local/lib/python3.10/dist-packages/starlette/concurrency.pyrun   s   z%run_until_first_complete.<locals>.run)warningswarnDeprecationWarninganyiocreate_task_grouptypingCallable	Coroutine
start_soon	functoolspartial)r   r   r	   kwargsr   r   r   run_until_first_complete   s   ".r   r	   r   c                    s2   |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"   iteratorc                 C   s   zt | W S  ty   tw r
   )nextStopIterationr"   r&   r   r   r   _next0   s
   
r*   c                 C  s6   	 zt jt| I d H V  W n
 ty   Y d S w qr
   )r   r   r    r*   r"   r)   r   r   r   iterate_in_threadpool:   s   r+   )r   sysr   r   r   version_infor   typing_extensionsTypeVarr   r   Tupler   dictr   r   r   r!   	Exceptionr"   Iteratorr*   AsyncIteratorr+   r   r   r   r   <module>   s6    


	
