6V=j@ddlmZddlZddlmZddlmZddlmZddlm Z ddl m Z dd l m Z dd l m Z dd l mZdd lmZdd lmZddlmZejrddlmZddlmZddlmZd*dZGddeZGddeZd+dZd,d#Zd-d%Zd.d'Z d/d(Z!d0d)Z"dS)1) annotationsN) BaseLoader) Environment)Template)TemplateNotFound)_cv_app) _cv_request) current_app)request)stream_with_context)before_render_template)template_rendered)Flask)App)Scaffoldreturndict[str, t.Any]ctjd}tjd}i}| |j|d<| |j|d<|S)zDefault template context processor. Replaces the ``request`` and ``g`` proxies with their concrete objects for faster access. Ngr )r getr rr )appctxreqctxrvs >C:\PYTHON\_runtimes\venv\Lib\site-packages\flask/templating.py_default_template_ctx_processorrsP[  F _T " "FB (3 9  IceZdZdZd dZd S) rzWorks like a regular Jinja environment but has some additional knowledge of how Flask's blueprint works so that it can prepend the name of the blueprint to referenced templates if necessary. approptionst.AnyrNonec nd|vr||d<tj|fi|||_dS)Nloader)create_global_jinja_loaderBaseEnvironment__init__r)selfrr s rr'zEnvironment.__init__.sG 7 " " # > > @ @GH  11111rN)rrr r!rr")__name__ __module__ __qualname____doc__r'rrrr(s2 rrcBeZdZdZddZdd Zdd ZddZddZddZ dS)DispatchingJinjaLoaderz\A loader that looks for templates in the application and all the blueprint folders. rrrr"c||_dSN)r)r(rs rr'zDispatchingJinjaLoader.__init__:s r environmentr&templatestr3tuple[str, str | None, t.Callable[[], bool] | None]c~|jjdr|||S|||S)NEXPLAIN_TEMPLATE_LOADING)rconfig_get_source_explained_get_source_fast)r(r2r3s r get_sourcez!DispatchingJinjaLoader.get_source=sC 8?5 6 E--k8DD D$$[(;;;rc"g}d}||D]K\}} |||}||}n#t$rd}YnwxYw||||fLddlm}||j||||St|)Nr)!explain_template_loading_attempts) _iter_loadersr;rappend debughelpersr=r) r(r2r3attemptstrvsrcobjr$rr=s rr9z,DispatchingJinjaLoader._get_source_explainedDsLP"00:: 2 2NFF &&{H==;C#     OOVVR0 1 1 1 1CCCCCC))$(HhGGG ?Jx(((s; A  A c||D]-\}} |||cS#t$rY*wxYwt|r1)r>r;r)r(r2r3_srcobjr$s rr:z'DispatchingJinjaLoader._get_source_fast\st $11(;;  OGV ((h?????#    x(((s4 AA't.Iterator[tuple[Scaffold, BaseLoader]]c#K|jj}| |j|fV|jD]}|j}|||fVdSr1)r jinja_loaderiter_blueprints)r(r3r$ blueprints rr>z$DispatchingJinjaLoader._iter_loadersfsp&  (F" " " "1133 ( (I+F!'''' ( (r list[str]cHt}|jj}|'|||jD]7}|j}|,|D]}||8t|Sr1)setrrHupdatelist_templatesrIaddlist)r(resultr$rJr3s rrOz%DispatchingJinjaLoader.list_templatesps&   MM&//11 2 2 21133 ) )I+F! & 5 5 7 7))HJJx((((F||rN)rrrr")r2r&r3r4rr5)r3r4rrF)rrK) r)r*r+r,r'r;r9r:r>rOr-rrr/r/5s<<<<))))0))))((((      rr/rrr3rcontextr4c||tj||j||||}t j||j|||SN_async_wrapperr3rS)update_template_contextrsend ensure_syncrenderr)rr3rSrs r_renderr\sz((( COh  ! !B COh Irtemplate_name_or_list%str | Template | list[str | Template]r!c ~tj}|j|}t |||S)aRender a template by name with the given context. :param template_name_or_list: The name of the template to render. If a list is given, the first name to exist will be rendered. :param context: The variables to make available in the template. )r _get_current_object jinja_envget_or_select_templater\r]rSrr3s rrender_templaterds:  ) + +C}334IJJH 3' * **rsourcec ~tj}|j|}t |||S)zRender a template from the given source string with the given context. :param source: The source code of the template to render. :param context: The variables to make available in the template. )r r`ra from_stringr\rerSrr3s rrender_template_stringris9  ) + +C}((00H 3' * **rt.Iterator[str]ctjjdfd }|}trt |}|S)NrVrrjc3|KEd{VtjjdSrU)generaterrYrZ)rrSr3srrmz_stream..generates\$$W--------- (G      r)rrj)rXrrYrZr r )rr3rSrmrs``` r_streamrns((( COh        B%  $ $ Irc ~tj}|j|}t |||S)aRender a template by name with the given context as a stream. This returns an iterator of strings, which can be used as a streaming response from a view. :param template_name_or_list: The name of the template to render. If a list is given, the first name to exist will be rendered. :param context: The variables to make available in the template. .. versionadded:: 2.2 )r r`rarbrnrcs rstream_templaterps:  ) + +C}334IJJH 3' * **rc ~tj}|j|}t |||S)aZRender a template from the given source string with the given context as a stream. This returns an iterator of strings, which can be used as a streaming response from a view. :param source: The source code of the template to render. :param context: The variables to make available in the template. .. versionadded:: 2.2 )r r`rargrnrhs rstream_template_stringrrs9  ) + +C}((00H 3' * **r)rr)rrr3rrSrrr4)r]r^rSr!rr4)rer4rSr!rr4)rrr3rrSrrrj)r]r^rSr!rrj)rer4rSr!rrj)# __future__rtypingtjinja2rrr&rrglobalsr r r r helpersr signalsrr TYPE_CHECKINGrr sansio.apprsansio.scaffoldrrr/r\rdrirnrprrr-rrr}s""""""111111###### ((((((++++++&&&&&&?*))))))         /   GGGGGZGGGT     + + + + + + + +.++++& + + + + + +r