HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib64/python3.10/site-packages/fastapi/__pycache__/routing.cpython-310.pyc
o

�hX��"@s�ddlZddlZddlZddlZddlZddlmZmZddl	m
Z
mZddlm
Z
mZmZmZmZmZmZmZmZmZmZmZmZddlmZddlmZmZmZm Z m!Z!m"Z"ddl#m$Z$m%Z%ddl&m'Z'dd	l(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/dd
l0m1Z1ddl2m3Z3m4Z4m5Z5m6Z6ddl7m8Z8m9Z9dd
l:m;Z;m<Z<m=Z=m>Z>m?Z?ddl@mAZAddlBmCZCddlDmEZEddlFmGZGddlHmIZIddlJmKZKmLZLddlMmNZNmOZOmPZPmQZQmRZRmSZSddlMmTZTddlUmVZVmWZWmXZXmYZYddlZm[Z[ddl\m]Z]m^Z^m_Z_ddd�de
de`de`de`de
f
d d!�Zad"eXe
d#eXe
deXe
fd$d%�Zbdddd&dddd&d'�d(eed)e
d*ee9d+ee9d,e`de`de`de`d-e`de
fd.d/�Zcd0e'd1eede
fd-e`de
fd2d3�Zedde$eK�dddd&dddddfd0e'd4eed5eefd6eeeLe%fd7eed8ee9d9ee9d:e`d;e`d<e`d=e`d>ee
d?e`deeIgee
e
eLfffd@dA�Zg		dJd0e'd>ee
d?e`dee[gee
e
e
fffdBdC�ZhGdDdE�dEeCji�ZjGdFdG�dGeCjk�ZlGdHdI�dIeCjm�ZndS)K�N)�AsyncExitStack�asynccontextmanager)�Enum�IntEnum)
�Any�
AsyncIterator�Callable�	Coroutine�Dict�List�Mapping�Optional�Sequence�Set�Tuple�Type�Union)�params)�
ModelField�	Undefined�_get_model_config�_model_dump�_normalize_errors�lenient_issubclass)�Default�DefaultPlaceholder)�	Dependant)�_should_embed_body_fields�get_body_field�
get_dependant�get_flat_dependant�get_parameterless_sub_dependant�get_typed_return_annotation�solve_dependencies)�jsonable_encoder)�FastAPIError�RequestValidationError�ResponseValidationError�WebSocketRequestValidationError)�DecoratedCallable�IncEx)�create_cloned_field�create_model_field�generate_unique_id�get_value_or_default�is_body_allowed_for_status_code)�	BaseModel)�routing)�run_in_threadpool)�
HTTPException)�Request)�JSONResponse�Response)�	BaseRoute�Match�compile_path�get_name�request_response�websocket_session)�Mount)�AppType�ASGIApp�Lifespan�Scope��	WebSocket)�	Annotated�Doc�
deprecatedF)�exclude_defaults�exclude_none�res�
exclude_unsetrGrH�returncs�t|t�rtt|�dd�}|r|St|d���d�St|t�r*���fdd�|D�St|t�r<���fdd�|��D�St�	|�rFt�
|�S|S)N�read_with_orm_modeT)�by_aliasrJrGrHcsg|]
}t|���d��qS��rJrGrH��_prepare_response_content)�.0�item�rGrHrJ��E/usr/local/CyberPanel/lib/python3.10/site-packages/fastapi/routing.py�
<listcomp>fs���z-_prepare_response_content.<locals>.<listcomp>c	s"i|]
\}}|t|���d��qSrNrP)rR�k�vrTrUrV�
<dictcomp>ps���z-_prepare_response_content.<locals>.<dictcomp>)�
isinstancer0�getattrrr�list�dict�items�dataclasses�is_dataclass�asdict)rIrJrGrHrLrUrTrVrQOs,
�
�
	�
	
rQ�original_context�nested_contextc	s0tdtdtttttff��fdd��}|S)N�apprKc
s���|�4IdH�A}�|�4IdH�"}|dur|durdVni|p#i�|p'i�VWd�IdHn1IdHs:wYWd�IdHdS1IdHsPwYdS�NrU)re�maybe_original_state�maybe_nested_state�rdrcrUrV�merged_lifespan�s��*�.�z0_merge_lifespan_context.<locals>.merged_lifespan)rr>rr
r�strr)rcrdrjrUrirV�_merge_lifespan_context~s��
rlT)�field�include�excluderMrJrGrH�is_coroutinerm�response_contentrnrorMrpc		�s��|reg}	t|d�st||||d�}|r|j|idd�\}
}nt|j|idd�IdH\}
}t|t�r8|	�|�n|r?|	�|�|	rItt	|	�|d��t|d�rZ|j
|
||||||d�St|
||||||d�St|�S)N�	serializerO)�response)�loc)�errors�body)rnrorMrJrGrH)�hasattrrQ�validater2r[r]�extend�appendr'rrrr$)rmrqrnrorMrJrGrHrpru�value�errors_rUrUrV�serialize_response�sV�
�
�

�
�
�
r}�	dependant�valuesc�sF�|jdus
Jd��|r|jdi|��IdHSt|jfi|��IdHS)N�!dependant.call must be a functionrU)�callr2�r~rrprUrUrV�run_endpoint_function�s
�r��
body_field�status_code�response_class�response_field�response_model_include�response_model_exclude�response_model_by_alias�response_model_exclude_unset�response_model_exclude_defaults�response_model_exclude_none�dependency_overrides_provider�embed_body_fieldsc
s|�jdus	Jd��t��j���ot�jtj��t|t�r!|j�n|�dt	dt
f����������	�
���
�fdd�}
|
S)Nr��requestrKc
�s��d}t�4IdH��O}z]d}�rh�r!|��IdH}|�|j�nG|��IdH}|rht}|j�d�}|s<|��IdH}n#t	j
��}||d<|��dkr_|�
�}|dksX|�d�r_|��IdH}|tkrf|}n|}Wn?tjy�}	ztdd|	jfdid|	jid	�g|	jd
�}
|
|	�d}	~	wty��ty�}	z	tddd
�}||	�d}	~	wwg}t�4IdH��}
t|�|�|
�d�IdH}|j}|�s-t�|j�d�IdH}t|t�r�|jdur�|j|_|}nKd|ji}�r�n|jj}|dur�||d<|jj�r|jj|d<t �|�
�	���
��d�	IdH}�|fi|��}t!|j��s#d|_|jj"�#|jjj"�Wd�IdHn1IdH�s>wY|�rPtt$|�|d
�}
|
�Wd�IdHn1IdH�sawY|du�rot%d��|S)Nzcontent-type�application�jsonz+json�json_invalidrvzJSON decode error�error)�typert�msg�input�ctx)rvi�z#There was an error parsing the body)r��detail)r�r~rvr��async_exit_stackr�r��
backgroundr�)	rmrqrnrorMrJrGrHrp�a}No response object was returned. There's a high chance that the application code is raising an exception and a dependency with yield has a block with a bare except, or a block with except Exception, and is not raising the exception again. Read more about it in the docs: https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-with-yield/#dependencies-with-yield-and-except)&r�form�push_async_callback�closervr�headers�getr��email�message�Message�get_content_maintype�get_content_subtype�endswith�JSONDecodeErrorr&�posr��docr3�	Exceptionr#rur�rr[r6r��background_tasksrsr�r}r/�rawryrr%)r�rs�
file_stackrv�
body_bytes�	json_body�content_type_valuer��subtype�e�validation_error�
http_errorrur��
solved_result�raw_response�
response_args�current_status_code�content��actual_response_classr�r~r�r��is_body_formrpr�r�r�r�r�r�r�r�rUrVre�s��
���	�������

���
���*�4�*�
i�z get_request_handler.<locals>.app)r��asyncio�iscoroutinefunctionr[�
field_infor�Formrr{r4r6)r~r�r�r�r�r�r�r�r�r�r�r�r�rerUr�rV�get_request_handler�s
2ur�csdtddf���fdd�}|S)N�	websocketrKc	�s��t�4IdH�<}||jd<t|��|�d�IdH}|jr$tt|j����jdus-Jd���jdi|j��IdHWd�IdHdS1IdHsJwYdS)N�fastapi_astack)r�r~r�r�r�r�rU)r�scoper#rur(rr�r)r�r�r��r~r�r�rUrVrems"�
��.�zget_websocket_app.<locals>.apprB)r~r�r�rerUr�rV�get_websocket_apphsr�c
steZdZdddd�dededefdeedeeej	deed	dfd
d�Z
ded	ee
eff�fd
d�Z�ZS)�APIWebSocketRouteN)�name�dependenciesr��path�endpoint.r�r�r�rKcCs�||_||_|durt|�n||_t|pg�|_t|�\|_|_|_	t
|j|jd�|_|jddd�D]}|jj�dt
||jd��q3t|j�|_t|jj�|_tt|j||jd��|_dS)N�r�r����r��dependsr�r�)r�r�r:r�r]r�r9�
path_regex�path_format�param_convertorsrr~�insertr!r �_flat_dependantr�body_params�_embed_body_fieldsr<r�re)�selfr�r�r�r�r�r�rUrUrV�__init__�s,	���
�zAPIWebSocketRoute.__init__r�c�*t��|�\}}|tjkr||d<||fS�N�route��super�matchesr8�NONE�r�r��match�child_scope��	__class__rUrVr���
zAPIWebSocketRoute.matches)�__name__�
__module__�__qualname__rkrrr
rr�Dependsr�rArr8r��
__classcell__rUrUr�rVr��s$��
����
�& r�c8s�eZdZed�ddddddddddddddddddee�dddee�d�dededefd	ed
e	e
de	eeee
fde	eejd
e	ede	edede	eee
efeeeffde	ede	ede	eeeeefde	ede	ede	ededededededeeeefde	ede	eede	eeefd eedgefefd!df6d"d#�Zd!eegeeeefffd$d%�Zd&ed!eeeff�fd'd(�Z �Z!S))�APIRouteN�Successful ResponseTF)�response_modelr��tagsr��summary�description�response_description�	responsesrFr��methods�operation_idr�r�r�r�r�r��include_in_schemar�r��	callbacks�
openapi_extra�generate_unique_id_functionr�r�.r�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rKc$Cs�||_||_t|t�rt|�}t|t�rd}n|}||_||_|	|_	||_
||_||_||_
||_||_||_||_||_||_||_||_||_||_|pOg|_|
pTi|_|dur^t|�n||_t|�\|_|_|_|
durrdg}
dd�|
D�|_ t|t�r�|j!}n|}|jp�||�|_"t|t#�r�t$|�}||_%|jr�t&|�s�Jd|�d���d|j"}t'||jdd�|_(t)|j(�|_*nd|_(d|_*t+|p�g�|_,|p�t-�.|jj/p�d	�|_0|j0�1d
�d�2�|_0i}|j�3�D]6\}} t| t4�s�Jd��| �5d
�}!|!�rt&|��s
Jd|�d���d|�d|j"��}t'||!dd�}"|"||<q�|�r&||_6ni|_6t7|��s2Jd��t8|j|jd�|_9|j,ddd�D]}#|j9j,�:dt;|#|jd���qCt<|j9�|_=t>|j=j?�|_@tA|j=|j"|j@d�|_BtC|�D��|_EdS)N�GETcSsh|]}|���qSrU)�upper)rR�methodrUrUrV�	<setcomp>�sz$APIRoute.__init__.<locals>.<setcomp>zStatus code z must not have a response body�	Response_�
serialization)r��type_�mode��rz%An additional response must be a dict�model�_zAn endpoint must be a callabler�r�r�)�flat_dependantr�r�)Fr�r�r[rr"rr6r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r:r�r9r�r�r�r�r{�	unique_idr�intr�r/r,r�r+�secure_cloned_response_fieldr]r��inspect�cleandoc�__doc__r��split�stripr_r^r��response_fields�callablerr~r�r!r r�rr�r�rr�r;�get_route_handlerre)$r�r�r�r�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r�r�r��return_annotation�current_generate_unique_id�
response_namer�additional_status_codersrr�r�rUrUrVr��s�"




�


�
��

������zAPIRoute.__init__cCs<t|j|j|j|j|j|j|j|j|j	|j
|j|j|j
d�
S)N)
r~r�r�r�r�r�r�r�r�r�r�r�r�)r�r~r�r�r�r	r�r�r�r�r�r�r�r�)r�rUrUrVr;s�zAPIRoute.get_route_handlerr�cr�r�r�r�r�rUrVr�Lr�zAPIRoute.matches)"r�r�r�rr5r-rkrrr
rrrrrrr�r
�boolrr*rr6rr7r�r4r	rrArr8r�r�rUrUr�rVr��s����
�����	�
���
�������������
����!
�"&r�c8s�eZdZdZdddee�ddddddedddddee�d�dee	e
d�fdeeee
e	efe
d	�fd
eeeeje
d�fdeeee
d
�fdeeee
ee	fee	effe
d�fdeeeee
d�fdeeeee
d�ed�fdeee
d�fdeeee
d�fdeeee
d�fdeeee
d�fdeeeegefe
d�fdeeeegefe
d �fd!eeeee
d"�fd#eeee
d$�fd%eee
d&�fd'eeege	fe
d(�fd)df$�fd*d+�Z			d�d,e	d-eee	d.ee	d%ed)eegeff
d/d0�Zed�dddddd1dddddddd2d2d2dee�ddddee�d3�d,e	d4ed5efd6ed7eedeee
e	efd
eeejd8ee	d9ee	d:e	deee
ee	fee	effd#eed-ee
e e	ee	fd;ee	d<ee!d=ee!d>ed?ed@edAed%edBe
eee"fd.ee	dCeeedeeedDeee	efd'e
eege	fe"fd)df6dEdF�Z#ed�dddddd1dddddddd2d2d2dee�dddee�dG�d,e	d6ed7eedeee
e	efd
eeejd8ee	d9ee	d:e	deee
ee	fee	effd#eed-eee	d;ee	d<ee!d=ee!d>ed?ed@edAed%edBeed.ee	deeedDeee	efd'eege	fd)eegeff2dHdI�Z$	d�ddJ�d,e	d4ed5efd.ee	d
eeejd)df
dKdL�Z%	d�ddJ�d,ee	e
dM�fd.eee	e
dN�fd
eeeeje
dO�fd)eegeffdPdQ�Z&	d�d,e	d.e
e	dfd)eegeffdRdS�Z'dddee�ddddee�dT�	dUede
dV�fdee	e
d�fdeeee
e	efe
d	�fd
eeeeje
d�fdeeee
d
�fdeeee
ee	fee	effe
d�fdeeeee
d�fd#eeee
d$�fd%eee
dW�fd'eeege	fe
d(�fd)dfdXdY�Z(ed�dddddd1ddddddd2d2d2dee�dddee�dZ�d,ee	e
d[�fd6eee
d\�fd7eeee
d]�fdeeee
e	efe
d^�fd
eeeeje
d_�fd8eee	e
d`�fd9eee	e
da�fd:ee	e
db�fdeeee
ee	fee	effe
dc�fd#eeee
dd�fd;eee	e
de�fd<eee!e
df�fd=eee!e
dg�fd>eee
dh�fd?eee
di�fd@eee
dj�fdAeee
dk�fd%eee
dl�fdBeeee
dm�fd.eee	e
dn�fdeeeee
do�fdDeeee	efe
dp�fd'eeege	fe
d(�fd)eegeff0dqdr�Z)ed�dddddd1ddddddd2d2d2dee�dddee�dZ�d,ee	e
d[�fd6eee
d\�fd7eeee
d]�fdeeee
e	efe
d^�fd
eeeeje
d_�fd8eee	e
d`�fd9eee	e
da�fd:ee	e
db�fdeeee
ee	fee	effe
dc�fd#eeee
dd�fd;eee	e
de�fd<eee!e
df�fd=eee!e
dg�fd>eee
dh�fd?eee
di�fd@eee
dj�fdAeee
dk�fd%eee
dl�fdBeeee
dm�fd.eee	e
dn�fdeeeee
do�fdDeeee	efe
dp�fd'eeege	fe
d(�fd)eegeff0dsdt�Z*ed�dddddd1ddddddd2d2d2dee�dddee�dZ�d,ee	e
d[�fd6eee
d\�fd7eeee
d]�fdeeee
e	efe
d^�fd
eeeeje
d_�fd8eee	e
d`�fd9eee	e
da�fd:ee	e
db�fdeeee
ee	fee	effe
dc�fd#eeee
dd�fd;eee	e
de�fd<eee!e
df�fd=eee!e
dg�fd>eee
dh�fd?eee
di�fd@eee
dj�fdAeee
dk�fd%eee
dl�fdBeeee
dm�fd.eee	e
dn�fdeeeee
do�fdDeeee	efe
dp�fd'eeege	fe
d(�fd)eegeff0dudv�Z+ed�dddddd1ddddddd2d2d2dee�dddee�dZ�d,ee	e
d[�fd6eee
d\�fd7eeee
d]�fdeeee
e	efe
d^�fd
eeeeje
d_�fd8eee	e
d`�fd9eee	e
da�fd:ee	e
db�fdeeee
ee	fee	effe
dc�fd#eeee
dd�fd;eee	e
de�fd<eee!e
df�fd=eee!e
dg�fd>eee
dh�fd?eee
di�fd@eee
dj�fdAeee
dk�fd%eee
dl�fdBeeee
dm�fd.eee	e
dn�fdeeeee
do�fdDeeee	efe
dp�fd'eeege	fe
d(�fd)eegeff0dwdx�Z,ed�dddddd1ddddddd2d2d2dee�dddee�dZ�d,ee	e
d[�fd6eee
d\�fd7eeee
d]�fdeeee
e	efe
d^�fd
eeeeje
d_�fd8eee	e
d`�fd9eee	e
da�fd:ee	e
db�fdeeee
ee	fee	effe
dc�fd#eeee
dd�fd;eee	e
de�fd<eee!e
df�fd=eee!e
dg�fd>eee
dh�fd?eee
di�fd@eee
dj�fdAeee
dk�fd%eee
dl�fdBeeee
dm�fd.eee	e
dn�fdeeeee
do�fdDeeee	efe
dp�fd'eeege	fe
d(�fd)eegeff0dydz�Z-ed�dddddd1ddddddd2d2d2dee�dddee�dZ�d,ee	e
d[�fd6eee
d\�fd7eeee
d]�fdeeee
e	efe
d^�fd
eeeeje
d_�fd8eee	e
d`�fd9eee	e
da�fd:ee	e
db�fdeeee
ee	fee	effe
dc�fd#eeee
dd�fd;eee	e
de�fd<eee!e
df�fd=eee!e
dg�fd>eee
dh�fd?eee
di�fd@eee
dj�fdAeee
dk�fd%eee
dl�fdBeeee
dm�fd.eee	e
dn�fdeeeee
do�fdDeeee	efe
dp�fd'eeege	fe
d(�fd)eegeff0d{d|�Z.ed�dddddd1ddddddd2d2d2dee�dddee�dZ�d,ee	e
d[�fd6eee
d\�fd7eeee
d]�fdeeee
e	efe
d^�fd
eeeeje
d_�fd8eee	e
d`�fd9eee	e
da�fd:ee	e
db�fdeeee
ee	fee	effe
dc�fd#eeee
dd�fd;eee	e
de�fd<eee!e
df�fd=eee!e
dg�fd>eee
dh�fd?eee
di�fd@eee
dj�fdAeee
dk�fd%eee
dl�fdBeeee
dm�fd.eee	e
dn�fdeeeee
do�fdDeeee	efe
dp�fd'eeege	fe
d(�fd)eegeff0d}d~�Z/ed�dddddd1ddddddd2d2d2dee�dddee�dZ�d,ee	e
d[�fd6eee
d\�fd7eeee
d]�fdeeee
e	efe
d^�fd
eeeeje
d_�fd8eee	e
d`�fd9eee	e
da�fd:ee	e
db�fdeeee
ee	fee	effe
dc�fd#eeee
dd�fd;eee	e
de�fd<eee!e
df�fd=eee!e
dg�fd>eee
dh�fd?eee
di�fd@eee
dj�fdAeee
dk�fd%eee
dl�fdBeeee
dm�fd.eee	e
dn�fdeeeee
do�fdDeeee	efe
dp�fd'eeege	fe
d(�fd)eegeff0dd��Z0ed��d�ee	e
d��fd)eegeffd�d���Z1�Z2S)��	APIRoutera�
    `APIRouter` class, used to group *path operations*, for example to structure
    an app in multiple files. It would then be included in the `FastAPI` app, or
    in another `APIRouter` (ultimately included in the app).

    Read more about it in the
    [FastAPI docs for Bigger Applications - Multiple Files](https://fastapi.tiangolo.com/tutorial/bigger-applications/).

    ## Example

    ```python
    from fastapi import APIRouter, FastAPI

    app = FastAPI()
    router = APIRouter()


    @router.get("/users/", tags=["users"])
    async def read_users():
        return [{"username": "Rick"}, {"username": "Morty"}]


    app.include_router(router)
    ```
    rNT)�prefixr�r��default_response_classr�r��routes�redirect_slashes�defaultr��route_class�
on_startup�on_shutdown�lifespanrFr�r�rz'An optional path prefix for the router.r�a�
                A list of tags to be applied to all the *path operations* in this
                router.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).

                Read more about it in the
                [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/).
                r�a�
                A list of dependencies (using `Depends()`) to be applied to all the
                *path operations* in this router.

                Read more about it in the
                [FastAPI docs for Bigger Applications - Multiple Files](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies).
                ra

                The default response class to be used.

                Read more in the
                [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#default-response-class).
                r�a*
                Additional responses to be shown in OpenAPI.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).

                Read more about it in the
                [FastAPI docs for Additional Responses in OpenAPI](https://fastapi.tiangolo.com/advanced/additional-responses/).

                And in the
                [FastAPI docs for Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/#include-an-apirouter-with-a-custom-prefix-tags-responses-and-dependencies).
                r�ao
                OpenAPI callbacks that should apply to all *path operations* in this
                router.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).

                Read more about it in the
                [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/).
                ra
                **Note**: you probably shouldn't use this parameter, it is inherited
                from Starlette and supported for compatibility.

                ---

                A list of routes to serve incoming HTTP and WebSocket requests.
                a5
                You normally wouldn't use this parameter with FastAPI, it is inherited
                from Starlette and supported for compatibility.

                In FastAPI, you normally would use the *path operation methods*,
                like `router.get()`, `router.post()`, etc.
                rz�
                Whether to detect and redirect slashes in URLs when the client doesn't
                use the same format.
                rz�
                Default function handler for this router. Used to handle
                404 Not Found errors.
                r�z�
                Only used internally by FastAPI to handle dependency overrides.

                You shouldn't need to use it. It normally points to the `FastAPI` app
                object.
                ra4
                Custom route (*path operation*) class to be used by this router.

                Read more about it in the
                [FastAPI docs for Custom Request and APIRoute class](https://fastapi.tiangolo.com/how-to/custom-request-and-route/#custom-apiroute-class-in-a-router).
                rz�
                A list of startup event handler functions.

                You should instead use the `lifespan` handlers.

                Read more in the [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).
                ra
                A list of shutdown event handler functions.

                You should instead use the `lifespan` handlers.

                Read more in the
                [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).
                r a'
                A `Lifespan` context manager handler. This replaces `startup` and
                `shutdown` functions with a single context manager.

                Read more in the
                [FastAPI docs for `lifespan`](https://fastapi.tiangolo.com/advanced/events/).
                rFaa
                Mark all *path operations* in this router as deprecated.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).

                Read more about it in the
                [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/).
                r�a�
                To include (or not) all the *path operations* in this router in the
                generated OpenAPI.

                This affects the generated OpenAPI (e.g. visible at `/docs`).

                Read more about it in the
                [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
                r�a�
                Customize the function used to generate unique IDs for the *path
                operations* shown in the generated OpenAPI.

                This is particularly useful when automatically generating clients or
                SDKs for your API.

                Read more about it in the
                [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function).
                rKcs�t�j|||	||
|d�|r |�d�sJd��|�d�r Jd��||_|p&g|_t|p,g�|_||_||_	|p8i|_
|p=g|_|
|_||_
||_||_dS)N)rrrrrr �/�!A path prefix must start with '/'�FA path prefix must not end with '/', as the routes will start with '/')r�r��
startswithr�rr�r]r�rFr�r�r�r�rrr�)r�rr�r�rr�r�rrrr�rrrr rFr�r�r�rUrVr�ns2X��



zAPIRouter.__init__r�r�r�cs"dtdtf�����fdd�}|S)N�funcrKcs�j�|���d�|S)N)r�r�r�)�	add_route�r%�r�r�r�r�r�rUrV�	decoratores�z"APIRouter.route.<locals>.decorator�r))r�r�r�r�r�r)rUr(rVr�^s
zAPIRouter.router�F)r�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r��route_class_overrider�r�r�r�.r�r�r�r�r�r�r�r�r�r�r�r�r�r+r�c#Cs�|p|j}|
pi}
i|j�|
�}t||j�}|j��}|r"|�|�|j��}|r.|�|�|j��} |r:| �|�t||j	�}!||j
|fid|�d|�d|�d|�d|�d|�d|�d|	�d	|�d
|pg|j�d|�d|
�d
|�d|�d|�d|�d|�d|�d|o�|j�d|�d|�d|j
�d| �d|�d|!��}"|j�|"�dS�d|�d|�d|j
�d| �d|�d|!��}"|j�|"�dS)Nr�r�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�)rr�r.rr��copyryr�r�r�rrFr�r�rrz)#r�r�r�r�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r+r�r�r�r�combined_responses�current_response_class�current_tags�current_dependencies�current_callbacksrr�rUrUrV�
add_api_routeqs�
"�





���������	�
����
�������
���������������zAPIRouter.add_api_route)r�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r�r�csJdtdtf����������	�
���
�����������fdd�}|S)Nr%rKcs��j�
|fid�
�d��d��d��d��d��d��d��d	��d
��d�	�d��d
��d��d��d��d��d��d��d��d��d��d���|S)Nr�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r�r�)r2r'�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rUrVr)�sf�������	�
���
�������������z&APIRouter.api_route.<locals>.decoratorr*)r�r�r�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r�r�r)rUr3rV�	api_route�sFzAPIRouter.api_route)r�cCsB|j��}|r|�|�t|j|||||jd�}|j�|�dS)N)r�r�r�r�)r�r,ryr�rr�rrz)r�r�r�r�r�r0r�rUrUrV�add_api_websocket_routes

�z!APIRouter.add_api_websocket_routez1
                WebSocket path.
                zQ
                A name for the WebSocket. Only used internally.
                a
                A list of dependencies (using `Depends()`) to be used for this
                WebSocket.

                Read more about it in the
                [FastAPI docs for WebSockets](https://fastapi.tiangolo.com/advanced/websockets/).
                cs dtdtf����fdd�}|S)a�
        Decorate a WebSocket function.

        Read more about it in the
        [FastAPI docs for WebSockets](https://fastapi.tiangolo.com/advanced/websockets/).

        **Example**

        ## Example

        ```python
        from fastapi import APIRouter, FastAPI, WebSocket

        app = FastAPI()
        router = APIRouter()

        @router.websocket("/ws")
        async def websocket_endpoint(websocket: WebSocket):
            await websocket.accept()
            while True:
                data = await websocket.receive_text()
                await websocket.send_text(f"Message text was: {data}")

        app.include_router(router)
        ```
        r%rKcs�j�|��d�|S)N)r�r�)r5r'�r�r�r�r�rUrVr)Qs�z&APIRouter.websocket.<locals>.decoratorr*)r�r�r�r�r)rUr6rVr�s;zAPIRouter.websocketcsdtdtf���fdd�}|S)Nr%rKcs�j�|�d�|S)N�r�)�add_websocket_router'�r�r�r�rUrVr)\sz,APIRouter.websocket_route.<locals>.decoratorr*)r�r�r�r)rUr9rV�websocket_routeYszAPIRouter.websocket_route)	rr�r�rr�r�rFr�r��routerzThe `APIRouter` to include.z�
                Include (or not) all the *path operations* in this router in the
                generated OpenAPI schema.

                This affects the generated OpenAPI (e.g. visible at `/docs`).
                c	Cs|r|�d�sJd��|�d�rJd��n|jD]}t|d�}t|dd�}
|dur3|s3td|
�d	���q|dur:i}|jD�](}t|t��r	i|�|j�}t|j	|j
||j
�}g}|r`|�|�|jri|�|j�g}|rr|�|�|j
r{|�|j
�g}|r�|�|�|jr�|�|j�t|j|j|
|j�}|j||j|jfid
|j�d|j�d|�d
|�d|j�d|j�d|j�d|�d|jp�|p�|j�d|j�d|j�d|j�d|j�d|j�d|j�d|j�d|j �d|j!o�|j!o�|	�d|�d|j"�dt#|��d|�d|j$�d |��q=t|t%j&��r)t'|j�pg�}|j(||j|j||j!|j"d!�q=t|t)��rRg}|�r9|�|�|j
�rC|�|j
�|j*||j|j||j"d"�q=t|t%j+��rf|j,||j|j|j"d#�q=|j-D]	}|�.d$|��qj|j/D]	}|�.d%|��qwt0|j1|j1�|_1dS)&a|
        Include another `APIRouter` in the same current `APIRouter`.

        Read more about it in the
        [FastAPI docs for Bigger Applications](https://fastapi.tiangolo.com/tutorial/bigger-applications/).

        ## Example

        ```python
        from fastapi import APIRouter, FastAPI

        app = FastAPI()
        internal_router = APIRouter()
        users_router = APIRouter()

        @users_router.get("/users/")
        def read_users():
            return [{"name": "Rick"}, {"name": "Morty"}]

        internal_router.include_router(users_router)
        app.include_router(internal_router)
        ```
        r!r"r#r�r��unknownNz6Prefix and path cannot be both empty (path operation: �)r�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r+r�r�r�)r�r�r�)r�r�r7�startup�shutdown)2r$r�rr\r%r[r�r�r.r�rryr�r�r�r�r2r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r1�Router]r&r�r5�WebSocketRouter8r�add_event_handlerrrl�lifespan_context)r�r;rr�r�rr�r�rFr�r��rr�r�r�r-�use_response_classr/r0r1rr��handlerrUrUrV�include_routerbs�


���


��������	�
����
�����������������
���


�zAPIRouter.include_router)r�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r�z�
                The URL path to be used for this *path operation*.

                For example, in `http://example.com/items`, the path is `/items`.
                a�
                The type to use for the response.

                It could be any valid Pydantic *field* type. So, it doesn't have to
                be a Pydantic model, it could be other things, like a `list`, `dict`,
                etc.

                It will be used for:

                * Documentation: the generated OpenAPI (and the UI at `/docs`) will
                    show it as the response (JSON Schema).
                * Serialization: you could return an arbitrary object and the
                    `response_model` would be used to serialize that object into the
                    corresponding JSON.
                * Filtering: the JSON sent to the client will only contain the data
                    (fields) defined in the `response_model`. If you returned an object
                    that contains an attribute `password` but the `response_model` does
                    not include that field, the JSON sent to the client would not have
                    that `password`.
                * Validation: whatever you return will be serialized with the
                    `response_model`, converting any data as necessary to generate the
                    corresponding JSON. But if the data in the object returned is not
                    valid, that would mean a violation of the contract with the client,
                    so it's an error from the API developer. So, FastAPI will raise an
                    error and return a 500 error code (Internal Server Error).

                Read more about it in the
                [FastAPI docs for Response Model](https://fastapi.tiangolo.com/tutorial/response-model/).
                aM
                The default status code to be used for the response.

                You could override the status code by returning a response directly.

                Read more about it in the
                [FastAPI docs for Response Status Code](https://fastapi.tiangolo.com/tutorial/response-status-code/).
                ac
                A list of tags to be applied to the *path operation*.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).

                Read more about it in the
                [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/#tags).
                a[
                A list of dependencies (using `Depends()`) to be applied to the
                *path operation*.

                Read more about it in the
                [FastAPI docs for Dependencies in path operation decorators](https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-in-path-operation-decorators/).
                aL
                A summary for the *path operation*.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).

                Read more about it in the
                [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/).
                a
                A description for the *path operation*.

                If not provided, it will be extracted automatically from the docstring
                of the *path operation function*.

                It can contain Markdown.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).

                Read more about it in the
                [FastAPI docs for Path Operation Configuration](https://fastapi.tiangolo.com/tutorial/path-operation-configuration/).
                z�
                The description for the default response.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).
                z�
                Additional responses that could be returned by this *path operation*.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).
                z�
                Mark this *path operation* as deprecated.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).
                a�
                Custom operation ID to be used by this *path operation*.

                By default, it is generated automatically.

                If you provide a custom operation ID, you need to make sure it is
                unique for the whole API.

                You can customize the
                operation ID generation with the parameter
                `generate_unique_id_function` in the `FastAPI` class.

                Read more about it in the
                [FastAPI docs about how to Generate Clients](https://fastapi.tiangolo.com/advanced/generate-clients/#custom-generate-unique-id-function).
                a\
                Configuration passed to Pydantic to include only certain fields in the
                response data.

                Read more about it in the
                [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude).
                aW
                Configuration passed to Pydantic to exclude certain fields in the
                response data.

                Read more about it in the
                [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude).
                a|
                Configuration passed to Pydantic to define if the response model
                should be serialized by alias when an alias is used.

                Read more about it in the
                [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_include-and-response_model_exclude).
                a�
                Configuration passed to Pydantic to define if the response data
                should have all the fields, including the ones that were not set and
                have their default values. This is different from
                `response_model_exclude_defaults` in that if the fields are set,
                they will be included in the response, even if the value is the same
                as the default.

                When `True`, default values are omitted from the response.

                Read more about it in the
                [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter).
                a�
                Configuration passed to Pydantic to define if the response data
                should have all the fields, including the ones that have the same value
                as the default. This is different from `response_model_exclude_unset`
                in that if the fields are set but contain the same default values,
                they will be excluded from the response.

                When `True`, default values are omitted from the response.

                Read more about it in the
                [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#use-the-response_model_exclude_unset-parameter).
                a~
                Configuration passed to Pydantic to define if the response data should
                exclude fields set to `None`.

                This is much simpler (less smart) than `response_model_exclude_unset`
                and `response_model_exclude_defaults`. You probably want to use one of
                those two instead of this one, as those allow returning `None` values
                when it makes sense.

                Read more about it in the
                [FastAPI docs for Response Model - Return Type](https://fastapi.tiangolo.com/tutorial/response-model/#response_model_exclude_none).
                a�
                Include this *path operation* in the generated OpenAPI schema.

                This affects the generated OpenAPI (e.g. visible at `/docs`).

                Read more about it in the
                [FastAPI docs for Query Parameters and String Validations](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-from-openapi).
                ae
                Response class to be used for this *path operation*.

                This will not be used if you return a response directly.

                Read more about it in the
                [FastAPI docs for Custom Response - HTML, Stream, File, others](https://fastapi.tiangolo.com/advanced/custom-response/#redirectresponse).
                zW
                Name for this *path operation*. Only used internally.
                a�
                List of *path operations* that will be used as OpenAPI callbacks.

                This is only for OpenAPI documentation, the callbacks won't be used
                directly.

                It will be added to the generated OpenAPI (e.g. visible at `/docs`).

                Read more about it in the
                [FastAPI docs for OpenAPI Callbacks](https://fastapi.tiangolo.com/advanced/openapi-callbacks/).
                ah
                Extra metadata to be included in the OpenAPI schema for this *path
                operation*.

                Read more about it in the
                [FastAPI docs for Path Operation Advanced Configuration](https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#custom-openapi-path-operation-schema).
                cC�|jdid|�d|�d|�d|�d|�d|�d|�d|�d	|	�d
|
�ddg�d
|�d|�d|
�d|�d|�d|�d|�d|�d|�d|�d|�d|�d|��S)ax
        Add a *path operation* using an HTTP GET operation.

        ## Example

        ```python
        from fastapi import APIRouter, FastAPI

        app = FastAPI()
        router = APIRouter()

        @router.get("/items/")
        def read_items():
            return [{"name": "Empanada"}, {"name": "Arepa"}]

        app.include_router(router)
        ```
        r�r�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�NrU�r4�r�r�r�r�r�r�r�r�r�r�rFr�r�r�r�r�r�r�r�r�r�r�r�r�rUrUrVr�V�f
`��������	�
���
������������z
APIRouter.getcCrH)a%
        Add a *path operation* using an HTTP PUT operation.

        ## Example

        ```python
        from fastapi import APIRouter, FastAPI
        from pydantic import BaseModel

        class Item(BaseModel):
            name: str
            description: str | None = None

        app = FastAPI()
        router = APIRouter()

        @router.put("/items/{item_id}")
        def replace_item(item_id: str, item: Item):
            return {"message": "Item replaced", "id": item_id}

        app.include_router(router)
        ```
        r�r�r�r�r�r�r�r�r�rFr��PUTr�r�r�r�r�r�r�r�r�r�r�r�r�NrUrIrJrUrUrV�put��f
e��������	�
���
������������z
APIRouter.putcCrH)a�
        Add a *path operation* using an HTTP POST operation.

        ## Example

        ```python
        from fastapi import APIRouter, FastAPI
        from pydantic import BaseModel

        class Item(BaseModel):
            name: str
            description: str | None = None

        app = FastAPI()
        router = APIRouter()

        @router.post("/items/")
        def create_item(item: Item):
            return {"message": "Item created"}

        app.include_router(router)
        ```
        r�r�r�r�r�r�r�r�r�rFr��POSTr�r�r�r�r�r�r�r�r�r�r�r�r�NrUrIrJrUrUrV�postMrNzAPIRouter.postcCrH)a�
        Add a *path operation* using an HTTP DELETE operation.

        ## Example

        ```python
        from fastapi import APIRouter, FastAPI

        app = FastAPI()
        router = APIRouter()

        @router.delete("/items/{item_id}")
        def delete_item(item_id: str):
            return {"message": "Item deleted"}

        app.include_router(router)
        ```
        r�r�r�r�r�r�r�r�r�rFr��DELETEr�r�r�r�r�r�r�r�r�r�r�r�r�NrUrIrJrUrUrV�delete�	rKzAPIRouter.deletecCrH)a�
        Add a *path operation* using an HTTP OPTIONS operation.

        ## Example

        ```python
        from fastapi import APIRouter, FastAPI

        app = FastAPI()
        router = APIRouter()

        @router.options("/items/")
        def get_item_options():
            return {"additions": ["Aji", "Guacamole"]}

        app.include_router(router)
        ```
        r�r�r�r�r�r�r�r�r�rFr��OPTIONSr�r�r�r�r�r�r�r�r�r�r�r�r�NrUrIrJrUrUrV�optionsDrKzAPIRouter.optionscCrH)a0
        Add a *path operation* using an HTTP HEAD operation.

        ## Example

        ```python
        from fastapi import APIRouter, FastAPI
        from pydantic import BaseModel

        class Item(BaseModel):
            name: str
            description: str | None = None

        app = FastAPI()
        router = APIRouter()

        @router.head("/items/", status_code=204)
        def get_items_headers(response: Response):
            response.headers["X-Cat-Dog"] = "Alone in the world"

        app.include_router(router)
        ```
        r�r�r�r�r�r�r�r�r�rFr��HEADr�r�r�r�r�r�r�r�r�r�r�r�r�NrUrIrJrUrUrV�head�rNzAPIRouter.headcCrH)a

        Add a *path operation* using an HTTP PATCH operation.

        ## Example

        ```python
        from fastapi import APIRouter, FastAPI
        from pydantic import BaseModel

        class Item(BaseModel):
            name: str
            description: str | None = None

        app = FastAPI()
        router = APIRouter()

        @router.patch("/items/")
        def update_item(item: Item):
            return {"message": "Item updated in place"}

        app.include_router(router)
        ```
        r�r�r�r�r�r�r�r�r�rFr��PATCHr�r�r�r�r�r�r�r�r�r�r�r�r�NrUrIrJrUrUrV�patch;rNzAPIRouter.patchcCrH)a�
        Add a *path operation* using an HTTP TRACE operation.

        ## Example

        ```python
        from fastapi import APIRouter, FastAPI
        from pydantic import BaseModel

        class Item(BaseModel):
            name: str
            description: str | None = None

        app = FastAPI()
        router = APIRouter()

        @router.trace("/items/{item_id}")
        def trace_item(item_id: str):
            return None

        app.include_router(router)
        ```
        r�r�r�r�r�r�r�r�r�rFr��TRACEr�r�r�r�r�r�r�r�r�r�r�r�r�NrUrIrJrUrUrV�trace�rNzAPIRouter.tracez�
        on_event is deprecated, use lifespan event handlers instead.

        Read more about it in the
        [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/).
        �
event_typezM
                The type of event. `startup` or `shutdown`.
                csdtdtf��fdd�}|S)a
        Add an event handler for the router.

        `on_event` is deprecated, use `lifespan` event handlers instead.

        Read more about it in the
        [FastAPI docs for Lifespan Events](https://fastapi.tiangolo.com/advanced/events/#alternative-events-deprecated).
        r%rKcs���|�|Srf)rBr'�r[r�rUrVr)Ssz%APIRouter.on_event.<locals>.decoratorr*)r�r[r)rUr\rV�on_event7szAPIRouter.on_event)NNTrf)3r�r�r�rrr5r�r-rDrkrEr
rrrrrr�rr6r
rrr7rFrr?rr@r�r)r�rr*rr2r4r5r�r:rGr�rMrPrRrTrVrXrZr]r�rUrUr�rVrSs�		

���������������)����9
����G
�
����]����f����o����z��������������!
�����-�����:�����H�����W��t��
���
����
�����	�
���
������������
�
����!
�V��������	�
���

�����������
���
�B���
���
�&������
��������
�D��
�
�

���������������*����:
����H����U����`����o
�$







�������
����/����<����I����U����b����t����~����	����������'�����3�����?�����K�����]�����n����������
������������"
������2������>������M��
�*







�������
����/����<����I����U����b����t����~����	����������'�����3�����?�����K�����]�����n����������
������������"
������2������>������M��
�/







�������
����/����<����I����U����b����t����~����	����������'�����3�����?�����K�����]�����n����������
������������"
������2������>������M��
�/







�������
����/����<����I����U����b����t����~����	����������'�����3�����?�����K�����]�����n����������
������������"
������2������>������M��
�*







�������
����/����<����I����U����b����t����~����	����������'�����3�����?�����K�����]�����n����������
������������"
������2������>������M��
�*







�������
����/����<����I����U����b����t����~����	����������'�����3�����?�����K�����]�����n����������
������������"
������2������>������M��
�/







�������
����/����<����I����U����b����t����~����	����������'�����3�����?�����K�����]�����n����������
������������"
������2������>������M��
�/







�������
����/����<����I����U����b����t����~����	����������'�����3�����?�����K�����]�����n����������
������������"
������2������>������M��
������
�r)NF)or�r`�
email.messager�r
r��
contextlibrr�enumrr�typingrrrr	r
rrr
rrrrr�fastapir�fastapi._compatrrrrrr�fastapi.datastructuresrr�fastapi.dependencies.modelsr�fastapi.dependencies.utilsrrrr r!r"r#�fastapi.encodersr$�fastapi.exceptionsr%r&r'r(�
fastapi.typesr)r*�
fastapi.utilsr+r,r-r.r/�pydanticr0�	starletter1�starlette.concurrencyr2�starlette.exceptionsr3�starlette.requestsr4�starlette.responsesr5r6�starlette.routingr7r8r9r:r;r<r=�starlette.typesr>r?r@rA�starlette.websocketsrC�typing_extensionsrDrErFrrQrlr}rkr�rr�r�rAr�r@r��RouterrrUrUrUrV�<module>s< $	 �����
�/��
���������	�
�
�=�
��
����������	�
���
�
�����
�((