o
    Th{                     @   s   d dl mZ d dlmZmZmZ d dlZd dlmZ d dlm	Z	 d dlm
Z
 d dlmZ edZed	ee d
eedf fddZdS )    )asynccontextmanager)AsyncGeneratorContextManagerTypeVarN)CapacityLimiter)iterate_in_threadpool)run_in_threadpool)run_until_first_complete_Tcmreturnc                 C  s   t d}zt| jI d H V  W n* ty: } zttjj| jt	||d |dI d H }|s/|W Y d }~d S d }~ww tjj| jd d d |dI d H  d S )N   )limiter)
r   r   	__enter__	Exceptionboolanyio	to_threadrun_sync__exit__type)r   exit_limitereok r   S/home/air/segue/gpt/backup/venv/lib/python3.10/site-packages/fastapi/concurrency.pycontextmanager_in_threadpool   s$   

	r   )
contextlibr   typingr   r   r   r   r   starlette.concurrencyr   r   r	   r
   r   r   r   r   r   <module>   s    
