Files
cms-website/.deps_siteforge_v812/starlette/__pycache__/applications.cpython-312.pyc
T

96 lines
13 KiB
Plaintext
Raw Normal View History

Ë
ðÅÙjk(ãó—ddlmZddlZddlmZmZmZmZddlm Z m
Z
m Z ddl m
Z
mZddlmZmZddlmZddlmZdd lmZdd
lmZdd lmZdd lmZmZdd
lm Z m!Z!m"Z"m#Z#m$Z$m%Z%ddl&m'Z'e dd¬«Z(e
d«Z)Gd„d«Z*y)é)Ú 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óL—eZdZdZ d dd„Zdd„Zedd„«Zdd„Zdd„Z dd„Z
ddd „Z ddd
„Z dd „Z
dd „Z d d
„Z d! d"d„Z d d#d„Zd$d„Z d! d%d„Zdd&d„Zd'd„Zy)(rz!Creates an Starlette application.NcóЗ|� |€|�Jd«‚||_t«|_t||||¬«|_|€in
t |«|_|€gn
t|«|_d|_ y)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.
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 úZC:\Users\30997\AppData\Local\Temp\pip-target-6g32zz5s\lib\python\starlette/applications.pyÚ__init__zStarlette.__init__s{€ðLРJÐ$6¸;Ð;Nð
Ø Ló
ÐOðˆŒ
Ü“WˆŒ
ܘV°
È Ð^fÔgˆŒ Ø(:Ð(B¡"ÌÐM_ÓH`ˆÔØ%/Ð%7™r¼TÀ*Ó=MˆÔØ04ˆÕócóN—|j}d}i}|jj«D]\}}|dtfvr|}Œ|||<Œt t
||¬«g|j zt t||¬«gz}|j}t|«D]\}} }
||g| ¢­i|
¤Ž}Œ|S)Niô)Úhandlerr&)Úhandlersr&)
r&r*ÚitemsÚ Exceptionr
rr,rr(Úreversed) r.r&Ú
error_handlerr*ÚkeyÚvaluer0ÚappÚclsÚargsÚkwargss r1Úbuild_middleware_stackz Starlette.build_middleware_stackJsǀؗ
‘
ˆØˆ
Ø:<Ðà×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àˆ
r3có.—|jjS©N)r(r/)r.s r1r/zStarlette.routes`s€à�{‰{×!Ñ!Ð!r3c ó<—|jj|fi|¤ŽSrC)r(Ú url_path_for)r.ÚnameÚ path_paramss r1rEzStarlette.url_path_fords€Ø'ˆt�{‰{×'Ñ'¨Ñ<° Ñ<Ð<r3cƒó’K—||d<|j€|j«|_|j|||«ƒd{–—†y7Œ­w)Nr=)r-rA)r.ÚscopeÚreceiveÚsends r1Ú__call__zStarlette.__call__gsDèø€Øˆˆe‰ Ø × Ñ Ð (Ø$(×$?Ñ$?Ó$AˆDÔ !Ø×#Ñ# E¨7°DÓ9×9Ò9ús‚=A¿AÁAcó8—|jj|«SrC)r(Úon_event)r.Ú
event_types r1rNzStarlette.on_eventms€Ø�{‰{×#Ñ# JÓ/Ð/r3có@—|jj|||¬«y©N)r=rF)r(Úmount)r.Úpathr=rFs r1rRzStarlette.mountps€Ø � ‰ ×ј$ C¨dÐÕ3r3có@—|jj|||¬«yrQ)r(Úhost)r.rUr=rFs r1rUzStarlette.hostss€Ø � ‰ ×ј 3¨TÐÕ2r3có„—|j� td«‚|jjdt |g|¢­i|¤Ž«y)Nz6Cannot add middleware after an application has startedr)r-Ú RuntimeErrorr,Úinsertr
)r.Úmiddleware_classr?r@s r1Úadd_middlewarezStarlette.add_middlewarevsB€ð × Ñ Ð ,ÜÐWÓXÐ XØ ×Ñ×#Ñ# A¤zÐ2BÐ'TÀTÒ'TÈVÑ'TÕUr3có"—||j|<yrC)r*)r.Úexc_class_or_status_coder5s r1Úadd_exception_handlerzStarlette.add_exception_handler€s€ð
=Dˆ×ÑÐ 8Ò9r3có<—|jj||«yrC)r(Úadd_event_handler)r.rOÚfuncs r1r_zStarlette.add_event_handler‡s€ð
� ‰ ×%Ñ% j°$Õ7r3cóD—|jj|||||¬«y©N)ÚmethodsrFÚinclude_in_schema©r(Ú add_route)r.rSÚroutercrFrds r1rfzStarlette.add_routeŽs"€ð
� ‰ ×јd E°7ÀÐYjÐÕkr3có@—|jj|||¬«y©N)rF©r(Úadd_websocket_route)r.rSrgrFs r1rkzStarlette.add_websocket_route˜s€ð
� ‰ ×'Ñ'¨¨e¸$Ð'Õ?r3cóL‡‡—tjdt«dˆˆfd„ }|S)NzŸThe `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ó,•—‰j‰|«|SrC)r])r`r\r.s €€r1Ú decoratorz.Starlette.exception_handler.<locals>.decorator§sø€Ø × &Ñ &Ð'?ÀÔ F؈Kr3©r`rÚreturnr©ÚwarningsÚwarnÚDeprecationWarning)r.r\rns`` r1Úexception_handlerzStarlette.exception_handler s%ù€Ü�
‰
ð
Wä ô
ö  ðÐr3cóX‡‡‡‡‡—tjdt«dˆˆˆˆˆfd„ }|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://starlette.dev/routing/ for the recommended approach.cóH•—‰jj‰|‰‰‰¬«|Srbre)r`rdrcrFrSr.s €€€€€r1rnz"Starlette.route.<locals>.decoratorÁs0ø€Ø �K‰K× !Ñ !ØØØØØ"3ð
"ô
ðˆKr3rorq)r.rSrcrFrdrns````` r1rgzStarlette.route­s,ü€ô �
‰
ð
Tä ô
÷  ñ ðÐr3cóP‡‡‡—tjdt«dˆˆˆfd„ }|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://starlette.dev/routing/#websocket-routing for the recommended approach.cóD•—‰jj‰|‰¬«|Srirj)r`rFrSr.s €€€r1rnz,Starlette.websocket_route.<locals>.decoratorÛs!ø€Ø �K‰K× +Ñ +¨D°$¸TÐ +Ô B؈Kr3rorq)r.rSrFrns``` r1Úwebsocket_routezStarlette.websocket_routeÍs'ú€ô �
‰
ð
fä ô
÷  ðÐr3có`‡—tjdt«|dk(sJd«‚dˆfd„ }|S)zú