o
    àej»  ã                   @   sf  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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%dedee fd(d)„Z&ed*d+�d,edefd-d.„ƒZ'dedef dB defd/d0„Z(ed*d+�d,edefd1d2„ƒZ)dedef dB defd3d4„Z*ed*d+�d,edefd5d6„ƒZ+dedef dB defd7d8„Z,dede dB fd9d:„Z-dS );é    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   ú[/var/www/html/choboyeo/PHP/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   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__B   s   z_CallIdentity.__eq__)r2   r3   r4   Ú	__slots__r   r   r<   Úintr?   Úobjectr8   rA   r   r   r   r   r9   9   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_scopesF   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_keyQ   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>r   s
   € 
ÿ
ÿz_uses_scopes.<locals>.<genexpr>)r>   Úgetr+   r*   Ú_is_security_schemeÚanyr#   )rE   rL   Ú	cache_keyÚcachedÚresultr   rV   r   rO   b   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\   z   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   c                 C   s   dd„ | j D ƒS )Nc                 S   s   g | ]	}t |d �r|‘qS )rM   )r\   )rX   Údepr   r   r   Ú
<listcomp>‰   s    z._get_security_dependencies.<locals>.<listcomp>)r#   rM   r   r   r   Ú_get_security_dependenciesˆ   s   rf   i   )Ú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©rh   r   Údunder_callÚdunder_unwrapped_callr   r   r   Ú_is_gen_callable_cachedŒ   ó0   ÿÿþÿþrr   c                 C   ó   | d u rdS t t| ƒƒS ra   )rr   r9   r:   r   r   r   Ú_is_gen_callable¤   ó   ru   c                 C   ri   rj   )r   r   Úisasyncgenfunctionr   r   rm   rn   ro   r   r   r   Ú_is_async_gen_callable_cachedª   rs   rx   c                 C   rt   ra   )rx   r9   r:   r   r   r   Ú_is_async_gen_callableÂ   rv   ry   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 rj   )r   r   Ú	isroutiner   r   r   rm   rn   ro   r   r   r   Ú_is_coroutine_callable_cachedÈ   s0   ÿÿÿ
þr{   c                 C   rt   ra   )r{   r9   r:   r   r   r   Ú_is_coroutine_callableâ   rv   r|   c                 C   s(   | j r| j S t| jƒst| jƒrdS d S )Nr0   )r1   ru   r   ry   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   Ú_UsesScopesCacher9   r5   r7   rI   rU   rO   r\   rc   rf   rr   ru   rx   ry   r{   r|   rS   r   r   r   r   Ú<module>   s`    
"ýþý
üÿÿÿ
þ