Ë
    $V.jÏ(  ã                  óD  — d dl mZ d dlZd dlZd dlZej
                  dk\  rd dlmZ nd dlmZ d dlm	Z	m
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mZ d dlmZmZmZmZm Z m!Z! d dl"m#Z#  ejH                  dd¬«      Z% ed«      Z& G d„ d«      Z'y)é    )ÚannotationsN)é   é
   )Ú	ParamSpec)ÚStateÚURLPath)Ú
MiddlewareÚ_MiddlewareFactory)ÚBaseHTTPMiddleware)ÚServerErrorMiddleware)ÚExceptionMiddleware)ÚRequest)ÚResponse)Ú	BaseRouteÚRouter)ÚASGIAppÚExceptionHandlerÚLifespanÚReceiveÚScopeÚSend)Ú	WebSocketÚAppTypeÚ	Starlette)ÚboundÚPc                  óL  — e Zd ZdZ	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdd„Zedd„«       Zdd„Zdd„Z	dd„Z
ddd	„Zddd
„Z	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 dd„Z	 	 	 	 	 	 d d„Z	 	 	 d!	 	 	 	 	 	 	 	 	 	 	 d"d„Z	 d	 	 	 	 	 	 	 d#d„Zd$d„Z	 	 	 d!	 	 	 	 	 	 	 	 	 d%d„Zdd&d„Zd'd„Zy)(r   aC  
    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 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.
    Nc                óÐ   — |�|€|�J d«       ‚|| _         t        «       | _        t        ||||¬«      | _        |€i n
t        |«      | _        |€g n
t        |«      | _        d | _	        y )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           úXC:\xampp\htdocs\tradingbinance\backend\.venv\Lib\site-packages\starlette/applications.pyÚ__init__zStarlette.__init__9   s   € ð ÐØÐ ;Ð#6ð	LàKó	Lð 
ð ˆŒ
Ü“WˆŒ
Ü˜V°
ÈÐ^fÔgˆŒØ(:Ð(B¡"ÌÐM_ÓH`ˆÔØ%/Ð%7™r¼TÀ*Ó=MˆÔØ04ˆÕó    c                óN  — | j                   }d }i }| j                  j                  «       D ]  \  }}|dt        fv r|}Œ|||<   Œ t	        t
        ||¬«      g| j                  z   t	        t        ||¬«      gz   }| j                  }t        |«      D ]  \  }}	}
 ||g|	¢­i |
