zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
U
Þ=®dĂã@sdZddlZddlZddlZddlmZddlmZddl    m
Z
ddl    m Z ddl    m Z dd    l mZdd
l mZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZe d¡Zejdej dej!fdZ"ej#rNddl$Z$ddl%Z&ddl'm(Z(Gdd„de&j)ƒZ*dddd d!d"d#d$d%d&d'd(d)d*gZ+d+d,d-gZ,eed.œd/d&„Z-ej.ej!e/d0œd1d$„Z0ej.ej!e/d0œd2d%„Z1dNd4ej2e/ej3e/ej d5gej4e/ffej2ej3e/ej!fe5ej2ej6e/ej!fej2ej7e/ej!fd5d6œd7d8„Z8Gd9d„dƒZ9e"e"d:œd;d<„Z:ej7j;Gd=d5„d5ƒƒZ<Gd>d?„d?ƒZ=Gd@d„dƒZ>GdAd+„d+e>ƒZ?GdBd„dƒZ@GdCd)„d)ƒZAdeAfej2dDejBeAejBeAdEœdFdG„ZCGdHdI„dIeAƒZDGdJdK„dKeAƒZEGdLdM„dMeAƒZFeA`GeD`GeE`GeF`GdS)Oz;The runtime functions and state used by compiled templates.éN)Úabc)Úchain)Úescape)ÚMarkup)Úsoft_stré©Ú
auto_aiter)Ú
auto_await)ÚTemplateNotFound)ÚTemplateRuntimeError)ÚUndefinedError)Ú EvalContext)Ú_PassArg)Úconcat)Ú internalcode)Úmissing)Ú    Namespace)Úobject_type_repr)Úpass_eval_contextÚVÚF.)Úbound)Ú Environmentc@s(eZdZdejedeedœdd„ZdS)ÚLoopRenderFuncr)ÚreciterÚloop_render_funcÚdepthÚreturncCsdS©N©)Úselfrrrr r úEd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\jinja2/runtime.pyÚ__call__#szLoopRenderFunc.__call__N)r)    Ú__name__Ú
__module__Ú __qualname__ÚtÚIterablerÚintÚstrr#r r r r"r"süûrÚ LoopContextÚTemplateReferenceÚMacrorr rrÚ markup_joinÚstr_joinÚidentityr rÚ    UndefinedrÚAsyncLoopContextr    r
)ÚxrcCs|S)zLReturns its argument. Useful for certain things in the
    environment.
    r )r3r r r"r0Ds)ÚseqrcCsLg}tt|ƒ}|D]0}| |¡t|dƒrtdƒ t||ƒ¡Sqt|ƒS)z?Concatenation that escapes if necessary and converts to string.Ú__html__Ú)ÚmaprÚappendÚhasattrrÚjoinrr)r4ÚbufÚiteratorÚargr r r"r.Ks
 
 
cCsttt|ƒƒS)z3Simple args to string conversion and concatenation.)rr7r*)r4r r r"r/VsFrÚContext)Ú environmentÚ template_nameÚblocksÚvarsÚsharedÚglobalsÚlocalsrc
Csl|dkr i}|r|}nt|pdf|Ž}|rX|r6t|ƒ}| ¡D]\}}    |    tk    r>|    ||<q>|j|||||dS)z%Internal helper for context creation.Nr )rD)ÚdictÚitemsrZ context_class)
r?r@rArBrCrDrEÚparentÚkeyÚvaluer r r"Ú new_context[s$
 
