Ë
    +Œ:j)  ã                   óÔ   — d dl Z d dlZd dlmZmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZ d d	lmZmZ d d
lmZmZmZmZmZ  e j4                  dd¬«      Z G d„ d«      Zy)é    N)ÚStateÚURLPath)Ú
Middleware)ÚBaseHTTPMiddleware)ÚServerErrorMiddleware)ÚExceptionMiddleware)ÚRequest)ÚResponse)Ú	BaseRouteÚRouter)ÚASGIAppÚLifespanÚReceiveÚScopeÚSendÚAppTypeÚ	Starlette)Úboundc                   óæ  — e Zd ZdZ	 	 	 	 	 	 	 d1dddedej                  ej                  e      dej                  ej                  e	      dej                  ej                  ej                  ej                  eegej                  eej"                  e   f   f   f      d	ej                  ej                  ej                        d
ej                  ej                  ej                        dej                  ed      ddfd„Zdefd„Zedej.                  e   fd„«       Zdedej                  defd„Zdedededdfd„Zdedej                  fd„Z 	 d2dededej                  e   ddfd„Z!	 d2dededej                  e   ddfd„Z"de#d ej                  ddfd!„Z$d"ej                  e%ejL                  e   f   d#ej                  ddfd$„Z'ded%ej                  ddfd&„Z(	 	 	 d3ded'ej                  d(ej                  ej.                  e      dej                  e   d)eddfd*„Z)	 d2ded'ej                  dej                  e   ddfd+„Z*d"ej                  e%ejL                  e   f   dej                  fd,„Z+	 	 	 d3ded(ej                  ej.                  e      dej                  e   d)edej                  f
d-„Z,	 d2dedej                  e   dej                  fd.„Z-d/edej                  fd0„Z.y)4r   aL  
    Creates an application instance.

    **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 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 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 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.
    NÚselfr   ÚdebugÚroutesÚ
middlewareÚexception_handlersÚ
on_startupÚon_shutdownÚlifespanÚreturnc                 óÐ   — |�|€|�J d«       ‚|| _         t        «       | _        t        ||||¬«      | _        |€i n
t        |«      | _        |€g n
t        |«      | _        d | _	        y )Nz>Use either 'lifespan' or 'on_startup'/'on_shutdown', not both.)r   r   r   )
r   r   Ústater   ÚrouterÚdictr   ÚlistÚuser_middlewareÚmiddleware_stack)r   r   r   r   r   r   r   r   s           úX/var/www/html/tokenscope/api/venv/lib/python3.12/site-packages/starlette/applications.pyÚ__init__zStarlette.__init__/   sˆ   € ð( ÐØÐ ;Ð#6ð	LàKó	Lð 
ð ˆŒ
Ü“WˆŒ
ÜØ˜z°{ÈXô
ˆŒð %Ð,‰B´$Ð7IÓ2Jð 	Ôð &0Ð%7™r¼TÀ*Ó=MˆÔØ:>ˆÕó    c                 óH  — | j                   }d }i }| j                  j                  «       D ]  \  }}|dt        fv r|}Œ|||<   Œ t	        t
        ||¬«      g| j                  z   t	        t        ||¬«      gz   }| j                  }t        |«      D ]  \  }}	 |dd|i|	¤Ž}Œ |S )Niô  )Úhandlerr   )Úhandlersr   Úapp© )
r   r   ÚitemsÚ	Exceptionr   r   r$   r   r!   Úreversed)
r   r   Úerror_handlerr   ÚkeyÚvaluer   r,   ÚclsÚoptionss
             r&   Úbuild_middleware_stackz Starlette.build_middleware_stackR   sÖ   € Ø—