¤Ž}Œ |S )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_stackz Starlette.build_middleware_stackP   sÇ   € Ø—
‘
ˆØˆØ`bÐà×1Ñ1×7Ñ7Ö9‰JˆC�Ø�sœIÐ&Ñ&Ø %‘à*/Ð" 3Ò'ð	 :ô Ô-°}ÈEÔRÐSØ×"Ñ"ñ#äÔ-Ð8JÐRWÔXÐYñZð 	ð �k‰kˆÜ!)¨*Ö!5ÑˆC��vÙ�cÐ+˜DÒ+ FÑ+‰Cð "6àˆ
r/   c                ó.   — | j                   j                  S ©N)r$   r+   )r*   s    r-   r+   zStarlette.routesf   s   € à�{‰{×!Ñ!Ð!r/   c               ó<   —  | j                   j                  |fi |¤ŽS r?   )r$   Úurl_path_for)r*   ÚnameÚpath_paramss      r-   rA   zStarlette.url_path_forj   s   € Ø'ˆt�{‰{×'Ñ'¨Ñ<°Ñ<Ð<r/   c              ƒ  ó’   K  — | |d<   | j                   €| j                  «       | _         | j                  |||«      ƒ d {  –—†  y 7 Œ­w)Nr9   )r)   r=   )r*   ÚscopeÚreceiveÚsends       r-   Ú__call__zStarlette.__call__m   sD   è ø€ Øˆˆe‰Ø× Ñ Ð(Ø$(×$?Ñ$?Ó$AˆDÔ!Ø×#Ñ# E¨7°DÓ9×9Ò9ús   ‚=A¿AÁ Ac                ó8   — | j                   j                  |«      S r?   )r$   Úon_event)r*   Ú
event_types     r-   rJ   zStarlette.on_events   s   € Ø�{‰{×#Ñ# JÓ/Ð/r/   c                ó@   — | j                   j                  |||¬«       y ©N)r9   rB   )r$   Úmount)r*   Úpathr9   rB   s       r-   rN   zStarlette.mountv   s   € Ø�‰×Ñ˜$ C¨dÐÕ3r/   c                ó@   — | j                   j                  |||¬«       y rM   )r$   Úhost)r*   rQ   r9   rB   s       r-   rQ   zStarlette.hosty   s   € Ø�‰×Ñ˜ 3¨TÐÕ2r/   c                ó„   — | j                   �t        d«      ‚| j                  j                  dt	        |g|¢­i |¤Ž«       y )Nz6Cannot add middleware after an application has startedr   )r)   ÚRuntimeErrorr(   Úinsertr	   )r*   Úmiddleware_classr;   r<   s       r-   Úadd_middlewarezStarlette.add_middleware|   sB   € ð × Ñ Ð,ÜÐWÓXÐXØ×Ñ×#Ñ# A¤zÐ2BÐ'TÀTÒ'TÈVÑ'TÕUr/   c                ó"   — || j                   |<   y r?   )r&   )r*   Úexc_class_or_status_coder1   s      r-   Úadd_exception_handlerzStarlette.add_exception_handler†   s   € ð
 =Dˆ×ÑÐ 8Ò9r/   c                ó<   — | j                   j                  ||«       y r?   )r$   Úadd_event_handler)r*   rK   Úfuncs      r-   r[   zStarlette.add_event_handler�   s   € ð
 	�‰×%Ñ% j°$Õ7r/   c                óD   — | j                   j                  |||||¬«       y ©N)ÚmethodsrB   Úinclude_in_schema©r$   Ú	add_route)r*   rO   Úrouter_   rB   r`   s         r-   rb   zStarlette.add_route”   s"   € ð 	�‰×Ñ˜d E°7ÀÐYjÐÕkr/   c                ó@   — | j                   j                  |||¬«       y ©N)rB   ©r$   Úadd_websocket_route)r*   rO   rc   rB   s       r-   rg   zStarlette.add_websocket_routež   s   € ð 	�‰×'Ñ'¨¨e¸$Ð'Õ?r/   c                óL   ‡ ‡— t        j                  dt        «       dˆˆ 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.c                ó,   •— ‰j                  ‰| «       | S r?   )rY   )r\   rX   r*   s    €€r-   Ú	decoratorz.Starlette.exception_handler.<locals>.decorator­   s   ø€ Ø×&Ñ&Ð'?ÀÔFØˆKr/   ©r\   útyping.CallableÚreturnrl   ©ÚwarningsÚwarnÚDeprecationWarning)r*   rX   rj   s   `` r-   Úexception_handlerzStarlette.exception_handler¦   s%   ù€ Ü�‰ðZäô	
