a c@sddlmZddlmZmZmZmZmZmZm Z m Z m Z m Z ddl mZddlmZmZddlmZmZddlmZmZddlmZddlmZdd lmZdd lmZm Z m!Z!dd l"m#Z#dd l$m%Z%dd l&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1ddl2m3Z3ddl4m5Z5ddl6m7Z7ddl8m9Z9ddl:m;Z;mm?Z?ddl@mAZAmBZBmCZCmDZDGddde+ZEdS))Enum) Any AwaitableCallable CoroutineDictListOptionalSequenceTypeUnion)routing)DefaultDefaultPlaceholder) DictIntStrAny SetIntStr)http_exception_handler$request_validation_exception_handler)RequestValidationError)logger)AsyncExitStackMiddleware)get_redoc_htmlget_swagger_ui_html#get_swagger_ui_oauth2_redirect_html) get_openapi)DependsDecoratedCallable)generate_unique_id) Starlette)State) HTTPException) Middleware)BaseHTTPMiddleware)ServerErrorMiddleware)ExceptionMiddleware)Request) HTMLResponse JSONResponseResponse) BaseRoute)ASGIAppReceiveScopeSendc"s eZdZdddddddddeedddddddddddddd dddd deed eeee e e e ee eee e e feee e e e e ffeeeeeee ee ee ee e e feeeee e eeefeee gee e efffeeege feeege fee ee e e e e ffee e e e e ffe e eee e ee fe e e ffeee eeeee e e feejge fe dd d d ZedddZe e e fdddZddddZee e!ddfdd Z"edddddddddddddd dddd eeddeede edee e effe eeeee e e#feeeee ee e ee e ee fe e e ffeeeee ee ee e$e%fee e$e%feeeeee eee&fee ee e e feejge fddddZ'edddddddddddddd dddd eeddeede e eeeee e e#feeeee ee e ee e ee fe e e ffeeeee ee ee e$e%fee e$e%feeeeeeeee ee e e feejge fee(ge(fddd Z)dHe ede fee dd!d"d#Z*dIe ee ee(ge(fd$d%d&Z+dddddd eedeed' ej,e eee e e#feeeee e ee fe e e ffeeeeeeee eejge fdd( d)d*Z-eddddddddddddd dddd eedddeed+e e eeeee e e#feeeee ee e ee e ee fe e e ffeeee ee e$e%fee e$e%feeeeeeeee eee ee e e feejge fee(ge(fd,d-d.Z.eddddddddddddd dddd eedddeed+e e eeeee e e#feeeee ee e ee e ee fe e e ffeeee ee e$e%fee e$e%feeeeeeeee eee ee e e feejge fee(ge(fd,d/d0Z/eddddddddddddd dddd eedddeed+e e eeeee e e#feeeee ee e ee e ee fe e e ffeeee ee e$e%fee e$e%feeeeeeeee eee ee e e feejge fee(ge(fd,d1d2Z0eddddddddddddd dddd eedddeed+e e eeeee e e#feeeee ee e ee e ee fe e e ffeeee ee e$e%fee e$e%feeeeeeeee eee ee e e feejge fee(ge(fd,d3d4Z1eddddddddddddd dddd eedddeed+e e eeeee e e#feeeee ee e ee e ee fe e e ffeeee ee e$e%fee e$e%feeeeeeeee eee ee e e feejge fee(ge(fd,d5d6Z2eddddddddddddd dddd eedddeed+e e eeeee e e#feeeee ee e ee e ee fe e e ffeeee ee e$e%fee e$e%feeeeeeeee eee ee e e feejge fee(ge(fd,d7d8Z3eddddddddddddd dddd eedddeed+e e eeeee e e#feeeee ee e ee e ee fe e e ffeeee ee e$e%fee e$e%feeeeeeeee eee ee e e feejge fee(ge(fd,d9d:Z4eddddddddddddd dddd eedddeed+e e eeeee e e#feeeee ee e ee e ee fe e e ffeeee ee e$e%fee e$e%feeeeeeeee eee ee e e feejge fee(ge(fd,d;d<Z5dJe e e dfee(ge(fd$d=d>Z6e ee(ge(fd?d@dAZ7e ee(ge(fdBdCdDZ8e eeefee(ge(fdEdFdGZ9Z:S)KFastAPIFNz0.1.0z /openapi.jsonz/docsz/redocz/docs/oauth2-redirectT)debugroutestitle descriptionversion openapi_url openapi_tagsservers dependenciesdefault_response_classdocs_url redoc_urlswagger_ui_oauth2_redirect_urlswagger_ui_init_oauth middlewareexception_handlers on_startup on_shutdownterms_of_servicecontact license_infoopenapi_prefix root_pathroot_path_in_servers responses callbacks deprecatedinclude_in_schemaswagger_ui_parametersgenerate_unique_id_function) r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNextrareturnc Ks<||_||_||_||_||_||_||_||_||_||_ | |_ | |_ | |_ ||_ ||_|p`g|_||_d|_d|_|jr|jsJd|jsJd|rtd|p||_t|_i|_tj||||| | |||||d |_|durint||_|jtt |jt!t"|dur gnt#||_$d|_%|&dS)Nz3.0.2z4A title must be provided for OpenAPI, e.g.: 'My API'z5A version must be provided for OpenAPI, e.g.: '2.1.0'z"openapi_prefix" has been deprecated in favor of "root_path", which follows more closely the ASGI standard, is simpler, and more automatic. Check the docs at https://fastapi.tiangolo.com/advanced/sub-applications/) r2Zdependency_overrides_providerrArBr:r9rJrKrLrIrN)'r1r3r4r5rCrDrEr6r7rHr;r<r=r>rMr8rOopenapi_versionopenapi_schemarwarningrGr stateZdependency_overridesr APIRouterrouterdictr@ setdefaultr!rrrlistuser_middlewareZmiddleware_stacksetup) selfr1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrMrNrOr]a/workspaces/shunt/resources/test-fastapi/venv/lib/python3.9/site-packages/fastapi/applications.py__init__0sh*  zFastAPI.__init__)rPc Cs|j}d}i}|jD]"\}}|dtfvr2|}q|||<qtt||dg|jtt||dttg}|j }t |D]\}} |fd|i| }qv|S)Ni)handlerr1)handlersr1app) r1r@items Exceptionr"r$rZr%rrVreversed) r\r1Z error_handlerr@keyvaluer?rbclsoptionsr]r]r^build_middleware_stacks*  zFastAPI.build_middleware_stackc Cs>|js8t|j|j|j|j|j|j|j|j |j |j d |_|jS)N) r3r5rQr4rCrDrEr2tagsr8) rRrr3r5rQr4rCrDrEr2r7r8r\r]r]r^openapis zFastAPI.openapicsjrLddjD}dd|Dttdfdd }jj|dd jrjrttdfd d }jj|dd jrttdd d }jj|dd jr؈jrttdfdd }jj|dd dS)Ncss|]}|dVqdS)urlN)get).0Z server_datar]r]r^ z FastAPI.setup..cSsh|] }|r|qSr]r])rprnr]r]r^ rrz FastAPI.setup..)reqrPcsN|jddd}|vrB|rBjrBjdd|i|tS)NrGr0/rrn) scoperorstriprHr8insertaddr(rm)rtrGr\Z server_urlsr]r^rms   zFastAPI.setup..openapiF)rLcsL|jddd}|j}j}|r0||}t|jd|jjdS)NrGr0ruz - Swagger UI)r6r3oauth2_redirect_urlZ init_oauthrM) rvrorwr6r=rr3r>rM)rtrGr6r{rlr]r^swagger_ui_htmls z&FastAPI.setup..swagger_ui_htmlcstSN)r)rtr]r]r^swagger_ui_redirectsz*FastAPI.setup..swagger_ui_redirectcs0|jddd}|j}t|jddS)NrGr0ruz - ReDoc)r6r3)rvrorwr6rr3)rtrGr6rlr]r^ redoc_htmls   z!FastAPI.setup..redoc_html) r6r8r&r(Z add_router;r'r=r<)r\urlsrmr|r~rr]rzr^r[s$  z FastAPI.setup)rvreceivesendrPcs*|jr|j|d<t|||IdHdS)NrG)rGsuper__call__)r\rvrr __class__r]r^r s zFastAPI.__call__zSuccessful Responseresponse_model status_coderkr9summaryr4response_descriptionrIrKmethods operation_idresponse_model_includeresponse_model_excluderesponse_model_by_aliasresponse_model_exclude_unsetresponse_model_exclude_defaultsresponse_model_exclude_nonerLresponse_classname openapi_extrarN.)pathendpointrrrkr9rr4rrIrKrrrrrrrrrLrrrrNrPcCs@|jj||||||||| | | | | |||||||||||ddS)N)rrrrkr9rr4rrIrKrrrrrrrrrLrrrrNrV add_api_route)r\rrrrrkr9rr4rrIrKrrrrrrrrrLrrrrNr]r]r^rs4 zFastAPI.add_api_route)rrrrkr9rr4rrIrKrrrrrrrrrLrrrrNrPcsFttd fdd }|S)NfuncrPcs@jj |    d|S)Nrrrr9rKr4rNrLrrrrrrrrrrrrrrrIr\rrrkr]r^ decoratoris6z$FastAPI.api_route..decoratorr)r\rrrrkr9rr4rrIrKrrrrrrrrrLrrrrNrr]rr^ api_routeLsBzFastAPI.api_route)rrrrPcCs|jj|||ddSN)r)rVadd_api_websocket_route)r\rrrr]r]r^rszFastAPI.add_api_websocket_route)rrrPcsttdfdd }|S)Nrcsj|d|Sr)rrrrr\r]r^rsz$FastAPI.websocket..decoratorrr\rrrr]rr^ websocketszFastAPI.websocket prefixrkr9rIrKrLr:rJrN) rVrrkr9rIrKrLr:rJrNrPc Cs$|jj||||||||| | d dS)Nr)rVinclude_router) r\rVrrkr9rIrKrLr:rJrNr]r]r^rszFastAPI.include_routerrrrkr9rr4rrIrKrrrrrrrrLrrrJrrN)rrrrkr9rr4rrIrKrrrrrrrrLrrrJrrNrPcCs:|jj||||||||| | | | | ||||||||||dSNr)rVror\rrrrkr9rr4rrIrKrrrrrrrrLrrrJrrNr]r]r^ros2z FastAPI.getcCs:|jj||||||||| | | | | ||||||||||dSr)rVputrr]r]r^rs2z FastAPI.putcCs:|jj||||||||| | | | | ||||||||||dSr)rVpostrr]r]r^r!s2z FastAPI.postcCs:|jj||||||||| | | | | ||||||||||dSr)rVdeleterr]r]r^rXs2zFastAPI.deletecCs:|jj||||||||| | | | | ||||||||||dSr)rVrirr]r]r^ris2zFastAPI.optionscCs:|jj||||||||| | | | | ||||||||||dSr)rVheadrr]r]r^rs2z FastAPI.headcCs:|jj||||||||| | | | | ||||||||||dSr)rVpatchrr]r]r^rs2z FastAPI.patchcCs:|jj||||||||| | | | | ||||||||||dSr)rVtracerr]r]r^r4s2z FastAPI.tracecsttdfdd }|S)Nrcsjj|d|Sr)rVZadd_websocket_routerrr]r^rnsz*FastAPI.websocket_route..decoratorrrr]rr^websocket_routekszFastAPI.websocket_route) event_typerPcCs |j|Sr})rVon_event)r\rr]r]r^rtszFastAPI.on_event)middleware_typerPcsttdfdd }|S)Nrcsjt|d|S)N)dispatch)Zadd_middlewarer#rrlr]r^r|sz%FastAPI.middleware..decoratorr)r\rrr]rlr^r?yszFastAPI.middleware)exc_class_or_status_coderPcsttdfdd }|S)Nrcs||Sr})Zadd_exception_handlerrrr\r]r^rs z,FastAPI.exception_handler..decoratorr)r\rrr]rr^exception_handlerszFastAPI.exception_handler)N)N)N);__name__ __module__ __qualname__rr(rboolr rr*strrrr r rr r)r"intrdrr&rr ZAPIRouter_r+rjrmr[r-r,r.rrrrrrrrrrrUrrorrrrirrrrrr?r __classcell__r]r]rr^r//s     f15    ?   =     !   ;   ;   ;   ;   ;   ;   ;   8     r/N)Fenumrtypingrrrrrrr r r r Zfastapir Zfastapi.datastructuresrrZfastapi.encodersrrZfastapi.exception_handlersrrZfastapi.exceptionsrZfastapi.loggerrZ!fastapi.middleware.asyncexitstackrZfastapi.openapi.docsrrrZfastapi.openapi.utilsrZfastapi.paramsrZ fastapi.typesrZ fastapi.utilsrZstarlette.applicationsrZstarlette.datastructuresr Zstarlette.exceptionsr!Zstarlette.middlewarer"Zstarlette.middleware.baser#Zstarlette.middleware.errorsr$Zstarlette.middleware.exceptionsr%Zstarlette.requestsr&Zstarlette.responsesr'r(r)Zstarlette.routingr*Zstarlette.typesr+r,r-r.r/r]r]r]r^s2 0