ÿrKc@s@eZdZdZdddœdd„Zeejdœdd    „Zed
œd d „Z    dS) r,zThe `self` in templates.r>N)ÚcontextrcCs
||_dSr)Ú_TemplateReference__context)r!rLr r r"Ú__init__{szTemplateReference.__init__©ÚnamercCs|jj|}t||j|dƒS©Nr)rMrAÚBlockReference)r!rPrAr r r"Ú __getitem__~s zTemplateReference.__getitem__©rcCsdt|ƒj›d|jj›dS)Nú<ú ú>)Útyper$rMrP©r!r r r"Ú__repr__‚szTemplateReference.__repr__)
r$r%r&Ú__doc__rNr*r'ÚAnyrSrZr r r r"r,xs)Ú dict_methodrcs,t ˆ¡dtjdœ‡fdd„ ƒ}t t|¡S)Nr>)r!rcs ˆ| ¡ƒSr)Úget_allrY©r]r r"Úf_all‡sz_dict_method_all.<locals>.f_all)Ú    functoolsÚwrapsr'r\Úcastr)r]r`r r_r"Ú_dict_method_all†srdc
@s¨eZdZdZd&dejeejfejeejeej    dgej
effejej eejfdœdd„Z eej    dgej
efej ddœd    d
„Zd'eejejd œd d „Zeej ejdfdœdd„Zeejdœdd„Zejeejfdœdd„Zejeejfdœdd„Zeej    ejejej ejdfdœdd„ƒZd(ejejeejfddœdd„ZeejƒZeejƒZeejƒZeedœd d!„Zeejdœd"d#„Zedœd$d%„ZdS))r>aêThe template context holds the variables of a template.  It stores the
    values passed to the template and also the names the template exports.
    Creating instances is neither supported nor useful as it's created
    automatically at various stages of the template evaluation and should not
    be created by hand.
 
    The context is immutable.  Modifications on :attr:`parent` **must not**
    happen and modifications on :attr:`vars` are allowed from generated
    template code only.  Template filters and global functions marked as
    :func:`pass_context` get the active context passed as first argument
    and are allowed to access the context read-only.
 
    The template context supports read only dict operations (`get`,
    `keys`, `values`, `items`, `iterkeys`, `itervalues`, `iteritems`,
    `__getitem__`, `__contains__`).  Additionally there is a :meth:`resolve`
    method that doesn't fail with a `KeyError` but returns an
    :class:`Undefined` object for missing variables.
    Nr)r?rHrPrArDcCs^||_i|_||_t|j|ƒ|_tƒ|_||_|dkr<tƒnt|ƒ|_dd„|     ¡Dƒ|_
dS)NcSsi|]\}}||g“qSr r ©Ú.0ÚkÚvr r r"Ú
<dictcomp>¶sz$Context.__init__.<locals>.<dictcomp>) rHrBr?rÚeval_ctxÚsetÚ exported_varsrPZ globals_keysrGrA)r!r?rHrPrArDr r r"rN£szContext.__init__©rRr1)rPÚcurrentrcCs`z$|j|}| |¡d}||Wn,tk
rP|jjd|›dddYSXt||||ƒS)zRender a parent block.rú there is no parent block called Ú.Úsuper©rP)rAÚindexÚ LookupErrorr?Ú    undefinedrR)r!rPrnrArsr r r"rq¸s
 
ÿ z Context.super)rIÚdefaultrcCs(z
||WStk
r"|YSXdS)zÑLook up a variable by name, or return a default if the key is
        not found.
 
        :param key: The variable name to look up.
        :param default: The value to return if the key is not found.
        N)ÚKeyError)r!rIrvr r r"ÚgetÆs
z Context.getr1)rIrcCs$| |¡}|tkr |jj|dS|S)aNLook up a variable by name, or return an :class:`Undefined`
        object if the key is not found.
 
        If you need to add custom behavior, override
        :meth:`resolve_or_missing`, not this method. The various lookup
        functions use that method, not this one.
 
        :param key: The variable name to look up.
        rr)Úresolve_or_missingrr?ru)r!rIÚrvr r r"ÚresolveÒs
 
zContext.resolvecCs,||jkr|j|S||jkr(|j|StS)aNLook up a variable by name, or return a ``missing`` sentinel
        if the key is not found.
 
        Override this method to add custom lookup behavior.
        :meth:`resolve`, :meth:`get`, and :meth:`__getitem__` use this
        method. Don't call this method directly.
 
        :param key: The variable name to look up.
        )rBrHr)r!rIr r r"ryãs
 
 
 
 
 