ö	ð Ðr/   c                óX   ‡ ‡‡‡‡— t        j                  dt        «       dˆˆˆˆˆ 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.c                óH   •— ‰j                   j                  ‰| ‰‰‰¬«       | S r^   ra   )r\   r`   r_   rB   rO   r*   s    €€€€€r-   rj   z"Starlette.route.<locals>.decoratorÇ   s0   ø€ Ø�K‰K×!Ñ!ØØØØØ"3ð "ô ð ˆKr/   rk   rn   )r*   rO   r_   rB   r`   rj   s   ````` r-   rc   zStarlette.route³   s,   ü€ ô 	�‰ðWäô	
÷	ñ 	ð Ðr/   c                óP   ‡ ‡‡— t        j                  dt        «       dˆˆˆ 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.c                óD   •— ‰j                   j                  ‰| ‰¬«       | S re   rf   )r\   rB   rO   r*   s    €€€r-   rj   z,Starlette.websocket_route.<locals>.decoratorá   s!   ø€ Ø�K‰K×+Ñ+¨D°$¸TÐ+ÔBØˆKr/   rk   rn   )r*   rO   rB   rj   s   ``` r-   Úwebsocket_routezStarlette.websocket_routeÓ   s'   ú€ ô 	�‰ðiäô	
÷	ð Ðr/   c                ó`   ‡ — t        j                  dt        «       |dk(  sJ d«       ‚dˆ 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.c                ó6   •— ‰j                  t        | ¬«       | S )N)Údispatch)rV   r   )r\   r*   s    €r-   rj   z'Starlette.middleware.<locals>.decoratorö   s   ø€ Ø×ÑÔ 2¸TÐÔBØˆKr/   rk   rn   )r*   Úmiddleware_typerj   s   `  r-   r,   zStarlette.middlewareç   s=   ø€ ô 	�‰ðgäô	
ð
  &Ò(Ð[Ð*[Ó[Ð(õ	ð Ðr/   )FNNNNNN)r*   r   r"   Úboolr+   z!typing.Sequence[BaseRoute] | Noner,   z"typing.Sequence[Middleware] | Noner&   z3typing.Mapping[typing.Any, ExceptionHandler] | Noner   ú7typing.Sequence[typing.Callable[[], typing.Any]] | Noner    r~   r!   zLifespan[AppType] | Nonerm   ÚNone)rm   r   )rm   zlist[BaseRoute])rB   ÚstrrC   z
typing.Anyrm   r   )rE   r   rF   r   rG   r   rm   r   )rK   r€   rm   rl   r?   )rO   r€   r9   r   rB   ú
str | Nonerm   r   )rQ   r€   r9   r   rB   r�   rm   r   )rU   z_MiddlewareFactory[P]r;   zP.argsr<   zP.kwargsrm   r   )rX   úint | type[Exception]r1   r   rm   r   )rK   r€   r\   rl   rm   r   )NNT)rO   r€   rc   zAtyping.Callable[[Request], typing.Awaitable[Response] | Response]r_   úlist[str] | NonerB   r�   r`   r}   rm   r   )rO   r€   rc   z4typing.Callable[[WebSocket], typing.Awaitable[None]]rB   r�   rm   r   )rX   r‚   rm   rl   )
rO   r€   r_   rƒ   rB   r�   r`   r}   rm   rl   )rO   r€   rB   r�   rm   rl   )r|   r€   rm   rl   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r.   r=   Úpropertyr+   rA   rH   rJ   rN   rQ   rV   rY   r[   rb   rg   rr   rc   rw   r,   © r/   r-   r   r      sü  „ ñð> Ø48Ø9=ØRVØNRØOSØ-1ð5Øð5àð5ð 2ð5ð 7ð	5ð
 Pð5ð Lð5ð Mð5ð +ð5ð 
ó5ó.ð, ò"ó ð"ó=ó:ó0ô4ô3ðVà/ðVð ðVð ð	Vð
 
óVðDà"7ðDð "ðDð 
ó	Dð8àð8ð ð8ð 
ó	8ð %)ØØ"&ðlàðlð Qðlð "ð	lð
 ðlð  ðlð 
ólð  ð	@àð@ð Dð@ð ð	@ð
 
ó@óð  %)ØØ"&ðàðð "ðð ð	ð
  ðð 
óô@ô(r/   )(Ú
__future__r   ÚsysÚtypingro   Úversion_infor   Útyping_extensionsÚ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   ÚTypeVarr   r   r   r‰   r/   r-   Ú<module>rš      sm   ðÝ "ã 
Û Û à×Ñ�wÒÞ å+ç 3ß ?Ý 8Ý =Ý ?Ý &Ý (ß /ß U× UÝ *à
ˆ&�.‰.˜¨+Ô
6€ÙˆcƒN€÷_ò _r/   