o
    ûT·jœ  ã                   @   sT  d dl Z d dlZd dlmZ d dlmZmZ d dlmZm	Z	 d dl
mZmZ d dlmZ d dlmZ d dlmZ ejd	krDd d
l mZ nd d
lmZ dedef dB defdd„Zdedef dedef fdd„Zedd�G dd„ dƒƒZeeeeef f ZdZG dd„ dƒZdede e! fdd„Z"ddœdededB defdd „Z#dd!œded"edB defd#d$„Z$dedefd%d&„Z%dedefd'd(„Z&eed)�d*edefd+d,„ƒZ'dedef dB defd-d.„Z(eed)�d*edefd/d0„ƒZ)dedef dB defd1d2„Z*eed)�d*edefd3d4„ƒZ+dedef dB defd5d6„Z,dede!dB fd7d8„Z-dS )9é    N)ÚCallable)Ú	dataclassÚfield)Ú	lru_cacheÚpartial)ÚAnyÚLiteral)Ú
ModelField)ÚSecurityBase)ÚDependencyCacheKey)é   é   )ÚiscoroutinefunctionÚcall.Úreturnc                 C   s   | d u r| S t  t| ƒ¡}|S ©N)ÚinspectÚunwrapÚ
_impartial)r   Ú	unwrapped© r   ú^/home/dinkstrade/pdmp-scanner/venv/lib/python3.10/site-packages/fastapi/dependencies/models.pyÚ_unwrapped_call   s   r   Úfuncc                 C   s   t | tƒr| j} t | tƒs| S r   )Ú
isinstancer   r   )r   r   r   r   r      s   

ÿr   T)Úslotsc                   @   sr  e Zd ZU eed�Zee ed< eed�Zee ed< eed�Z	ee ed< eed�Z
ee ed< eed�Zee ed< eed�Zed  ed< dZedB ed	< dZed
ef dB ed< dZedB ed< dZedB ed< dZedB ed< dZedB ed< dZedB ed< dZedB ed< dZee dB ed< dZee dB ed< dZeed< dZedB ed< dZed dB ed< dS )Ú	Dependant)Údefault_factoryÚpath_paramsÚquery_paramsÚheader_paramsÚcookie_paramsÚbody_paramsÚdependenciesNÚname.r   Úrequest_param_nameÚwebsocket_param_nameÚhttp_connection_param_nameÚresponse_param_nameÚbackground_tasks_param_nameÚsecurity_scopes_param_nameÚown_oauth_scopesÚparent_oauth_scopesTÚ	use_cacheÚpath)ÚfunctionÚrequestÚscope)Ú__name__Ú
__module__Ú__qualname__r   Úlistr   r	   Ú__annotations__r   r    r!   r"   r#   r$   Ústrr   r   r   r%   r&   r'   r(   r)   r*   r+   r,   r-   Úboolr.   r1   r   r   r   r   r   r      s(   
 r   i   c                   @   sJ   e Zd ZdZdedef ddfdd„Zdefdd	„Zd
e	de
fdd„ZdS )Ú_CallIdentity©r   r   .r   Nc                 C   s
   || _ d S r   r:   )Úselfr   r   r   r   Ú__init__=   ó   
z_CallIdentity.__init__c                 C   s
   t | jƒS r   )Úidr   )r;   r   r   r   Ú__hash__@   r=   z_CallIdentity.__hash__Úotherc                 C   s   t |tƒo
| j|ju S r   )r   r9   r   )r;   r@   r   r   r   Ú__eq__C   s   z_CallIdentity.__eq__)r2   r3   r4   Ú	__slots__r   r   r<   Úintr?   Úobjectr8   rA   r   r   r   r   r9   :   s
    r9   Ú	dependantc                 C   s:   | j r| j  ¡ ng }| jpg D ]}||vr| |¡ q|S r   )r,   Úcopyr+   Úappend)rE   Úscopesr1   r   r   r   Ú_get_oauth_scopesG   s   ÿ