zContext.resolve_or_missingrTcs‡fdd„ˆjDƒS)z+Get a new dict with the exported variables.csi|]}|ˆj|“qSr )rB)rfrgrYr r"ri÷sz(Context.get_exported.<locals>.<dictcomp>)rlrYr rYr"Ú get_exportedõszContext.get_exportedcCs(|js |jS|js|jSt|jf|jŽS)z»Return the complete context as dict including the exported
        variables.  For optimizations reasons this might not return an
        actual copy so be careful with using it.
        )rBrHrFrYr r r"r^ùs
zContext.get_all)Ú _Context__objÚargsÚkwargsrcOsìd}t|dƒr$t |j¡dk    r$|j}t |¡}|tjkrt| d¡rP| |d¡}| d¡rh| |d¡}|f|}n.|tjkrŒ|jf|}n|tj    kr¢|j    f|}| 
dd¡| 
dd¡z |||ŽWSt k
ræ|j      d¡YSXdS)zéCall the callable with the arguments and keyword arguments
        provided but inject the active context or environment as first
        argument if the callable has :func:`pass_context` or
        :func:`pass_environment`.
        Tr#NZ
_loop_varsZ _block_varszGvalue was undefined because a callable raised a StopIteration exception) r9rZfrom_objr#rLrxÚderivedZ eval_contextrjr?ÚpopÚ StopIterationru)Z_Context__selfr}r~rZ__traceback_hide__Zpass_argr r r"Úcalls2
ÿþ
 
 
 
 
 
    ÿz Context.call)rErcCsDt|j|ji| ¡dd|ƒ}|j|_|j dd„|j ¡Dƒ¡|S)z¹Internal helper function to create a derived context.  This is
        used in situations where the system needs a new context in the same
        template that is independent.
        TNcss|]\}}|t|ƒfVqdSr)Úlistrer r r"Ú    <genexpr>:sz"Context.derived.<locals>.<genexpr>)rKr?rPr^rjrAÚupdaterG)r!rErLr r r"r€1sÿzContext.derivedrOcCs||jkp||jkSr)rBrH©r!rPr r r"Ú __contains__AszContext.__contains__cCs| |¡}|tkrt|ƒ‚|S)zpLook up a variable by name with ``[]`` syntax, or raise a
        ``KeyError`` if the key is not found.
        )ryrrw)r!rIÚitemr r r"rSDs
zContext.__getitem__cCs$dt|ƒj›d| ¡›d|j›dS)NrUrVz of rW)rXr$r^rPrYr r r"rZOszContext.__repr__)N)N)N) r$r%r&r[r'ÚDictr*r\ÚOptionalÚCallableÚIteratorÚMutableMappingrNÚUnionrqrxr{ryr|r^rrƒr€rdrFÚkeysÚvaluesrGÚboolrˆrSrZr r r r"r>Žs>úú þ   þ,$
 
 
 c@szeZdZdZedejejdgejefe    ddœdd„Z
e ej ddœd    d
„ƒZ eedœd d „ƒZeedœd d„ƒZdS)rRz"One block on a template reference.r>N)rPrLÚstackrrcCs||_||_||_||_dSr)rPÚ_contextÚ_stackÚ_depth)r!rPrLr“rr r r"rNVszBlockReference.__init__rmrTcCsJ|jdt|jƒkr0|jjjd|j›dddSt|j|j|j|jdƒS)zSuper the block.rrorprqrr)r–Úlenr•r”r?rurPrRrYr r r"rqbs  ÿzBlockReference.supercÃs<tdd„|j|j|jƒ2ƒIdHƒ}|jjjr8t|ƒS|S)NcÓsg|z3dHW}|‘q6Srr ©rfr3r r r"Ú
<listcomp>nsz.BlockReference._async_call.<locals>.<listcomp>)rr•r–r”rjÚ
autoescaper©r!rzr r r"Ú _async_callks  ÿ
zBlockReference._async_callcCs>|jjjr| ¡St|j|j|jƒƒ}|jjjr:t    |ƒS|Sr)
r”r?Úis_asyncrœrr•r–rjršrr›r r r"r#vs 
 
