o
    	+i^                     @  s   d dl mZ d dlZd dlZd dlmZmZmZmZm	Z	 d dl
mZmZ d dlZedZedZdddZdddZG dd deZd ddZd!ddZdS )"    )annotationsN)AsyncIteratorCallable	CoroutineIterableIterator)	ParamSpecTypeVarPTargstuple[Callable, dict]returnNonec               	     s   t dt t 4 I d H ' d fdd}| D ]\}} |tj|fi | qW d   I d H  d S 1 I d H s<w   Y  d S )	NzOrun_until_first_complete is deprecated and will be removed in a future version.funcCallable[[], Coroutine]r   r   c                   s   |  I d H   j   d S N)cancel_scopecancel)r   
task_group R/var/www/html/psymed-ai/venv/lib/python3.10/site-packages/starlette/concurrency.pyrun   s   z%run_until_first_complete.<locals>.run)r   r   r   r   )warningswarnDeprecationWarninganyiocreate_task_group
start_soon	functoolspartial)r   r   r   kwargsr   r   r   run_until_first_complete   s   .r#   r   Callable[P, T]P.argsr"   P.kwargsc                   s,   t j| g|R i |} tj| 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*   iteratorIterator[T]c                 C  s   zt | W S  ty   tw r   )nextStopIterationr*   )r.   r   r   r   _next'   s
   
r2   Iterable[T]AsyncIterator[T]c                 C s>   t | }	 ztjt|I d H V  W n
 ty   Y d S w qr   )iterr   r'   r(   r2   r*   )r.   as_iteratorr   r   r   iterate_in_threadpool1   s   r7   )r   r   r   r   )r   r$   r   r%   r"   r&   r   r   )r.   r/   r   r   )r.   r3   r   r4   )
__future__r   r    r   collections.abcr   r   r   r   r   typingr   r	   anyio.to_threadr   r
   r   r#   r)   	Exceptionr*   r2   r7   r   r   r   r   <module>   s    



