a
    h
                     @  s  d dl mZ d dlZd dlZd dlmZmZ d dlmZm	Z	 d dl
mZmZmZmZmZmZ d dlmZ ejdkrd dlmZ d d	l
mZ nd dlmZ d d	lmZ d
Zejdk rzd dlmZ W n ey   dZY n0 edZedee f ZedddddZedddddZdddddZedd
dZ G dd dee  ee  ee  Z!G dd deZ"ede"dd Z#G d!d" d"ee# Z$e	d#d$d%d&Z%d'd(d)d*d+Z&dS ),    )annotationsN)	Awaitable	Generator)AbstractAsyncContextManagercontextmanager)AnyCallableGenericProtocolTypeVaroverload)Scope)      )iscoroutinefunction)TypeIsT)r      )BaseExceptionGroupFT.zAwaitableCallable[T]zTypeIs[AwaitableCallable[T]])objreturnc                 C  s   d S N r   r   r   L/var/www/html/assistant/venv/lib/python3.9/site-packages/starlette/_utils.pyis_async_callable   s    r   r   zTypeIs[AwaitableCallable[Any]]c                 C  s   d S r   r   r   r   r   r   r   "   s    c                 C  s.   t | tjr| j} q t| p,t| o,t| jS r   )
isinstance	functoolspartialfuncr   callable__call__r   r   r   r   r   &   s    T_co)	covariantc                   @  s   e Zd ZdS )AwaitableOrContextManagerN)__name__
__module____qualname__r   r   r   r   r$   0       r$   c                   @  s   e Zd ZddddZdS )SupportsAsyncCloseNoner   c                   s   d S r   r   selfr   r   r   close4   r(   zSupportsAsyncClose.closeN)r%   r&   r'   r.   r   r   r   r   r)   3   s   r)   SupportsAsyncCloseType)boundr#   c                   @  sL   e Zd ZdZdddddZddd	d
ZddddZdddddZdS ) AwaitableOrContextManagerWrapperawenteredz!Awaitable[SupportsAsyncCloseType]r*   )r3   r   c                 C  s
   || _ d S r   )r3   )r-   r3   r   r   r   __init__=   s    z)AwaitableOrContextManagerWrapper.__init__z,Generator[Any, None, SupportsAsyncCloseType]r+   c                 C  s
   | j  S r   )r3   	__await__r,   r   r   r   r6   @   s    z*AwaitableOrContextManagerWrapper.__await__r/   c                   s   | j I d H | _| jS r   r2   r,   r   r   r   
__aenter__C   s    z+AwaitableOrContextManagerWrapper.__aenter__r   zNone | bool)argsr   c                   s   | j  I d H  d S r   )r4   r.   )r-   r8   r   r   r   	__aexit__G   s    z*AwaitableOrContextManagerWrapper.__aexit__N)r%   r&   r'   	__slots__r5   r6   r7   r9   r   r   r   r   r1   :   s
   r1   zGenerator[None, None, None]r+   c               
   c  s`   z
d V  W nP t yZ }  z8trBt| trBt| jdkrB| jd } q| W Y d } ~ n
d } ~ 0 0 d S )N   r   )BaseExceptionhas_exceptiongroupsr   r   len
exceptions)excr   r   r   collapse_excgroupsL   s    
rA   r   str)scoper   c                 C  sZ   | d }|  dd}|s|S ||s*|S ||kr6dS |t| dkrV|t|d  S |S )Npath	root_path /)get
startswithr>   )rC   rD   rE   r   r   r   get_route_pathX   s    
rJ   )'
__future__r   r   syscollections.abcr   r   
contextlibr   r   typingr   r   r	   r
   r   r   Zstarlette.typesr   version_infoinspectr   r   ZasyncioZtyping_extensionsr=   Zexceptiongroupr   ImportErrorr   ZAwaitableCallabler   r"   r$   r)   r/   r1   rA   rJ   r   r   r   r   <module>   s@    


 