zBlockReference.__call__)r$r%r&r[r*r'ÚListrŒrr)rNÚpropertyrrqrrœr#r r r r"rRSsú 
rRc@sôeZdZUdZdZdZejee    d<e
Z ej e    d<e
Z ej e    d<e
Zej e    d<e
Zej e    d<d7ejeejd
ejd edd œd d„Zeejeejedœdd„ƒZeedœdd„ƒZedœdd„Zeedœdd„ƒZeedœdd„ƒZeedœdd„ƒZeedœdd„ƒZeedœdd „ƒZej dœd!d"„Z eedœd#d$„ƒZ!eej"ej d
fdœd%d&„ƒZ#eej"ej d
fdœd'd(„ƒZ$eed)œd*d+„Z%ej ed,œd-d.„Z&ddœd/d0„Z'ej(ej dfdœd1d2„Z)e*ejee+dœd3d4„ƒZ,e+dœd5d6„Z-dS)8r+zeA wrapper iterable for dynamic ``for`` loops, with information
    about the loop and iteration.
    éÿÿÿÿNÚ_lengthÚ_afterÚ_currentÚ_beforeÚ_last_changed_valuerr1r)ÚiterableruÚrecurseÚdepth0rcCs(||_| |¡|_||_||_||_dS)a@
        :param iterable: Iterable to wrap.
        :param undefined: :class:`Undefined` class to use for next and
            previous items.
        :param recurse: The function to render the loop body when the
            loop is marked recursive.
        :param depth0: Incremented when looping recursively.
        N)Ú    _iterableÚ _to_iteratorÚ    _iteratorÚ
_undefinedÚ_recurser¨)r!r¦rur§r¨r r r"rN‘s
 zLoopContext.__init__©r¦rcCst|ƒSr)Úiter©r¦r r r"rª§szLoopContext._to_iteratorrTcCsl|jdk    r|jSzt|jƒ|_WnDtk
rdt|jƒ}| |¡|_t|ƒ|j|jt    k    |_YnX|jS)zšLength of the iterable.
 
        If the iterable is a generator or otherwise does not have a
        size, it is eagerly evaluated to get a size.
        N)
r¡r—r©Ú    TypeErrorr„r«rªrsr¢r©r!r¦r r r"Úlength«s
 
  zLoopContext.lengthcCs|jSr)r³rYr r r"Ú__len__¾szLoopContext.__len__cCs
|jdS)zBHow many levels deep a recursive loop currently is, starting at 1.r)r¨rYr r r"rÁszLoopContext.depthcCs
|jdS)z-Current iteration of the loop, starting at 1.r©Úindex0rYr r r"rsÆszLoopContext.indexcCs |j|jS)zrNumber of iterations from the end of the loop, ending at 0.
 
        Requires calculating :attr:`length`.
        ©r³rsrYr r r"Ú    revindex0ËszLoopContext.revindex0cCs |j|jS)zrNumber of iterations from the end of the loop, ending at 1.
 
        Requires calculating :attr:`length`.
        ©r³r¶rYr r r"ÚrevindexÓszLoopContext.revindexcCs
|jdkS)z0Whether this is the first iteration of the loop.rrµrYr r r"ÚfirstÛszLoopContext.firstcCs$|jtk    r|jSt|jtƒ|_|jS)a Return the next element in the iterable, or :data:`missing`
        if the iterable is exhausted. Only peeks one item ahead, caching
        the result in :attr:`_last` for use in subsequent checks. The
        cache is reset when :meth:`__next__` is called.
        )r¢rÚnextr«rYr r r"Ú
