
    {i                        d dl Z d dlZd dlmZmZmZ d dlZd dl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 erdd	lmZ d
eez  dz  defdZdedee         fdZdZe
dddfdedededz  dedz  dedz  ded         defdZdedededefdZ dddefdZ!de"eef         de"eef         ddfd Z#d!eez  d"eez  deez  fd#Z$dS )$    N)TYPE_CHECKINGAnyLiteral)
ModelFieldPydanticSchemaGenerationError	Undefinedannotation_is_pydantic_v1)DefaultPlaceholderDefaultType)FastAPIDeprecationWarningPydanticV1NotSupportedError)	FieldInfo   )v2)APIRoutestatus_codereturnc                 J    | dS | dv rdS t          |           }|dk     p|dv  S )NT>   1XX2XX3XX4XX5XXdefault   >   0        )int)r   current_status_codes     P/root/projects/openclaw-proxy/venv/lib/python3.11/site-packages/fastapi/utils.pyis_body_allowed_for_status_coder"      sM    t    tk**#c)S-@O-STT    pathc                 F    t          t          j        d|                     S )Nz{(.*?)})setrefindall)r$   s    r!   get_path_param_namesr)   +   s    rz)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nametype_r   
field_infoaliasmode)r*   serializationc                 ,   t          |          rt          d|d          |pt          |||          }	 t          j        || |          S # t
          $ r: t          j                            t          
                    |                    d w xY w)NzXpydantic.v1 models are no longer supported by FastAPI. Please update the response model .)
annotationr   r.   )r/   r+   r-   )r,   )r	   r   r   r   r   r   fastapi
exceptionsFastAPIError_invalid_args_messageformat)r+   r,   r   r-   r.   r/   s         r!   create_model_fieldr9   :   s     !'' 
)<16< < <
 
 	
 XyE7RWXXXJ}$TjIIII(    --!((u(55
 
	s   A ABmethodc                     t          j        dt          d           |  | }t          j        dd|          }| d|                                 }|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   r'   sublower)r+   r$   r:   operation_ids       r!   generate_operation_id_for_pathrG   P   sk     M>*	    ?D??L6%l33L"55V\\^^55Lr#   router   c                     | j          | j         }t          j        dd|          }| j        sJ | dt          | j                  d                                          }|S )Nr@   rA   r   )r+   path_formatr'   rD   methodslistrE   )rH   rF   s     r!   generate_unique_idrM   _   sl    j5%"355L6%l33L="EET%-%8%8%;%A%A%C%CEELr#   	main_dictupdate_dictc                 x   |                                 D ]\  }}|| v rGt          | |         t                    r,t          |t                    rt          | |         |           P|| v rKt          | |         t                    r0t          ||         t                    r| |         ||         z   | |<   || |<   d S )N)items
isinstancedictdeep_dict_updaterL   )rN   rO   keyvalues       r!   rT   rT   g   s    !'')) # #
U99S>400 5$''  Ys^U333399S>400 ;s+T22  's^k#.>>IcNN"IcNN# #r#   
first_itemextra_itemsc                 N    | f|z   }|D ]}t          |t                    s|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.
    )rR   r
   )rW   rX   rQ   items       r!   get_value_or_defaultr[   y   sF     MK'E  $ 233 	KKK	r#   )%r'   rB   typingr   r   r   r4   fastapi._compatr   r   r   r	   fastapi.datastructuresr
   r   fastapi.exceptionsr   r   pydantic.fieldsr   _compatr   routingr   r   strboolr"   r&   r)   r7   r9   rG   rM   rS   rT   r[    r#   r!   <module>rf      s   				                       C B B B B B B B U U U U U U U U % % % % % %       "!!!!!!UsT1A Ud U U U U",s ,s3x , , , ,
<  $#'3? 
 4Z D 	
 : /
0    ,%(   j S    #S#X #T#s(^ #PT # # # #$"[0${2 +%     r#   