o
    h                     @  s   d dl mZ 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ddZdddZG dd deZd ddZd!ddZdS )"    )annotationsN)   
   )	ParamSpecPTargstuple[typing.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%typing.Callable[[], typing.Coroutine]r
   r   c                   s   |  I d H   j   d S N)cancel_scopecancel)r   
task_group i/var/www/html/construction_image-detection-poc/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   typing.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typing.Iterator[T]c                 C  s   zt | W S  ty   tw r   )nextStopIterationr&   )r*   r   r   r   _next,   s
   
r.   typing.Iterable[T]typing.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$   r.   r&   )r*   as_iteratorr   r   r   iterate_in_threadpool6   s   r3   )r   r	   r
   r   )r   r    r   r!   r   r"   r
   r   )r*   r+   r
   r   )r*   r/   r
   r0   )
__future__r   r   systypingr   anyio.to_threadr   version_infor   typing_extensionsr   TypeVarr   r   r%   	Exceptionr&   r.   r3   r   r   r   r   <module>   s     