_peek_nextàs
zLoopContext._peek_nextcCs | ¡tkS)zÞWhether this is the last iteration of the loop.
 
        Causes the iterable to advance early. See
        :func:`itertools.groupby` for issues this can cause.
        The :func:`groupby` filter avoids that issue.
        ©r½rrYr r r"ÚlastìszLoopContext.lastcCs|jr| d¡S|jS)zZThe item in the previous iteration. Undefined during the
        first iteration.
        zthere is no previous item)r»r¬r¤rYr r r"Úprevitemös
zLoopContext.previtemcCs| ¡}|tkr| d¡S|S)a    The item in the next iteration. Undefined during the last
        iteration.
 
        Causes the iterable to advance early. See
        :func:`itertools.groupby` for issues this can cause.
        The :func:`jinja-filters.groupby` filter avoids that issue.
        úthere is no next item©r½rr¬r›r r r"Únextitems    
zLoopContext.nextitem)r~rcGs|s tdƒ‚||jt|ƒS)z¤Return a value from the given args, cycling through based on
        the current :attr:`index0`.
 
        :param args: One or more values to cycle through.
        zno items for cycling given)r±r¶r—)r!r~r r r"ÚcycleszLoopContext.cycle)rJrcGs|j|kr||_dSdS)z¿Return ``True`` if previously called with a different value
        (including when called for the first time).
 
        :param value: One or more values to compare to the last call.
        TF)r¥)r!rJr r r"Úchangeds
zLoopContext.changedcCs|Srr rYr r r"Ú__iter__'szLoopContext.__iter__cCsF|jtk    r|j}t|_n
t|jƒ}|jd7_|j|_||_||fS©Nr)r¢rr¼r«r¶r£r¤r›r r r"Ú__next__*s
 
zLoopContext.__next__cCs&|jdkrtdƒ‚|j||j|jdS)zÄWhen iterating over nested data, render the body of the loop
        recursively with the given inner iterable data.
 
        The loop must have the ``recursive`` marker for this to work.
        NzCThe loop must have the 'recursive' marker to be called recursively.)r)r­r±rr²r r r"r#6s
 
ÿzLoopContext.__call__cCs"dt|ƒj›d|j›d|j›dS)NrUrVú/rW)rXr$rsr³rYr r r"rZDszLoopContext.__repr__)Nr).r$r%r&r[r¶r¡r'r‹r)Ú__annotations__rr¢r\r£r¤r¥r(rÚTyperNÚ staticmethodrrªrŸr³r´rrsr¸rºr’r»r½r¿rrÀrÃrÄrÅrÆÚTuplerÈrr*r#rZr r r r"r+ƒsZ
ûú              c@sìeZdZUejejed<eejej    e
ej e
feje
dœdd„ƒZ e edœdd„ƒZe edœdd    „ƒZe edœd
d „ƒZejdœd d „Ze edœdd„ƒZe ejejdfdœdd„ƒZddœdd„Zejejdfdœdd„ZdS)r2r«r®cCst|ƒSrrr°r r r"rªKszAsyncLoopContext._to_iteratorrTcÃsx|jdk    r|jSzt|jƒ|_WnPtk
rpdd„|j2ƒIdH}| |¡|_t|ƒ|j|jtk    |_YnX|jS)NcÓsg|z3dHW}|‘q6Srr r˜r r r"r™Ysz+AsyncLoopContext.length.<locals>.<listcomp>)    r¡r—r©r±r«rªrsr¢rr²r r r"r³Qs
  zAsyncLoopContext.lengthcÃs|jIdH|jSrr·rYr r r"r¸_szAsyncLoopContext.revindex0cÃs|jIdH|jSrr¹rYr r r"rºcszAsyncLoopContext.revindexcÃsH|jtk    r|jSz|j ¡IdH|_Wntk
r@t|_YnX|jSr)r¢rr«Ú    __anext__ÚStopAsyncIterationrYr r r"r½gs
 zAsyncLoopContext._peek_nextcÃs| ¡IdHtkSrr¾rYr r r"r¿rszAsyncLoopContext.lastr1cÃs$| ¡IdH}|tkr | d¡S|S)NrÁrÂr›r r r"rÃvs
