
    pin                     |   U d dl Z d dlZd dlmZ d dlmZmZmZmZ d dl	m
Z
 d dlZd dlmZmZmZmZmZ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 ddl m!Z! erddl"m#Z#  e
       Z$ee%e   e%e   f   e&d<   dee'e(df   de)fdZ*de(de+e(   fdZ,dZ-deedddddfde(dedee.e(ef      dee   dee)ef   dee%e   df   dee   dee(   ded    d!ed"   defd#Z/dd$d%ed&eee%e   e%e   f      defd'Z0de(de(d(e(de(fd)Z1d*d+de(fd,Z2d-e.eef   d.e.eef   ddfd/Z3d0eeef   d1eeef   deeef   fd2Z4y)3    N)MutableMapping)TYPE_CHECKINGAnyOptionalUnion)WeakKeyDictionary)
BaseConfig
ModelFieldPydanticSchemaGenerationError	UndefinedUndefinedType	Validatorannotation_is_pydantic_v1)DefaultPlaceholderDefaultType)FastAPIDeprecationWarningPydanticV1NotSupportedError)	BaseModel)	FieldInfo)Literal   )v2)APIRoute_CLONED_TYPES_CACHEstatus_codereturnc                 @    | y| dv ryt        |       }|dk  xs |dv  S )NT>   1XX2XX3XX4XX5XXdefault   >   0        )int)r   current_status_codes     O/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/fastapi/utils.pyis_body_allowed_for_status_coder+   '   sA       k*#c)S-@O-STT    pathc                 @    t        t        j                  d|             S )Nz{(.*?)})setrefindall)r-   s    r*   get_path_param_namesr2   8   s    rzz)T*++r,   a  Invalid args for response field! Hint: check that {type_} is a valid Pydantic field type. If you are using a return type annotation that is not a valid Pydantic field (e.g. Union[Response, dict, None]) you can disable generating the response model from the type annotation with the path operation decorator parameter response_model=None. Read more: https://fastapi.tiangolo.com/tutorial/response-model/
validationautonametype_class_validatorsr#   requiredmodel_config
field_infoaliasmode)r3   serializationversion)1r4   c
                     t        |      rt        d|d      |xs i }|xs t        |||      }|| |d}
	 t        j                  di |
S # t
        $ r5 t        j                  j                  t        j                  |            d w xY w)NzXpydantic.v1 models are no longer supported by FastAPI. Please update the response model .)
annotationr#   r;   )r<   r5   r:   )r6    )r   r   r   r   r
   r   fastapi
exceptionsFastAPIError_invalid_args_messageformat)r5   r6   r7   r#   r8   r9   r:   r;   r<   r>   kwargss              r*   create_model_fieldrJ   G   s     !')116	<
 	
 (-2XyE7RWXJD
CF}}&v&&(   --!((u(5
	s   A >B)cloned_typesfieldrK   c                    | S NrC   )rL   rK   s     r*   create_cloned_fieldrO   d   s	    
 Lr,   methodc                     t        j                  dt        d       |  | }t        j                  dd|      }| d|j                          }|S )Nzrfastapi.utils.generate_operation_id_for_path() was deprecated, it is not used internally, and will be removed soon   )messagecategory
stacklevel\W_)warningswarnr   r0   sublower)r5   r-   rP   operation_ids       r*   generate_operation_id_for_pathr]   l   sY     MM>*	 VD6?L66%l3L"^1V\\^$45Lr,   router   c                     | j                    | j                   }t        j                  dd|      }| j                  sJ | dt        | j                        d   j                          }|S )NrV   rW   r   )r5   path_formatr0   rZ   methodslistr[   )r^   r\   s     r*   generate_unique_idrc   {   sg    jj\%"3"3!45L66%l3L==="^1T%--%8%;%A%A%C$DELr,   	main_dictupdate_dictc                    |j                         D ]z  \  }}|| v r3t        | |   t              r t        |t              rt        | |   |       =|| v r5t        | |   t              r"t        ||   t              r| |   ||   z   | |<   v|| |<   | y rN   )items
isinstancedictdeep_dict_updaterb   )rd   re   keyvalues       r*   rj   rj      s    !'') #
U99S>405$'Ys^U399S>40;s+T2&s^k#.>>IcN"IcN#r,   
first_itemextra_itemsc                 H    | f|z   }|D ]  }t        |t              r|c S  | S )z
    Pass items or `DefaultPlaceholder`s by descending priority.

    The first one to _not_ be a `DefaultPlaceholder` will be returned.

    Otherwise, the first item (a `DefaultPlaceholder`) will be returned.
    )rh   r   )rm   rn   rg   items       r*   get_value_or_defaultrq      s7     MK'E $ 23K r,   )5r0   rX   collections.abcr   typingr   r   r   r   weakrefr   rD   fastapi._compatr	   r
   r   r   r   r   r   fastapi.datastructuresr   r   fastapi.exceptionsr   r   pydanticr   pydantic.fieldsr   typing_extensionsr   _compatr   routingr   r   type__annotations__r(   strboolr+   r/   r2   rG   ri   rJ   rO   r]   rc   rj   rq   rC   r,   r*   <module>r      s]   	  *  &    C U  % % !  ^DOT)_$DE 
UsC~1F U4 U",s ,s3x ,
<  8<&+426&*3?$*
 tCN34 c]	
 D-'( Z($./ # C= /
0 [! @ PT >$y/4	?*JKL 	%(j S #S#X #T#s(^ #PT #$(+56*K78 {*+r,   