‘
ˆØˆð ð 	ð ×1Ñ1×7Ñ7Ó9ò 	0‰JˆC�Ø�sœIÐ&Ñ&Ø %‘à*/Ð" 3Ò'ð		0ô Ô-°}ÈEÔRÐSØ×"Ñ"ñ#ô Ü'Ð2DÈEôðñð 	ð �k‰kˆÜ$ ZÓ0ò 	*‰LˆC�ÙÑ)˜#Ð) Ñ)‰Cð	*àˆ
r(   c                 ó.   — | j                   j                  S ©N)r!   r   )r   s    r&   r   zStarlette.routesn   s   € à�{‰{×!Ñ!Ð!r(   Ú_Starlette__nameÚpath_paramsc                 ó<   —  | j                   j                  |fi |¤ŽS r8   )r!   Úurl_path_for)r   r9   r:   s      r&   r<   zStarlette.url_path_fors   s   € Ø'ˆt�{‰{×'Ñ'¨Ñ>°+Ñ>Ð>r(   ÚscopeÚreceiveÚsendc              ƒ   ó’   K  — | |d<   | j                   €| j                  «       | _         | j                  |||«      ƒ d {  –—†  y 7 Œ­w)Nr,   )r%   r6   )r   r=   r>   r?   s       r&   Ú__call__zStarlette.__call__v   sD   è ø€ Øˆˆe‰Ø× Ñ Ð(Ø$(×$?Ñ$?Ó$AˆDÔ!Ø×#Ñ# E¨7°DÓ9×9Ò9ús   ‚=A¿AÁ AÚ
event_typec                 ó8   — | j                   j                  |«      S r8   )r!   Úon_event)r   rB   s     r&   rD   zStarlette.on_event|   s   € Ø�{‰{×#Ñ# JÓ/Ð/r(   Úpathr,   Únamec                 ó@   — | j                   j                  |||¬«       y ©N)r,   rF   )r!   Úmount)r   rE   r,   rF   s       r&   rI   zStarlette.mount   s   € ð 	�‰×Ñ˜$ C¨dÐÕ3r(   Úhostc                 ó@   — | j                   j                  |||¬«       y rH   )r!   rJ   )r   rJ   r,   rF   s       r&   rJ   zStarlette.host„   s   € ð 	�‰×Ñ˜ 3¨TÐÕ2r(   Úmiddleware_classr5   c                 ó~   — | j                   �t        d«      ‚| j                  j                  dt	        |fi |¤Ž«       y )Nz6Cannot add middleware after an application has startedr   )r%   ÚRuntimeErrorr$   Úinsertr   )r   rL   r5   s      r&   Úadd_middlewarezStarlette.add_middleware‰   s;   € Ø× Ñ Ð,ÜÐWÓXÐXØ×Ñ×#Ñ# A¤zÐ2BÑ'NÀgÑ'NÕOr(   Úexc_class_or_status_coder*   c                 ó"   — || j                   |<   y r8   )r   )r   rQ   r*   s      r&   Úadd_exception_handlerzStarlette.add_exception_handlerŽ   s   € ð
 =Dˆ×ÑÐ 8Ò9r(   Úfuncc                 ó<   — | j                   j                  ||«       y r8   )r!   Úadd_event_handler)r   rB   rT   s      r&   rV   zStarlette.add_event_handler•   s   € ð 	�‰×%Ñ% j°$Õ7r(   ÚrouteÚmethodsÚinclude_in_schemac                 óD   — | j                   j                  |||||¬«       y ©N)rX   rF   rY   ©r!   Ú	add_route)r   rE   rW   rX   rF   rY   s         r&   r]   zStarlette.add_routeš   s'   € ð 	�‰×ÑØ�% ¨tÐGXð 	õ 	
r(   c                 ó@   — | j                   j                  |||¬«       y ©N)rF   ©r!   Úadd_websocket_route)r   rE   rW   rF   s       r&   ra   zStarlette.add_websocket_route¦   s   € ð 	�‰×'Ñ'¨¨e¸$Ð'Õ?r(   c                 óŒ   ‡ ‡— t        j                  dt        «       dt        j                  dt        j                  fˆˆ fd„}|S )Nz¢The `exception_handler` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://www.starlette.io/exceptions/ for the recommended approach.rT   r   c                 ó,   •— ‰j                  ‰| «       | S r8   )rS   )rT   rQ   r   s    €€r&   Ú	decoratorz.Starlette.exception_handler.<locals>.decorator´   s   ø€ Ø×&Ñ&Ð'?ÀÔFØˆKr(   ©ÚwarningsÚwarnÚDeprecationWarningÚtypingÚCallable)r   rQ   rd   s   `` r&   Úexception_handlerzStarlette.exception_handler«   s=   ù€ ô 	�‰ðZäô	
ð	œFŸO™Oð 	´·±ö 	ð Ðr(   c                 ó˜   ‡ ‡‡‡‡— t        j                  dt        «       dt        j                  dt        j                  fˆˆˆˆˆ fd„}|S )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)
        z“The `route` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://www.starlette.io/routing/ for the recommended approach.rT   r   c                 óH   •— ‰j                   j                  ‰| ‰‰‰¬«       | S r[   r\   )rT   rY   rX   rF   rE   r   s    €€€€€r&   rd   z"Starlette.route.<locals>.decoratorÎ   s0   ø€ Ø�K‰K×!Ñ!ØØØØØ"3ð "ô ð ˆKr(   re   )r   rE   rX   rF   rY   rd   s   ````` r&   rW   zStarlette.routeº   sB   ü€ ô 	�‰ðWäô	
