
    pT:ik(                       S SK Jr  S SK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  S SKJrJr  S SKJ r J!r!J"r"J#r#J$r$J%r%  S SK&J'r'  \" SSS9r(\
" S5      r) " S S5      r*g)    )annotationsN)	AwaitableCallableMappingSequence)Any	ParamSpecTypeVar)StateURLPath)
Middleware_MiddlewareFactory)BaseHTTPMiddleware)ServerErrorMiddleware)ExceptionMiddleware)Request)Response)	BaseRouteRouter)ASGIAppExceptionHandlerLifespanReceiveScopeSend)	WebSocket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	 jrSSS
 jjrSSS jjr        S S j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'S jjrSS(S jjrS)S jrSrg)*r      z!Creates an Starlette application.Nc                    Ub  Uc  Ub   S5       eXl         [        5       U l        [        X%XgS9U l        Uc  0 O
[        U5      U l        Uc  / O
[        U5      U l        SU l	        g)a8  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.
    on_startup: A list of callables to run on application startup.
        Startup handler callables do not take any arguments, and may be either
        standard functions, or async functions.
    on_shutdown: A list of callables to run on application shutdown.
        Shutdown handler callables do not take any arguments, 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.
Nz>Use either 'lifespan' or 'on_startup'/'on_shutdown', not both.)
on_startupon_shutdownlifespan)
debugr   stater   routerdictexception_handlerslistuser_middlewaremiddleware_stack)selfr'   routes
middlewarer+   r$   r%   r&   s           Z/var/www/html/aadhar_voter_ocr/venv/lib/python3.13/site-packages/starlette/applications.py__init__Starlette.__init__   st    L J$6;;N 	
L	
O 
W
Vg(:(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valuer1   appclsargskwargss              r2   build_middleware_stack Starlette.build_middleware_stackJ   s    

:<11779JCsI&& %*/3'	 : -}RS""#-8JXYZ 	 kk!)*!5Cvc+D+F+C "6
r5   c                .    U R                   R                  $ N)r)   r0   )r/   s    r2   r0   Starlette.routes`   s    {{!!!r5   c               <    U R                   R                  " U40 UD6$ rF   )r)   url_path_for)r/   namepath_paramss      r2   rI   Starlette.url_path_ford   s    {{''<<<r5   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.   rC   )r/   scopereceivesends       r2   __call__Starlette.__call__g   s?     e  ($($?$?$AD!##ED999s   <AAAc                8    U R                   R                  U5      $ rF   )r)   on_event)r/   
event_types     r2   rT   Starlette.on_eventm   s    {{##J//r5   c                8    U R                   R                  XUS9  g N)r?   rJ   )r)   mount)r/   pathr?   rJ   s       r2   rY   Starlette.mountp   s    $d3r5   c                8    U R                   R                  XUS9  g rX   )r)   host)r/   r]   r?   rJ   s       r2   r]   Starlette.hosts   s    T2r5   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_classrA   rB   s       r2   add_middlewareStarlette.add_middlewarev   sB       ,WXX##Az2B'TT'TV'TUr5   c                     X R                   U'   g rF   )r+   )r/   exc_class_or_status_coder7   s      r2   add_exception_handlerStarlette.add_exception_handler   s    
 =D 89r5   c                :    U R                   R                  X5        g rF   )r)   add_event_handler)r/   rU   funcs      r2   rj   Starlette.add_event_handler   s    
 	%%j7r5   c                :    U R                   R                  XX4US9  g N)methodsrJ   include_in_schemar)   	add_route)r/   rZ   routero   rJ   rp   s         r2   rr   Starlette.add_route   s     	d7Yjkr5   c                8    U R                   R                  XUS9  g N)rJ   r)   add_websocket_route)r/   rZ   rs   rJ   s       r2   rx   Starlette.add_websocket_route   s     	''$'?r5   c                R   ^ ^ [         R                  " S[        5        SUU 4S jjnU$ )NzThe `exception_handler` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://starlette.dev/exceptions/ for the recommended approach.c                ,   > TR                  TU 5        U $ rF   )rg   )rk   rf   r/   s    r2   	decorator.Starlette.exception_handler.<locals>.decorator   s    &&'?FKr5   rk   r   returnr   warningswarnDeprecationWarning)r/   rf   r|   s   `` r2   exception_handlerStarlette.exception_handler   s*    W	
	 	 r5   c                ^   ^ ^^^^ [         R                  " S[        5        SUUUUU 4S jjnU$ )z
We no longer document this decorator style API, and its usage is discouraged.
Instead you should use the following approach:

>>> routes = [Route(path, endpoint=...), ...]
>>> app = Starlette(routes=routes)
zThe `route` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://starlette.dev/routing/ for the recommended approach.c                B   > TR                   R                  TU TTTS9  U $ rn   rq   )rk   rp   ro   rJ   rZ   r/   s    r2   r|   "Starlette.route.<locals>.decorator   s0    KK!!"3 "  Kr5   r~   r   )r/   rZ   ro   rJ   rp   r|   s   ````` r2   rs   Starlette.route   s,     	T	
	 	 r5   c                V   ^ ^^ [         R                  " S[        5        SUUU 4S jjnU$ )z
We no longer document this decorator style API, and its usage is discouraged.
Instead you should use the following approach:

>>> routes = [WebSocketRoute(path, endpoint=...), ...]
>>> app = Starlette(routes=routes)
zThe `websocket_route` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://starlette.dev/routing/#websocket-routing for the recommended approach.c                >   > TR                   R                  TU TS9  U $ rv   rw   )rk   rJ   rZ   r/   s    r2   r|   ,Starlette.websocket_route.<locals>.decorator   s!    KK++D$T+BKr5   r~   r   )r/   rZ   rJ   r|   s   ``` r2   websocket_routeStarlette.websocket_route   s,     	f	
	 	 r5   c                h   ^  [         R                  " S[        5        US:X  d   S5       eSU 4S jjnU$ )z
We no longer document this decorator style API, and its usage is discouraged.
Instead you should use the following approach:

>>> middleware = [Middleware(...), ...]
>>> app = Starlette(middleware=middleware)
zThe `middleware` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://starlette.dev/middleware/#using-middleware for recommended approach.httpz/Currently only middleware("http") is supported.c                0   > TR                  [        U S9  U $ )N)dispatch)rc   r   )rk   r/   s    r2   r|   'Starlette.middleware.<locals>.decorator   s     2TBKr5   r~   r   )r/   middleware_typer|   s   `  r2   r1   Starlette.middleware   s=     	d	

 &([*[[(	 r5   )r'   r+   r.   r)   r(   r-   )FNNNNNN)r/   r   r'   boolr0   zSequence[BaseRoute] | Noner1   zSequence[Middleware] | Noner+   z%Mapping[Any, ExceptionHandler] | Noner$   "Sequence[Callable[[], Any]] | Noner%   r   r&   zLifespan[AppType] | Noner   None)r   r   )r   zlist[BaseRoute])rJ   strrK   r   r   r   )rN   r   rO   r   rP   r   r   r   )rU   r   r   r   rF   )rZ   r   r?   r   rJ   
str | Noner   r   )r]   r   r?   r   rJ   r   r   r   )rb   z_MiddlewareFactory[P]rA   zP.argsrB   zP.kwargsr   r   )rf   int | type[Exception]r7   r   r   r   )rU   r   rk   r   r   r   )NNT)rZ   r   rs   z3Callable[[Request], Awaitable[Response] | Response]ro   list[str] | NonerJ   r   rp   r   r   r   )rZ   r   rs   z&Callable[[WebSocket], Awaitable[None]]rJ   r   r   r   )rf   r   r   r   )
rZ   r   ro   r   rJ   r   rp   r   r   r   )rZ   r   rJ   r   r   r   )r   r   r   r   )__name__
__module____qualname____firstlineno____doc__r3   rC   propertyr0   rI   rQ   rT   rY   r]   rc   rg   rj   rr   rx   r   rs   r   r1   __static_attributes__ r5   r2   r   r      s   + -126DH9=:>-1/5/5/5 +/5 0	/5
 B/5 7/5 8/5 +/5 
/5b, " "=:043V/V V 	V
 
VD"7D "D 
	D88 8 
	8 %)"&ll Cl "	l
 l  l 
l  	@@ 6@ 	@
 
@  %)"& " 	
   
@(r5   )+
__future__r   r   collections.abcr   r   r   r   typingr   r	   r
   starlette.datastructuresr   r   starlette.middlewarer   r   starlette.middleware.baser   starlette.middleware.errorsr   starlette.middleware.exceptionsr   starlette.requestsr   starlette.responsesr   starlette.routingr   r   starlette.typesr   r   r   r   r   r   starlette.websocketsr   r   r    r   r   r5   r2   <module>r      sY    "  B B * * 3 ? 8 = ? & ( / U U *
);
/cN^ ^r5   