zAsyncLoopContext.nextitemcCs|Srr rYr r r"Ú    __aiter__szAsyncLoopContext.__aiter__cÃsL|jtk    r|j}t|_n|j ¡IdH}|jd7_|j|_||_||fSrÇ)r¢rr«rÎr¶r£r¤r›r r r"r΂s
zAsyncLoopContext.__anext__N)r$r%r&r'Ú AsyncIteratorr\rÊrÌrr(rÚ AsyncIterablerªrŸr)r³r¸rºr½r’r¿rÃrÐrÍrÎr r r r"r2Hs$
þ  c
@s¤eZdZdZddejdefeejeeeeej    edœdd„Z
e e ej ej edœd    d
„ƒƒZejej eed œd d „Zejej eed œdd„Zedœdd„ZdS)r-zWraps a macro function.Nr.)r?ÚfuncrPÚ    argumentsÚ catch_kwargsÚ catch_varargsÚcallerÚdefault_autoescapec        Csl||_||_t|ƒ|_||_||_||_||_||_d|k|_    |dkrbt
|j ƒr\|  d¡}n|j }||_ dS)Nr×) Ú _environmentÚ_funcr—Ú_argument_countrPrÔrÕrÖr×Úexplicit_callerÚcallableršÚ_default_autoescape)    r!r?rÓrPrÔrÕrÖr×rØr r r"rN’s 
 
 
 zMacro.__init__©r~rrc
    Osš|r*t|dtƒr*|dj}|dd…}n|j}t|d|j…ƒ}t|ƒ}d}||jkr°|jt|ƒd…D]B}z| |¡}Wnt    k