ð	œFŸO™Oð 	´·±÷ 	ñ 	ð Ðr(   c                 ó�   ‡ ‡‡— t        j                  dt        «       dt        j                  dt        j                  fˆˆˆ fd„}|S )a  
        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)
        z¯The `websocket_route` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://www.starlette.io/routing/#websocket-routing for the recommended approach.rT   r   c                 óD   •— ‰j                   j                  ‰| ‰¬«       | S r_   r`   )rT   rF   rE   r   s    €€€r&   rd   z,Starlette.websocket_route.<locals>.decoratorê   s!   ø€ Ø�K‰K×+Ñ+¨D°$¸TÐ+ÔBØˆKr(   re   )r   rE   rF   rd   s   ``` r&   Úwebsocket_routezStarlette.websocket_routeÚ   s=   ú€ ô 	�‰ðiäô	
ð	œFŸO™Oð 	´·±÷ 	ð Ðr(   Úmiddleware_typec                 ó    ‡ — t        j                  dt        «       |dk(  sJ d«       ‚dt        j                  dt        j                  fˆ fd„}|S )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)
        z¨The `middleware` decorator is deprecated, and will be removed in version 1.0.0. Refer to https://www.starlette.io/middleware/#using-middleware for recommended approach.Úhttpz/Currently only middleware("http") is supported.rT   r   c                 ó6   •— ‰j                  t        | ¬«       | S )N)Údispatch)rP   r   )rT   r   s    €r&   rd   z'Starlette.middleware.<locals>.decorator  s   ø€ Ø×ÑÔ 2¸TÐÔBØˆKr(   re   )r   rq   rd   s   `  r&   r   zStarlette.middlewareð   sW   ø€ ô 	�‰ðgäô	
ð ˜vÒ%ð	=à<ó	=Ø%ð	œFŸO™Oð 	´·±õ 	ð Ðr(   )FNNNNNNr8   )NNT)/Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úboolri   ÚOptionalÚSequencer   r   ÚMappingÚAnyrj   r	   r/   ÚUnionr
   Ú	Awaitabler   r'   r   r6   ÚpropertyÚListr   Ústrr   r<   r   r   r   rA   rD   rI   rJ   ÚtyperP   ÚintÚTyperS   rV   r]   ra   rk   rW   rp   r   r-   r(   r&   r   r      s!  „ ñð> Ø>BØCGð ØHLØIMØ9=ñ!!?Øð!?àð!?ð —‘ §¡°	Ñ :Ñ;ð!?ð —O‘O F§O¡O°JÑ$?Ñ@ð	!?ð
 #ŸO™OØ�N‰NØ—
‘
Ø—‘Ø˜iÐ(Ø—L‘L ¨6×+;Ñ+;¸HÑ+EÐ!EÑFðHñðññ
ð!?ð —O‘O F§O¡O°F·O±OÑ$DÑEð!?ð —_‘_ V§_¡_°V·_±_Ñ%EÑFð!?ð  —/‘/ (¨9Ñ"5Ñ6ð!!?ð" 
ó#!?ðF¨ó ð8 ð"˜Ÿ™ IÑ.ò "ó ð"ð? 3ð ?°v·z±zð ?Àgó ?ð: Eð :°Gð :À4ð :ÈDó :ð0 3ð 0¨6¯?©?ó 0ð EIñ4Øð4Ø%ð4Ø-3¯_©_¸SÑ-Að4à	ó4ð EIñ3Øð3Ø%ð3Ø-3¯_©_¸SÑ-Að3à	ó3ð
P¨tð PÀÇ
Á
ð PÈtó Pð
Dà"(§,¡,¨s°F·K±KÀ	Ñ4JÐ/JÑ"KðDð —‘ðDð 
ó	Dð8Øð8Ø%+§_¡_ð8à	ó8ð 6:Ø%)Ø"&ñ

àð

ð �‰ð

ð —‘ §¡¨SÑ!1Ñ2ð	

ð
 �o‰o˜cÑ"ð

ð  ð

ð 
ó

ð OSñ@Øð@Ø &§¡ð@Ø7=·±ÀsÑ7Kð@à	ó@ð
Ø(.¯©°S¸&¿+¹+ÀiÑ:PÐ5PÑ(Qðà	�‰óð$ 6:Ø%)Ø"&ñàðð —‘ §¡¨SÑ!1Ñ2ðð �o‰o˜cÑ"ð	ð
  ðð 
�‰óðB 7;ñØðØ%Ÿ™¨sÑ3ðà	�‰óð,¨#ð °&·/±/ô r(   )ri   rf   Ústarlette.datastructuresr   r   Ústarlette.middlewarer   Ústarlette.middleware.baser   Ústarlette.middleware.errorsr   Ústarlette.middleware.exceptionsr   Ústarlette.requestsr	   Ústarlette.responsesr
   Ústarlette.routingr   r   Ústarlette.typesr   r   r   r   r   ÚTypeVarr   r   r-   r(   r&   ú<module>r‘      sG   ðÛ Û ç 3Ý +Ý 8Ý =Ý ?Ý &Ý (ß /ß CÕ Cà
ˆ&�.‰.˜¨+Ô
6€÷tò tr(   