
    i                       S SK Jr  S SKrS SKrS SKJrJrJr  S SKJ	r	  S SK
Jr  S SKJrJrJrJr   S SKr " S S\5      r " S	 S
\5      r\R*                  " S5      r " S S5      r " S S\5      rg! \ a    Sr NHf = f)    )annotationsN)AnyCallable
NamedTuple)Request)Response)	BaseRouteHostMountRoutec                  "    \ rS rSrSrSS jrSrg)OpenAPIResponse   zapplication/vnd.oai.openapic                    [         c   S5       e[        U[        5      (       d   S5       e[         R                  " USS9R	                  S5      $ )Nz2`pyyaml` must be installed to use OpenAPIResponse.z<The schema passed to OpenAPIResponse should be a dictionary.F)default_flow_stylezutf-8)yaml
isinstancedictdumpencode)selfcontents     Y/var/www/html/qgis-automation/mouza_env/lib/python3.13/site-packages/starlette/schemas.pyrenderOpenAPIResponse.render   sI    U!UU'4((h*hh(yyU;BB7KK     N)r   r   returnbytes)__name__
__module____qualname____firstlineno__
media_typer   __static_attributes__r   r   r   r   r      s    .JLr   r   c                  4    \ rS rSr% S\S'   S\S'   S\S'   Srg)	EndpointInfo   strpathhttp_methodCallable[..., Any]funcr   N)r    r!   r"   r#   __annotations__r%   r   r   r   r'   r'      s    
I
r   r'   z:\w+}c                  F    \ rS rSrS	S jrS
S jrSS jrSS jrSS jrSr	g)BaseSchemaGenerator#   c                    [        5       eN)NotImplementedError)r   routess     r   
get_schemaBaseSchemaGenerator.get_schema$   s    !##r   c           
        / nU GH:  n[        U[        [        45      (       a  UR                  =(       d    / n[        U[        5      (       a  U R	                  UR
                  5      nOSnU R                  U5       Vs/ s H<  n[        SR                  XER
                  45      UR                  UR                  S9PM>     nnUR                  U5        M  [        U[        5      (       a  UR                  (       d  M  [        R                  " UR                   5      (       d%  [        R"                  " UR                   5      (       av  U R	                  UR
                  5      nUR$                  =(       d    S/ H>  nUS:X  a  M  UR'                  [        XGR)                  5       UR                   5      5        M@     GM  U R	                  UR
                  5      nS H_  n[+        UR                   U5      (       d  M   [-        UR                   U5      nUR'                  [        XGR)                  5       U5      5        Ma     GM=     U$ s  snf )z
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
 )r*   r+   r-   GETHEAD)getpostputpatchdeleteoptions)r   r   r
   r5   _remove_converterr*   get_endpointsr'   joinr+   r-   extendr   include_in_schemainspect
isfunctionendpointismethodmethodsappendlowerhasattrgetattr)	r   r5   endpoints_inforouter*   sub_endpointsub_endpointsmethodr-   s	            r   rC   !BaseSchemaGenerator.get_endpoints'   s    .0E%%//+eU++11%**=DD )-(:(:6(B! )C !WWd,=,=%>?$0$<$<)..
 )C  ! %%m4u--U5L5L##ENN33w7G7G7W7W--ejj9#mm6w6F' ")),t\\^U^^*\] 7
 --ejj9RF"5>>6:: "5>>6:D")),t\\^T*RS	 S9 D 7!s   ?AIc                .    [         R                  SU5      $ )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)r   r*   s     r   rB   %BaseSchemaGenerator._remove_converterX   s     ),,S$77r   c                    UR                   nU(       d  0 $ [        c   S5       eUR                  S5      S   n[        R                  " U5      n[	        U[
        5      (       d  0 $ U$ )zP
Given a function, parse the docstring as YAML and return a dictionary of info.
z2`pyyaml` must be installed to use parse_docstring.z---)__doc__r   split	safe_loadr   r   )r   func_or_method	docstringparseds       r   parse_docstring#BaseSchemaGenerator.parse_docstringa   se     #**	IU!UU
 OOE*2.		*&$'' Ir   c                b    UR                   R                  nU R                  US9n[        U5      $ )N)r5   )appr5   r6   r   )r   requestr5   schemas       r   r   #BaseSchemaGenerator.OpenAPIResponsey   s,    ##/v&&r   r   Nr5   list[BaseRoute]r   dict[str, Any])r5   rk   r   zlist[EndpointInfo])r*   r)   r   r)   )r`   r,   r   rl   )rg   r   r   r   )
r    r!   r"   r#   r6   rC   rB   rc   r   r%   r   r   r   r0   r0   #   s    $/b80'r   r0   c                  (    \ rS rSrSS jrSS jrSrg)SchemaGenerator   c                    Xl         g r3   base_schema)r   rr   s     r   __init__SchemaGenerator.__init__   s    &r   c                V   [        U R                  5      nUR                  S0 5        U R                  U5      nU Hj  nU R	                  UR
                  5      nU(       d  M'  UR                  US   ;  a  0 US   UR                  '   XRS   UR                     UR                  '   Ml     U$ )Npaths)r   rr   
setdefaultrC   rc   r-   r*   r+   )r   r5   rh   rP   rI   rb   s         r   r6   SchemaGenerator.get_schema   s    d&&''2&++F3&H))(--8F}}F7O313w.CI7OHMM*8+?+?@ ' r   rq   N)rr   rl   r   Nonerj   )r    r!   r"   r#   rs   r6   r%   r   r   r   rn   rn      s    'r   rn   )
__future__r   rG   retypingr   r   r   starlette.requestsr   starlette.responsesr   starlette.routingr	   r
   r   r   r   ModuleNotFoundErrorr   r'   compilerX   r0   rn   r   r   r   <module>r      s    "  	 , , & ( ; ;
Lh L:  JJx0 Y' Y'x) e  Ds   A4 4A?>A?