
    mϞiR                        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\  rd d
l mZ nd d
lmZ dedef   dz  defdZdedef   dedef   fdZe G d d             Zy)    N)Callable)	dataclassfield)cached_propertypartial)AnyLiteral)
ModelField)SecurityBase)DependencyCacheKey)      )iscoroutinefunctioncall.returnc                 J    | | S t        j                  t        |             }|S N)inspectunwrap
_impartial)r   	unwrappeds     ]/var/www/html/jploft-chatbot/venv/lib/python3.12/site-packages/fastapi/dependencies/models.py_unwrapped_callr      s%    |z$/0I    funcc                 `    t        | t              r| j                  } t        | t              r| S r   )
isinstancer   r   )r   s    r   r   r      s&    
T7
#yy T7
#Kr   c                      e Zd ZU  ee      Zee   ed<    ee      Zee   ed<    ee      Z	ee   ed<    ee      Z
ee   ed<    ee      Zee   ed<    ee      Zed    ed<   dZedz  ed	<   dZed
ef   dz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZedz  ed<   dZee   dz  ed<   dZee   dz  ed<   dZeed<   dZedz  ed<   dZed   dz  ed<   edee   fd       Z ede!fd       Z"edefd       Z#edefd       Z$ede%fd       Z&eded    fd       Z'edefd        Z(edefd!       Z)edefd"       Z*ededz  fd#       Z+y)$	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scoper   c                     | j                   r| j                   j                         ng }| j                  xs g D ]  }||vs|j                  |        |S r   )r/   copyr.   append)selfscopesr4   s      r   oauth_scopeszDependant.oauth_scopes5   sV    484L4L))..0RT**0b 	%EF"e$	% r   c                     | j                   r+t        t        t        | j                  xs g                   nd}| j
                  || j                  xs dfS )N  )_uses_scopestuplesortedsetr:   r   computed_scope)r8   scopes_for_caches     r   	cache_keyzDependant.cache_key>   sV     <@;L;LE&T..4"567RT 	 II%2
 	
r   c                     | j                   ry| j                  y| j                  ry| j                  D ]  }|j                  s y y)NTF)r.   r-   _is_security_schemer&   r>   )r8   sub_deps     r   r>   zDependant._uses_scopesI   sO      **6##(( 	G##	 r   c                 f    | j                   yt        | j                         }t        |t              S )NF)r   r   r   r   r8   r   s     r   rF   zDependant._is_security_schemeV   s*    99#DII.	)\22r   c                 T    t        | j                        }t        |t              sJ |S r   )r   r   r   r   rI   s     r   _security_schemezDependant._security_scheme^   s&    #DII.	)\222r   c                 \    | j                   D cg c]  }|j                  s| }}|S c c}w r   )r&   rF   )r8   depsecurity_depss      r   _security_dependenciesz Dependant._security_dependenciesd   s/    (,(9(9US=T=TUU Vs   ))c                    | j                   yt        j                  t        | j                               s(t        j                  t	        | j                               ryt        j
                  t	        | j                               ryt        t        | j                         dd       }|yt        j                  t        |            st        j                  t	        |            ryt        t	        | j                         dd       }|yt        j                  t        |            st        j                  t	        |            ryyNFT__call__)r   r   isgeneratorfunctionr   r   isclassgetattrr8   dunder_calldunder_unwrapped_calls      r   is_gen_callablezDependant.is_gen_callablei   s    99&&tyy!
(()CD???49956j3ZF&&{#
(()EF '		(BJPT U (&&,-
((9N)OPr   c                    | j                   yt        j                  t        | j                               s(t        j                  t	        | j                               ryt        j
                  t	        | j                               ryt        t        | j                         dd       }|yt        j                  t        |            st        j                  t	        |            ryt        t	        | j                         dd       }|yt        j                  t        |            st        j                  t	        |            ryyrQ   )r   r   isasyncgenfunctionr   r   rT   rU   rV   s      r   is_async_gen_callablezDependant.is_async_gen_callable   s    99%%tyy!
''		(BC???49956j3ZF%%{#
''(DE '		(BJPT U (%%,-
''8M(NOr   c                    | j                   yt        j                  t        | j                               rt	        t        | j                               ryt        j                  t        | j                               rt	        t        | j                               ryt        j                  t        | j                               ryt        t        | j                         dd       }|yt	        t        |            st	        t        |            ryt        t        | j                         dd       }|yt	        t        |            st	        t        |            ryyrQ   )r   r   	isroutiner   r   r   rT   rU   rV   s      r   is_coroutine_callablezDependant.is_coroutine_callable   s   99Z		238Ktyy!9
 _TYY78=PDII&>
 ???49956j3ZFz+67;NK(<
  '		(BJPT U (,-
 1F!GHr   c                 f    | j                   r| j                   S | j                  s| j                  ryy )Nr3   )r4   rY   r\   )r8   s    r   rB   zDependant.computed_scope   s*    ::::4#=#=r   ),__name__
__module____qualname__r   listr!   r
   __annotations__r"   r#   r$   r%   r&   r'   strr   r   r   r(   r)   r*   r+   r,   r-   r.   r/   r0   boolr1   r4   r	   r   r:   r   rD   r>   rF   r   rK   rO   rY   r\   r_   rB   r<   r   r   r   r      si   $)$$?Kj!?%*4%@L$z"@&+D&AM4
#A&+D&AM4
#A$)$$?Kj!?&+D&AL${#AD#*&*D(38
t
#*%)d
)'+#*+-1d
1&*t*.2t2-1d
1)-d3i$&-,0cT)0ItD#*37E7()D07d3i   
- 
 
 
d 
 
 3T 3 3 ,  
 [(9     2 t  2 t  : d
  r   r   )r   syscollections.abcr   dataclassesr   r   	functoolsr   r   typingr   r	   fastapi._compatr
   fastapi.security.baser   fastapi.typesr   version_infor   asyncior   r   r   r<   r   r   <module>rr      s     
 $ ( .  & . ,w++(38,t3  Xc3h' HS#X,>  a a ar   