
    ^i                        S SK Jr  S SKJrJrJrJr  S SKJrJ	r	J
r
  S SKJrJr  S SKJrJr  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJrJr  S SKJrJrJrJ r J!r!J"r"  \
" SSS9r#\	" S5      r$ " S S5      r%g)    )annotations)	AwaitableCallableMappingSequence)Any	ParamSpecTypeVar)StateURLPath)
Middleware_MiddlewareFactory)ServerErrorMiddleware)ExceptionMiddleware)Request)Response)	BaseRouteRouter)ASGIAppExceptionHandlerLifespanReceiveScopeSendAppType	Starlette)boundPc                      \ rS rSrSr     S             SS jjrSS jr\SS j5       rSS jr	SS jr
SSS	 jjrSSS
 jjrSS jr      SS jr   S           SS jjrSrg)r      z!Creates an Starlette application.Nc                    Xl         [        5       U l        [        X%S9U l        Uc  0 O
[        U5      U l        Uc  / O
[        U5      U l        SU l	        g)a  Initializes the application.

Parameters:
    debug: Boolean indicating if debug tracebacks should be returned on errors.
    routes: A list of routes to serve incoming HTTP and WebSocket requests.
    middleware: A list of middleware to run for every request. A starlette
        application will always automatically include two middleware classes.
        `ServerErrorMiddleware` is added as the very outermost middleware, to handle
        any uncaught errors occurring anywhere in the entire stack.
        `ExceptionMiddleware` is added as the very innermost middleware, to deal
        with handled exception cases occurring in the routing or endpoints.
    exception_handlers: A mapping of either integer status codes,
        or exception class types onto callables which handle the exceptions.
        Exception handler callables should be of the form
        `handler(request, exc) -> response` and may be either standard functions, or
        async functions.
    lifespan: A lifespan context function, which can be used to perform
        startup and shutdown tasks. This is a newer style that replaces the
        `on_startup` and `on_shutdown` handlers. Use one or the other, not both.
)lifespanN)
debugr   stater   routerdictexception_handlerslistuser_middlewaremiddleware_stack)selfr#   routes
middlewarer'   r"   s         F/root/zsrc/venv/lib/python3.13/site-packages/starlette/applications.py__init__Starlette.__init__   sO    8 
W
V7(:(B"M_H`%/%7rT*=M04    c                F   U R                   nS n0 nU R                  R                  5        H  u  pEUS[        4;   a  UnM  XSU'   M     [	        [
        X!S9/U R                  -   [	        [        X1S9/-   nU R                  n[        U5       H  u  pn
U" U/U	Q70 U
D6nM     U$ )Ni  )handlerr#   )handlersr#   )
r#   r'   items	Exceptionr   r   r)   r   r%   reversed)r+   r#   error_handlerr'   keyvaluer-   appclsargskwargss              r.   build_middleware_stack Starlette.build_middleware_stack9   s    

:<11779JCsI&& %*/3'	 : -}RS""#-8JXYZ 	 kk!)*!5Cvc+D+F+C "6
r1   c                .    U R                   R                  $ N)r%   r,   )r+   s    r.   r,   Starlette.routesO   s    {{!!!r1   c               <    U R                   R                  " U40 UD6$ rB   )r%   url_path_for)r+   namepath_paramss      r.   rE   Starlette.url_path_forS   s    {{''<<<r1   c                   #    XS'   U R                   c  U R                  5       U l         U R                  XU5      I S h  vN   g  N7f)Nr;   )r*   r?   )r+   scopereceivesends       r.   __call__Starlette.__call__V   s?     e  ($($?$?$AD!##ED999s   <AAAc                8    U R                   R                  XUS9  g N)r;   rF   )r%   mount)r+   pathr;   rF   s       r.   rQ   Starlette.mount\   s    $d3r1   c                8    U R                   R                  XUS9  g rP   )r%   host)r+   rU   r;   rF   s       r.   rU   Starlette.host_   s    T2r1   c                    U R                   b  [        S5      eU R                  R                  S[	        U/UQ70 UD65        g )Nz6Cannot add middleware after an application has startedr   )r*   RuntimeErrorr)   insertr   )r+   middleware_classr=   r>   s       r.   add_middlewareStarlette.add_middlewareb   s@      ,WXX##Az2B'TT'TV'TUr1   c                     X R                   U'   g rB   )r'   )r+   exc_class_or_status_coder3   s      r.   add_exception_handlerStarlette.add_exception_handlerg   s    
 =D 89r1   c                :    U R                   R                  XX4US9  g )N)methodsrF   include_in_schema)r%   	add_route)r+   rR   routerb   rF   rc   s         r.   rd   Starlette.add_routen   s     	d7Yjkr1   )r#   r'   r*   r%   r$   r)   )FNNNN)r+   r   r#   boolr,   zSequence[BaseRoute] | Noner-   zSequence[Middleware] | Noner'   z%Mapping[Any, ExceptionHandler] | Noner"   zLifespan[AppType] | NonereturnNone)rh   r   )rh   zlist[BaseRoute])rF   strrG   r   rh   r   )rJ   r   rK   r   rL   r   rh   ri   rB   )rR   rj   r;   r   rF   
str | Nonerh   ri   )rU   rj   r;   r   rF   rk   rh   ri   )rZ   z_MiddlewareFactory[P]r=   zP.argsr>   zP.kwargsrh   ri   )r^   zint | type[Exception]r3   r   rh   ri   )NNT)rR   rj   re   z3Callable[[Request], Awaitable[Response] | Response]rb   zlist[str] | NonerF   rk   rc   rg   rh   ri   )__name__
__module____qualname____firstlineno____doc__r/   r?   propertyr,   rE   rM   rQ   rU   r[   r_   rd   __static_attributes__ r1   r.   r   r      s   + -126DH-1!5!5!5 +!5 0	!5
 B!5 +!5 
!5F, " "=:43V
D"7D "D 
	D %)"&ll Cl "	l
 l  l 
l lr1   N)&
__future__r   collections.abcr   r   r   r   typingr   r	   r
   starlette.datastructuresr   r   starlette.middlewarer   r   starlette.middleware.errorsr   starlette.middleware.exceptionsr   starlette.requestsr   starlette.responsesr   starlette.routingr   r   starlette.typesr   r   r   r   r   r   r   r   r   rs   r1   r.   <module>r      sR    " B B * * 3 ? = ? & ( / U U
);
/cNcl clr1   