o
    ђh                     @  s   d dl mZ d dlZd dlZd dlZd dlmZmZmZm	Z	 d dl
mZmZ d dlZejdkr6d 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)AsyncIterator	CoroutineIterableIterator)CallableTypeVar)   
   )	ParamSpec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 N/var/www/html/govbot/env/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,   )r0   r   r   r   _next-   s
   
r4   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*   r4   r,   )r0   as_iteratorr   r   r   iterate_in_threadpool7   s   r9   )r   r   r   r   )r   r&   r   r'   r$   r(   r   r   )r0   r1   r   r   )r0   r5   r   r6   )
__future__r   r"   sysr   collections.abcr   r   r   r   typingr   r   anyio.to_threadr   version_infor   typing_extensionsr   r   r%   r+   	Exceptionr,   r4   r9   r   r   r   r   <module>   s"    