r”t
}YnX|dkr¢d}|  |¡qjn|j }|j rî|sî| dd¡}    |    dkrä|jjddd}    |  |    ¡|jr|  |¡n@|rBd|kr$td|j›d    ƒ‚td|j›d
tt|ƒƒ›ƒ‚|jr`|  ||jd…¡n.t|ƒ|jkrŽtd|j›d t|jƒ›d ƒ‚| ||¡S) NrrFr×TzNo caller definedrrzmacro zX was invoked with two values for the special caller argument. This is most likely a bug.z takes no keyword argument z takes not more than z  argument(s))Ú
isinstancerršrÞr„rÛr—rÔrrwrr8rÜr×rÙrurÕr±rPr¼r¯rÖÚ_invoke)
r!r~rršrÔÚoffZ found_callerrPrJr×r r r"r#¯sN
 
 
 
 
 
 ÿÿÿzMacro.__call__)rÔršrcÃs |j|ŽIdH}|rt|ƒS|Sr)rÚr©r!rÔršrzr r r"Ú _async_invokeýszMacro._async_invokecCs.|jjr| ||¡S|j|Ž}|r*t|ƒ}|Sr)rÙrrärÚrrãr r r"rás  
z Macro._invokerTcCs0|jdkrdnt|jƒ}dt|ƒj›d|›dS)NZ    anonymousrUrVrW)rPÚreprrXr$r‡r r r"rZszMacro.__repr__)N)r$r%r&r[r'rŒr*ržr’r‹rNrrr\r#rärárZr r r r"r-s$ ÷ ÷ L c@sŒeZdZdZdZdedefeje    ej
eje    ej e ddœdd„Z ee    dœdd    „ƒZeej
ej
d
d œd d „ƒZee    ej
dœdd„ƒZeZZZZeZZZZeZZeZZeZZ eZ!Z"eZ#Z$eZ%Z&Z'Z(eZ)Z*Z+eZ,Z-ej
e.dœdd„Z/ej
e.dœdd„Z0e1dœdd„Z2e    dœdd„Z3e1dœdd„Z4ej5ej
dœdd„Z6ej7ej
dœdd„Z8e.dœd d!„Z9e    dœd"d#„Z:dS)$r1ahThe default undefined type.  This undefined type can be printed and
    iterated over, but every other access will raise an :exc:`UndefinedError`:
 
    >>> foo = Undefined(name='foo')
    >>> str(foo)
    ''
    >>> not foo
    True
    >>> foo + 42
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined
    ©Ú_undefined_hintÚ_undefined_objÚ_undefined_nameÚ_undefined_exceptionN)ÚhintÚobjrPÚexcrcCs||_||_||_||_dSrræ)r!rërìrPrír r r"rN+szUndefined.__init__rTcCsZ|jr |jS|jtkr"|j›dSt|jtƒsDt|jƒ›d|j›St|jƒ›d|j›S)zXBuild a message about the undefined value based on how it was
        accessed.
        z  is undefinedz has no element z has no attribute )rçrèrréràr*rrYr r r"Ú_undefined_message7s
  ÿÿzUndefined._undefined_messageú te.NoReturnrßcOs| |j¡‚dS)zeRaise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        N)rêrî)r!r~rr r r"Ú_fail_with_undefined_errorMsz$Undefined._fail_with_undefined_errorrOcCs |dd…dkrt|ƒ‚| ¡S)NéÚ__)ÚAttributeErrorrðr‡r r r"Ú __getattr__VszUndefined.__getattr__)ÚotherrcCst|ƒt|ƒkSr)rX©r!rõr r r"Ú__eq__hszUndefined.__eq__cCs | |¡ Sr)r÷rör r r"Ú__ne__kszUndefined.__ne__cCs tt|ƒƒSr)ÚidrXrYr r r"Ú__hash__nszUndefined.__hash__cCsdS)Nr6r rYr r r"Ú__str__qszUndefined.__str__cCsdSrQr rYr r r"r´tszUndefined.__len__ccsdEdHdS©Nr r rYr r r"rÆwszUndefined.__iter__cCsdD]
}dVqdSrür ©r!Ú_r r r"rÐzszUndefined.__aiter__cCsdS)NFr rYr r r"Ú__bool__~szUndefined.__bool__cCsdS)Nr1r rYr r r"rZszUndefined.__repr__);r$r%r&r[Ú    __slots__rr r'r‹r*r\rËr rNrŸrîrrðrôÚ__add__Ú__radd__Ú__sub__Ú__rsub__Ú__mul__Ú__rmul__Z__div__Z__rdiv__Ú __truediv__Ú __rtruediv__Ú __floordiv__Ú __rfloordiv__Ú__mod__Ú__rmod__Ú__pos__Ú__neg__r#rSÚ__lt__Ú__le__Ú__gt__Ú__ge__Ú__int__Ú    __float__Ú __complex__Ú__pow__Ú__rpow__r’r÷rør)rúrûr´rrÆrÑrÐrÿrZr r r r"r1sR    ûú þ zlogging.Logger)ÚloggerÚbasercsZˆdkr,ddl}| t¡‰ˆ | tj¡¡tddœ‡fdd„ ‰G‡‡fdd„d|ƒ}|S)akGiven a logger object this returns a new undefined class that will
    log certain failures.  It will log iterations and printing.  If no
    logger is given a default logger is created.
 
    Example::
 
        logger = logging.getLogger(__name__)
        LoggingUndefined = make_logging_undefined(
            logger=logger,
            base=Undefined
        )
 
    .. versionadded:: 2.8
 
    :param logger: the logger to use.  If not provided, a default logger
                   is created.
    :param base: the base class to add logging functionality to.  This
                 defaults to :class:`Undefined`.
    Nr)Úundefrcsˆ d|j¡dS)NzTemplate variable warning: %s)Úwarningrî)r)rr r"Ú _log_message¡sÿz,make_logging_undefined.<locals>._log_messagecsteZdZdZejejddœ‡‡fdd„ Zedœ‡‡fdd„ Zej    ejdœ‡‡fd    d
„ Z
e dœ‡‡fd d „ Z ‡Z S) z0make_logging_undefined.<locals>.LoggingUndefinedr rïrßc
sLztƒj||ŽWn4|jk
rF}zˆ d|¡|‚W5d}~XYnXdS)NzTemplate variable error: %s)rqrðrêÚerror)r!r~rÚe)Ú    __class__rr r"rð©s
 zKmake_logging_undefined.<locals>.LoggingUndefined._fail_with_undefined_errorrTcsˆ|ƒtƒ ¡Sr)rqrûrY©rrr r"rû²sz8make_logging_undefined.<locals>.LoggingUndefined.__str__csˆ|ƒtƒ ¡Sr)rqrÆrYr r r"rƶsz9make_logging_undefined.<locals>.LoggingUndefined.__iter__csˆ|ƒtƒ ¡Sr)rqrÿrYr r r"rÿºsz9make_logging_undefined.<locals>.LoggingUndefined.__bool__)r$r%r&rr'r\rðr*rûrrÆr’rÿÚ __classcell__r ©rr)rr"ÚLoggingUndefined¦sþ    r#)ÚloggingÚ    getLoggerr$Ú
addHandlerÚ StreamHandlerÚsysÚstderrr1)rrr$r#r r"r"Úmake_logging_undefined…s
r*c@s6eZdZdZdZedœdd„Zeddœdd„ZeZd    S)
ÚChainableUndefinedaŒAn undefined that is chainable, where both ``__getattr__`` and
    ``__getitem__`` return itself rather than raising an
    :exc:`UndefinedError`.
 
    >>> foo = ChainableUndefined(name='foo')
    >>> str(foo.bar['baz'])
    ''
    >>> foo.bar['baz'] + 42
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined
 
    .. versionadded:: 2.11.0
    r rTcCst|ƒSr)r*rYr r r"r5ÓszChainableUndefined.__html__)rþrcCs|Srr rýr r r"rôÖszChainableUndefined.__getattr__N)    r$r%r&r[rr*r5rôrSr r r r"r+Ás
r+c@s"eZdZdZdZedœdd„ZdS)ÚDebugUndefinedaAn undefined that returns the debug info when printed.
 
    >>> foo = DebugUndefined(name='foo')
    >>> str(foo)
    '{{ foo }}'
    >>> not foo
    True
    >>> foo + 42
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined
    r rTcCsL|jrd|j›}n,|jtkr&|j}ndt|jƒ›d|j›d}d|›dS)Nzundefined value printed: zno such element: ú[ú]z{{ z }})rçrèrrér)r!Úmessager r r"rûìs
ÿzDebugUndefined.__str__N)r$r%r&r[rr*rûr r r r"r,Üs r,c@s:eZdZdZdZejZZZ    ejZ
Z Z Z ejZdS)ÚStrictUndefinedasAn undefined that barks on print and iteration as well as boolean
    tests and all kinds of comparisons.  In other words: you can do nothing
    with it except checking if it's defined using the `defined` test.
 
    >>> foo = StrictUndefined(name='foo')
    >>> str(foo)
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined
    >>> not foo
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined
    >>> foo + 42
    Traceback (most recent call last):
      ...
    jinja2.exceptions.UndefinedError: 'foo' is undefined
    r N)r$r%r&r[rr1rðrÆrûr´r÷rørÿrúrˆr r r r"r0üs
r0)NFNN)Hr[rar(Útypingr'Ú collectionsrÚ    itertoolsrZ
markupsaferrrZ async_utilsr    r
Ú
exceptionsr r r ZnodesrÚutilsrrrrrrrÚTypeVarrrŒr\rÚ TYPE_CHECKINGr$Ztyping_extensionsÚter?rÚProtocolrZexportedZasync_exportedr0r(r*r.r/r‹rŠrr’rŽÚMappingrKr,rdÚregisterr>rRr+r2r-r1rËr*r+r,r0rr r r r"Ú<module>s¶                  
  òý     ùø E0FGqÿþ < ü