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/starlette/__pycache__/schemas.cpython-310.pyc
o

�h=�@s�ddlmZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
zddlZWney;dZYnwGdd�de�ZGdd	�d	ej�Ze�d
�ZGdd�d�ZGd
d�de�ZdS)�)�annotationsN)�Request)�Response)�	BaseRoute�Host�Mount�Routec@seZdZdZd	dd�ZdS)
�OpenAPIResponsezapplication/vnd.oai.openapi�content�
typing.Any�return�bytescCs6tdusJd��t|t�sJd��tj|dd��d�S)Nz2`pyyaml` must be installed to use OpenAPIResponse.z<The schema passed to OpenAPIResponse should be a dictionary.F)�default_flow_stylezutf-8)�yaml�
isinstance�dict�dump�encode)�selfr
�r�G/usr/local/CyberPanel/lib/python3.10/site-packages/starlette/schemas.py�renderszOpenAPIResponse.renderN)r
rrr
)�__name__�
__module__�__qualname__�
media_typerrrrrr	sr	c@s&eZdZUded<ded<ded<dS)�EndpointInfo�str�path�http_method� typing.Callable[..., typing.Any]�funcN)rrr�__annotations__rrrrrs
rz:\w+}c@s>eZdZddd�Zddd	�Zddd
�Zddd�Zddd�ZdS)�BaseSchemaGenerator�routes�list[BaseRoute]r�dict[str, typing.Any]cCst���N)�NotImplementedError)rr$rrr�
get_schema$szBaseSchemaGenerator.get_schema�list[EndpointInfo]csg}|D]�}t|ttf�r2|jpg}t|t�r|�|j��nd��fdd�|�|�D�}|�|�qt|t�r:|j	s;qt
�|j�sGt
�
|j�rh|�|j��|jpRdgD]}|dkrZqS|�t�|��|j��qSq|�|j��dD]}t|j|�syqpt|j|�}|�t�|��|��qpq|S)a

        Given the routes, yields the following information:

        - path
            eg: /users/
        - http_method
            one of 'get', 'post', 'put', 'patch', 'delete', 'options'
        - func
            method ready to extract the docstring
        �cs*g|]}td��|jf�|j|jd��qS)r+)rrr!)r�joinrrr!)�.0�sub_endpoint�rrr�
<listcomp>;s���z5BaseSchemaGenerator.get_endpoints.<locals>.<listcomp>�GET�HEAD)�get�post�put�patch�delete�options)rrrr$�_remove_converterr�
get_endpoints�extendr�include_in_schema�inspect�
isfunction�endpoint�ismethod�methods�appendr�lower�hasattr�getattr)rr$�endpoints_info�route�
sub_endpoints�methodr!rr/rr:'s8


���z!BaseSchemaGenerator.get_endpointsrrcCst�d|�S)z�
        Remove the converter from the path.
        For example, a route like this:
            Route("/users/{id:int}", endpoint=get_user, methods=["GET"])
        Should be represented as `/users/{id}` in the OpenAPI schema.
        �})�_remove_converter_pattern�sub)rrrrrr9Xsz%BaseSchemaGenerator._remove_converter�func_or_methodr cCsH|j}|siStdusJd��|�d�d}t�|�}t|t�s"iS|S)z`
        Given a function, parse the docstring as YAML and return a dictionary of info.
        Nz2`pyyaml` must be installed to use parse_docstring.z---���)�__doc__r�split�	safe_loadrr)rrM�	docstring�parsedrrr�parse_docstringas

z#BaseSchemaGenerator.parse_docstring�requestrrcCs|jj}|j|d�}t|�S)N)r$)�appr$r)r	)rrUr$�schemarrrr	ysz#BaseSchemaGenerator.OpenAPIResponseN�r$r%rr&)r$r%rr*)rrrr)rMr rr&)rUrrr)rrrr)r:r9rTr	rrrrr##s


1
	r#c@s eZdZddd�Zd
d	d
�ZdS)�SchemaGenerator�base_schemar&r�NonecCs
||_dSr')rZ)rrZrrr�__init__�s
zSchemaGenerator.__init__r$r%cCspt|j�}|�di�|�|�}|D]#}|�|j�}|sq|j|dvr+i|d|j<||d|j|j<q|S)N�paths)rrZ�
setdefaultr:rTr!rr)rr$rWrFr?rSrrrr)�s

zSchemaGenerator.get_schemaN)rZr&rr[rX)rrrr\r)rrrrrYs
rY)�
__future__rr=�re�typing�starlette.requestsr�starlette.responsesr�starlette.routingrrrrr�ModuleNotFoundErrorr	�
NamedTupler�compilerKr#rYrrrr�<module>s"�	
\