€rI   )Úuses_scopes_cacherJ   c                 C   s<   t | |d�rtttt| d�ƒƒƒnd}| j|t| d�pdfS )N©rE   Úcache©rE   r   Ú )Ú_uses_scopesÚtupleÚsortedÚsetrI   r   Ú_get_computed_scope)rE   rJ   Úscopes_for_cacher   r   r   Ú_get_cache_keyR   s   
ÿýýrU   ©rL   rL   c                    sŽ   ˆ d u ri ‰ t | ƒ}ˆ  |¡}|d ur|d | u r|d S | jr#d}n| jd ur+d}nt| d�r3d}nt‡ fdd„| jD ƒƒ}| |fˆ |< |S )Nr   é   TrM   c                 3   s   � | ]	}t |ˆ d �V  qdS )rK   N)rO   )Ú.0Úsub_deprV   r   r   Ú	<genexpr>s   s
   € 
ÿ
ÿz_uses_scopes.<locals>.<genexpr>)r>   Úgetr+   r*   Ú_is_security_schemeÚanyr#   )rE   rL   Ú	cache_keyÚcachedÚresultr   rV   r   rO   c   s"   


þrO   c                 C   s"   | j d u rdS t| j ƒ}t|tƒS ©NF)r   r   r   r
   ©rE   r   r   r   r   r\   {   s   


r\   c                 C   s   t | jƒ}t|tƒsJ ‚|S r   )r   r   r   r
   rb   r   r   r   Ú_get_security_scheme‚   s   
rc   )ÚmaxsizeÚcall_identityc                 C   ó¬   | j }t t|ƒ¡st t|ƒ¡rdS t t|ƒ¡rdS tt|ƒdd ƒ}|d u r*dS t t|ƒ¡s8t t|ƒ¡r:dS tt|ƒdd ƒ}|d u rHdS t t|ƒ¡pUt t|ƒ¡S ©NTFÚ__call__)r   r   Úisgeneratorfunctionr   r   ÚisclassÚgetattr©re   r   Údunder_callÚdunder_unwrapped_callr   r   r   Ú_is_gen_callable_cached‰   ó0   ÿÿþÿþro   c                 C   ó   | d u rdS t t| ƒƒS ra   )ro   r9   r:   r   r   r   Ú_is_gen_callable¡   ó   rr   c                 C   rf   rg   )r   r   Úisasyncgenfunctionr   r   rj   rk   rl   r   r   r   Ú_is_async_gen_callable_cached§   rp   ru   c                 C   rq   ra   )ru   r9   r:   r   r   r   Ú_is_async_gen_callable¿   rs   rv   c                 C   sÀ   | j }t t|ƒ¡rtt|ƒƒrdS t t|ƒ¡r!tt|ƒƒr!dS t t|ƒ¡r*dS tt|ƒdd ƒ}|d u r8dS tt|ƒƒsDtt|ƒƒrFdS tt|ƒdd ƒ}|d u rTdS tt|ƒƒp_tt|ƒƒS rg   )r   r   Ú	isroutiner   r   r   rj   rk   rl   r   r   r   Ú_is_coroutine_callable_cachedÅ   s0   ÿÿÿ
þrx   c                 C   rq   ra   )rx   r9   r:   r   r   r   Ú_is_coroutine_callableß   rs   ry   c                 C   s(   | j r| j S t| jƒst| jƒrdS d S )Nr0   )r1   rr   r   rv   rM   r   r   r   rS   å   s
   rS   ).r   ÚsysÚcollections.abcr   Údataclassesr   r   Ú	functoolsr   r   Útypingr   r   Úfastapi._compatr	   Úfastapi.security.baser
   Úfastapi.typesr   Úversion_infor   Úasyncior   r   r   ÚdictrC   rP   r8   Ú_UsesScopesCacheÚ#_CALLABLE_CLASSIFICATION_CACHE_SIZEr9   r5   r7   rI   rU   rO   r\   rc   ro   rr   ru   rv   rx   ry   rS   r   r   r   r   Ú<module>   s`    
"ýþý
üÿÿÿ
þ