lf)dZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z dd l m Z dd l mZd Zd Zd ZdZdZdZdZe dZdZddZdZdZdZdZdZdZGdde Zd dZ edS)!zWThe code for async support. Importing this patches Jinja on supported Python versions. Nupdate_wrapper)Markup)TemplateModule) LoopContextconcat internalcode)missingcXKgfd}|d{VtS)NcLK23d{V}|6dSN)append)event async_genrvs s/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/jinja2/asyncsupport.pycollectzconcat_async..collectsM$       % IIe    %99s#r )rrrs` @r concat_asyncrsP B '))OOOOOOO "::cKt|i|} |||23d{V}|WV 6dS#t$r |jWVYdSwxYwr)dictroot_render_func new_context Exception environmenthandle_exception)selfargskwargsvarsrs rgenerate_asyncr$s   D2001A1A$1G1GHH       %KKKKKIHH 222//1111111112s(AAA&A21A2c8dfd}t|S)Nc3K|j|i|} ||V*#t$rYdSwxYwr)r$run_until_complete __anext__StopAsyncIteration)r loopr!r"rs r_convert_generatorz.wrap_generate_func.._convert_generator'sv'D'888   E--i.A.A.C.CDDDDD E!    DD s+< A  A cr|jjs |g|Ri|S|tj||Sr)ris_asyncasyncioget_event_loop)r r!r"r+original_generates rgeneratez$wrap_generate_func..generate/sR( <$$T;D;;;F;; ;!!$(>(@(@$OOOrr)r0r1r+s` @rwrap_generate_funcr2&sJPPPPPP ($5 6 66rc"K|jjstdt|i|}||} t ||d{VS#t$r|jcYSwxYw)Nz8The environment was not created with async mode enabled.) rr- RuntimeErrorrrrrrr)r r!r"r#ctxs r render_asyncr67s   $WUVVV   D   4 C3!$"7"7"<"<========= 33300222223s'A((#B Bc.fd}t|S)Nc|jjs |g|Ri|Stj}||j|i|Sr)rr-r.r/r'r6)r r!r"r*original_renders rrenderz wrap_render_func..renderEsf( :"?49$999&99 9%''&&'8t'8$'I&'I'IJJJrr)r9r:s` rwrap_render_funcr;Ds3KKKKK &/ 2 22rcltdtfd}t|S)NcKt|j|j|jd{V}|jjjrt |}|Sr)r_stack_depth_contexteval_ctx autoescaperr rs r async_callz-wrap_block_reference_call..async_callOs[ 8 DK 8 G GHH H H H H H H = ! , B rcR|jjjs |S|Sr)r@rr-)r rD original_calls r__call__z+wrap_block_reference_call..__call__Vs3}(1 ' =&& &z$rr r)rFrGrDs` @rwrap_block_reference_callrINsY\      \ (M 2 22rcltdtfd}t|S)NcLK|j|d{V}|rt|}|Sr)_funcr)r argumentsrBrs r async_invokez'wrap_macro_invoke..async_invoke`s>4:y) ) ) ) ) ) )  B rcP|jjs |||S|||Sr) _environmentr-)r rMrBrNoriginal_invokes r_invokez"wrap_macro_invoke.._invokegs: ) @"?4J?? ?|D)Z888rrH)rQrRrNs` @rwrap_macro_invokerS_sY\ 99999\9 '? 3 33rchK|j|jS|d{Vx|_}|Sr)_modulemake_module_asyncrCs rget_default_module_asyncrWpsE ||"44666666666DL2 Irc,tfd}|S)NcP|jjrtd|S)Nz6Template module attribute is unavailable in async mode)rr-r4)r original_default_modules r_get_default_modulez0wrap_default_module.._get_default_moduleys2   $ YWXX X&&t,,,rr )rZr[s` rwrap_default_moduler\xs.----\- rFcK||||}g}||23d{V}||6t|||Sr)rrrr)r r#sharedlocalscontext body_streamitems rrVrVstVV44GK++G44!!!!!!!d4    5 $ 5 55sAczddlm}t|j|_t t |j|_t t |j|_t|j|_t|j |_ t|_ t t|j |_ dS)NrTemplate)rer2r1rr$r6r;r:r\r[rW_get_default_module_asyncrVrds rpatch_templaterhs*8+<==H,^X=TUUH*<9NOOH&x77HO#6x7S#T#TH )AH&!/85""Hrczddlm}m}t|j|_t |j|_dS)NrBlockReferenceMacro)runtimerkrlrIrGrSrRrjs r patch_runtimernsB........78OPPN%em44EMMMrcHddlm}ddlm}||dS)Nr)FILTERS) ASYNC_FILTERS)filtersrp asyncfiltersrqupdate)rprqs r patch_filtersrus>      ++++++ NN=!!!!!rcZtttdSr)rhrnrurr patch_allrxs$OOOOOOOOrcBKtj|r|d{VS|Sr)inspect isawaitable)values r auto_awaitr}s05!!{{{{{{ LrcbKt|dr|23d{V}|WV 6dS|D]}|WVdS)N __aiter__)hasattr)iterablerbs r auto_aiterrs}x%%"       $JJJJJ# s"ceZdZeeZedZedZedZ dZ edZ edZ dZ dZd S) AsyncLoopContextc>K|j|jS t|j|_nl#t$r_d|j2d{V}|||_t||jz|jtuz|_YnwxYw|jS)Nc"Kg|3d{V}| 6Srrw).0xs r z+AsyncLoopContext.length..s.88888888A8888s) _lengthlen _iterable TypeError _iterator _to_iteratorindex_afterr )r rs rlengthzAsyncLoopContext.lengths < #<  Ut~..DLL U U U88888888888H!..x88DNx==4:5G9STDLLL U |s,A&BBc0K|jd{V|jz Sr)rrr s r revindex0zAsyncLoopContext.revindex0s'[      4:--rc0K|jd{V|jz Sr)rindex0rs rrevindexzAsyncLoopContext.revindexs'[      4;..rcK|jtur|jS |jd{V|_n#t$rt|_YnwxYw|jSr)rr rr(r)rs r _peek_nextzAsyncLoopContext._peek_nextsy ;g % %;  " $ 8 8 : :::::::DKK! " " "!DKKK "{s$>AAcHK|d{VtuSr)rr rs rlastzAsyncLoopContext.lasts-__&&&&&&&&'11rczK|d{V}|tur|dS|S)Nzthere is no next item)rr _undefinedrCs rnextitemzAsyncLoopContext.nextitemsH??$$ $ $ $ $ $ $ ==??#:;; ; rc|Srrwrs rrzAsyncLoopContext.__aiter__s rcK|jtur|j}t|_n|jd{V}|xjdz c_|j|_||_||fS)Nr)rr rr(r_current_beforerCs rr(zAsyncLoopContext.__anext__sq ;g % %B!DKK~//11111111B q }  4xrN)__name__ __module__ __qualname__ staticmethodrrpropertyrrrrrrrr(rwrrrrs< ++L   X ..X.//X/   22X2X     rrclKddl}|dtdt||||S)NrzRThis template must be recompiled with at least Jinja 2.11, or it will fail in 3.0.) stacklevel)warningswarnDeprecationWarningr)r undefinedrecursedepth0rs rmake_async_loop_contextrsKOOO MM   Hi& A AAr)NFN)Nr)!__doc__r.rz functoolsr markupsaferrrrmrutilsr r r rr$r2r6r;rIrSrWr\rVrhrnrurxr}rrrrwrrrs$$$$$$'''''' 222777" 3 3 3333333"444"6666   555"""  >>>>>{>>>B B B B B r