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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
3

U'íc[iã@shUddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddl
mZddl
mZddlmZddlmZddlZejrœddlZejd	ejd
ejfdZedfd
dd„iƒƒZejeƒZejedj Z!eedœdd„Z"eedœdd„Z#eedœdd„Z$Gdd„dej%ƒZ&eedœdd„Z'eedœdd„Z(eedœdd„Z)eedœd d!„Z*eje+d"œd#d$„Z,ej-ejdd%œd&d'„Z.dd(œd)d*„Z/d_e0e+ejd,œd-d.„Z1d`e0e0ej2ej3d0œd1d2„Z4eje0d"œd3d4„Z5eje0d"œd5d6„Z6ej7d7ej8ej9BƒZ:ej7d8ƒZ;dae0ej2e<ej2e0ej2e0ej2ej-e0e0d9œd:d;„Z=dbe<e+e<e<e0d@œdAdB„Z>dceje0e+e0dDœdEdF„Z?ddeje0e+e0dDœdGdH„Z@ejAjBGdIdJ„dJƒƒZCdefd=d+fejDe0ejDe0e+e+ejej2e0ge+fdNœdOdP„ZEdfejej2ejd
e0fejejFdQœdRdS„ZGGdTdU„dUƒZHGdVdW„dWƒZIGdXdY„dYƒZJGdZd[„d[ejFƒZFeje0d\œd]d^„ZKdS)géN)Úabc)Údeque)Úchoice)Ú	randrange)ÚLock)ÚCodeType)Úquote_from_bytesÚF.)ZboundZMissingTypeÚ__repr__cCsdS)NÚmissing©)Úxrrú./tmp/pip-build-gk9425m9/Jinja2/jinja2/utils.pyÚ<lambda>srÚ)ÚfÚreturncCstj|_|S)a·Pass the :class:`~jinja2.runtime.Context` as the first argument
    to the decorated function when called while rendering a template.

    Can be used on functions, filters, and tests.

    If only ``Context.eval_context`` is needed, use
    :func:`pass_eval_context`. If only ``Context.environment`` is
    needed, use :func:`pass_environment`.

    .. versionadded:: 3.0.0
        Replaces ``contextfunction`` and ``contextfilter``.
    )Ú_PassArgÚcontextÚjinja_pass_arg)rrrrÚpass_contexts
rcCstj|_|S)a“Pass the :class:`~jinja2.nodes.EvalContext` as the first argument
    to the decorated function when called while rendering a template.
    See :ref:`eval-context`.

    Can be used on functions, filters, and tests.

    If only ``EvalContext.environment`` is needed, use
    :func:`pass_environment`.

    .. versionadded:: 3.0.0
        Replaces ``evalcontextfunction`` and ``evalcontextfilter``.
    )rÚeval_contextr)rrrrÚpass_eval_context/s
rcCstj|_|S)aPass the :class:`~jinja2.Environment` as the first argument to
    the decorated function when called while rendering a template.

    Can be used on functions, filters, and tests.

    .. versionadded:: 3.0.0
        Replaces ``environmentfunction`` and ``environmentfilter``.
    )rÚenvironmentr)rrrrÚpass_environment@s	rc@s>eZdZejƒZejƒZejƒZee	e
jddœdd„ƒZdS)r)ÚobjrcCs€t|dƒr|jSxjdD]b}|jddƒ}xP|›d|›dfD]8}t||d	ƒd
kr<tj|›d|›dtd
d||Sq<WqWdS)NrrrrÚ_rÚfunctionÚfilterFTz= is deprecated and will stop working in Jinja 3.1. Use 'pass_z
' instead.é)Ú
stacklevel)rrr)ÚhasattrrÚreplaceÚgetattrÚwarningsÚwarnÚDeprecationWarning)ÚclsrÚprefixZsquashedÚnamerrrÚfrom_objRs

z_PassArg.from_objN)
Ú__name__Ú
__module__Ú__qualname__ÚenumÚautorrrÚclassmethodr	ÚtÚOptionalr*rrrrrMs
rcCstjdtddt|ƒS)z·Pass the context as the first argument to the decorated function.

    .. deprecated:: 3.0
        Will be removed in Jinja 3.1. Use :func:`~jinja2.pass_context`
        instead.
    zZ'contextfunction' is renamed to 'pass_context', the old name will be removed in Jinja 3.1.r)r )r$r%r&r)rrrrÚcontextfunctiongs
r3cCstjdtddt|ƒS)zàPass the eval context as the first argument to the decorated
    function.

    .. deprecated:: 3.0
        Will be removed in Jinja 3.1. Use
        :func:`~jinja2.pass_eval_context` instead.

    .. versionadded:: 2.4
    zc'evalcontextfunction' is renamed to 'pass_eval_context', the old name will be removed in Jinja 3.1.r)r )r$r%r&r)rrrrÚevalcontextfunctionws

r4cCstjdtddt|ƒS)zÃPass the environment as the first argument to the decorated
    function.

    .. deprecated:: 3.0
        Will be removed in Jinja 3.1. Use
        :func:`~jinja2.pass_environment` instead.
    zb'environmentfunction' is renamed to 'pass_environment', the old name will be removed in Jinja 3.1.r)r )r$r%r&r)rrrrÚenvironmentfunctionŠs
r5cCstj|jƒ|S)z%Marks the function as internally used)Ú
internal_codeÚaddÚ__code__)rrrrÚinternalcode›sr9)rrcCsddlm}t||ƒS)a´Check if the object passed is undefined.  This does nothing more than
    performing an instance check against :class:`Undefined` but looks nicer.
    This can be used for custom filters or tests that want to react to
    undefined variables.  For example a custom default filter can look like
    this::

        def default(var, default=''):
            if is_undefined(var):
                return default
            return var
    é)Ú	Undefined)Zruntimer;Ú
isinstance)rr;rrrÚis_undefined¡sr=)ÚiterablercCsx|D]}qWdS)z4Consumes an iterable without doing anything with it.Nr)r>rrrrÚconsume²s
r?)rcCs,ddlm}ddlm}|jƒ|jƒdS)a Jinja keeps internal caches for environments and lexers.  These are
    used so that Jinja doesn't have to recreate environments and lexers all
    the time.  Normally you don't have to care about that but if you are
    measuring memory consumption you may want to clean the caches.
    r:)Úget_spontaneous_environment)Ú_lexer_cacheN)rr@ÚlexerrAÚcache_clearÚclear)r@rArrrÚclear_caches¸srEF)Úimport_nameÚsilentrcCsvyRd|kr|jddƒ\}}n"d|kr6|jdƒ\}}}nt|ƒStt|dd|gƒ|ƒSttfk
rp|sl‚YnXdS)a˜Imports an object based on a string.  This is useful if you want to
    use import paths as endpoints or something similar.  An import path can
    be specified either in dotted notation (``xml.sax.saxutils.escape``)
    or with a colon as object delimiter (``xml.sax.saxutils:escape``).

    If the `silent` is True the return value will be `None` if the import
    fails.

    :return: imported object
    ú:r:Ú.N)ÚsplitÚ
rpartitionÚ
__import__r#ÚImportErrorÚAttributeError)rFrGÚmodulerrrrrÚ
import_stringÅsrPÚrb)ÚfilenameÚmodercCstjj|ƒsdSt||ƒS)z\Returns a file descriptor for the filename if that file exists,
    otherwise ``None``.
    N)ÚosÚpathÚisfileÚopen)rRrSrrrÚopen_if_existsÝsrXcCsJ|dkrdS|tkrdSt|ƒ}|jdkr6|j›dS|j›d|j›dS)z¨Returns the name of the object's type.  For some recognized
    singletons the name of the object is returned instead. (For
    example for `None` and `Ellipsis`).
    NÚNoneÚEllipsisÚbuiltinsz objectrI)rZÚtyper,r+)rr'rrrÚobject_type_reprçs
r]cCsddlm}||ƒS)z.Format an object using :func:`pprint.pformat`.r)Úpformat)Úpprintr^)rr^rrrr^ùsr^a@
    ^
    (
        (https?://|www\.)  # scheme or www
        (([\w%-]+\.)+)?  # subdomain
        (
            [a-z]{2,63}  # basic tld
        |
            xn--[\w%]{2,59}  # idna tld
        )
    |
        ([\w%-]{2,63}\.)+  # basic domain
        (com|net|int|edu|gov|org|info|mil)  # basic tld
    |
        (https?://)  # scheme
        (
            (([\d]{1,3})(\.[\d]{1,3}){3})  # IPv4
        |
            (\[([\da-f]{0,4}:){2}([\da-f]{0,4}:?){1,6}])  # IPv6
        )
    )
    (?::[\d]{1,5})?  # port
    (?:[/?#]\S*)?  # path, query, and fragment
    $
    z^\S+@\w[\w.-]*\.\w+$)ÚtextÚtrim_url_limitÚrelÚtargetÚ
extra_schemesrc
sЈdk	rttdœ‡fdd„}nttdœdd„}tjdttj|ƒƒƒ}|rZdtj|ƒ›dnd	}|rtd
tj|ƒ›dnd	}xJt|ƒD]<\}	}
d	|
d	}}}
tjd|ƒ}|rÆ|jƒ}||jƒd…}|j	d"ƒrütj
d|ƒ}|rü|jƒ}
|d|jƒ…}x~d&D]v\}}|j|ƒ}||j|ƒkr(qxLt
t||
j|ƒƒƒD]4}|
j|ƒt|ƒ}||
d|…7}|
|d…}
q>WqWtj|ƒrä|jdƒs |jdƒrÂd|›d|›|›d
||ƒ›d}n d|›d|›|›d
||ƒ›d}nÊ|jdƒr tj|dd…ƒr d|›d|dd…›d}nŽd|krb|jdƒrbd |krbtj|ƒrbd!|›d|›d}nL|dk	r®x@|D]8}||krr|j|ƒrrd|›d|›|›d
|›d}qrW|›|›|
›||	<q„Wd	j|ƒS)'a;Convert URLs in text into clickable links.

    This may not recognize links in some situations. Usually, a more
    comprehensive formatter, such as a Markdown library, is a better
    choice.

    Works on ``http://``, ``https://``, ``www.``, ``mailto:``, and email
    addresses. Links with trailing punctuation (periods, commas, closing
    parentheses) and leading punctuation (opening parentheses) are
    recognized excluding the punctuation. Email addresses that include
    header fields are not recognized (for example,
    ``mailto:address@example.com?cc=copy@example.com``).

    :param text: Original text containing URLs to link.
    :param trim_url_limit: Shorten displayed URL values to this length.
    :param target: Add the ``target`` attribute to links.
    :param rel: Add the ``rel`` attribute to links.
    :param extra_schemes: Recognize URLs that start with these schemes
        in addition to the default behavior.

    .. versionchanged:: 3.0
        The ``extra_schemes`` parameter was added.

    .. versionchanged:: 3.0
        Generate ``https://`` links for URLs without a scheme.

    .. versionchanged:: 3.0
        The parsing rules were updated. Recognize email addresses with
        or without the ``mailto:`` scheme. Validate IP addresses. Ignore
        parentheses and brackets in more cases.
    N)r
rcs"t|ƒˆkr|dˆ…›dS|S)Nz...)Úlen)r
)rarrÚtrim_urlGszurlize.<locals>.trim_urlcSs|S)Nr)r
rrrrfOsz(\s+)z rel="ú"rz	 target="z
^([(<]|&lt;)+ú)ú>rIú,Ú
ú&gt;z([)>.,\n]|&gt;)+$ú(ú<ú&lt;zhttps://zhttp://z	<a href="z</a>z<a href="https://zmailto:éz">ú@zwww.rHz<a href="mailto:)rhrirIrjrkrl©rmrh©rnri©rorl)rrrsrt)ÚstrÚrerJÚ
markupsafeÚescapeÚ	enumerateÚmatchÚgroupÚendÚendswithÚsearchÚstartÚcountÚrangeÚminÚindexreÚ_http_reÚ
startswithÚ	_email_reÚjoin)r`rarbrcrdrfÚwordsZrel_attrZtarget_attrÚiÚwordÚheadZmiddleÚtailrzZ
start_charZend_charZstart_countrZ	end_indexÚschemer)rarÚurlizesT&
"" 



"rŽéTééd)ÚnÚhtmlr‚ÚmaxrcCsXddlm}|jƒ}g}xt|ƒD]}d}d}	}
d}d}g}
x ttt||ƒƒƒD]Š\}}xt|ƒ}||kr`|}Pq`W|rŠ|jƒ}d}|tddƒ|	kr°|}	|
d	7}
|d
7}|tddƒ|
krÖ|}	}
|d
7}d}|
j|ƒqVWdj	|
ƒ}|j
d
ƒr|dd…d
}n|j
d
ƒs |d
7}|j|ƒq$W|s>dj	|ƒStjdj	dd„|DƒƒƒS)z+Generate some lorem ipsum for the template.r:)ÚLOREM_IPSUM_WORDSTrNFéérrjé
rrIú z

rkcss |]}dtj|ƒ›dVqdS)z<p>z</p>N)rwrx)Ú.0r
rrrú	<genexpr>Ësz'generate_lorem_ipsum.<locals>.<genexpr>éÿÿÿÿ)
Ú	constantsr•rJrryrrÚ
capitalizeÚappendr‡r}rwÚMarkup)r’r“r‚r”r•rˆÚresultrZnext_capitalizedZ
last_commaZ
last_fullstoprŠÚlastÚpÚidxZp_strrrrÚgenerate_lorem_ipsum˜sJ

r¥úutf-8)rÚcharsetÚfor_qsrcCsPt|tƒs&t|tƒst|ƒ}|j|ƒ}|r.dnd}t||ƒ}|rL|jddƒ}|S)a5Quote a string for use in a URL using the given charset.

    :param obj: String or bytes to quote. Other types are converted to
        string then encoded to bytes using the given charset.
    :param charset: Encode text to bytes using this charset.
    :param for_qs: Quote "/" and use "+" for spaces.
    óó/z%20ú+)r<ÚbytesruÚencoderr")rr§r¨ÚsafeÚrvrrrÚ	url_quoteÏs



r°cCs&ddl}|jdtddt|||dS)Nrz_'unicode_urlencode' has been renamed to 'url_quote'. The old name will be removed in Jinja 3.1.r)r )r§r¨)r$r%r&r°)rr§r¨r$rrrÚunicode_urlencodeæsr±c@s¬eZdZdZeddœdd„Zddœdd„Zeje	ej
fdœd	d
„Zeje	ej
fddœdd
„Zej
dœdd„Zddœdd„Zd1ej
ej
ej
dœdd„Zd2ej
ej
ej
dœdd„Zddœdd„Zej
edœdd„Zedœdd„Ze	dœdd„Zej
ej
dœd d!„Zej
ej
dd"œd#d$„Zej
ddœd%d&„Zejej
ej
ej
fdœd'd(„Zejej
dœd)d*„Zejej
dœd+d,„Zejej
dœd-d.„Zejej
dœd/d0„Z eZ!dS)3ÚLRUCachez"A simple LRU Cache implementation.N)ÚcapacityrcCs ||_i|_tƒ|_|jƒdS)N)r³Ú_mappingrÚ_queueÚ	_postinit)Úselfr³rrrÚ__init__úszLRUCache.__init__)rcCs4|jj|_|jj|_|jj|_tƒ|_|jj	|_
dS)N)rµÚpopleftÚ_popleftÚpopZ_popÚremoveÚ_removerÚ_wlockrŸÚ_append)r·rrrr¶s



zLRUCache._postinitcCs|j|j|jdœS)N)r³r´rµ)r³r´rµ)r·rrrÚ__getstate__szLRUCache.__getstate__)ÚdrcCs|jj|ƒ|jƒdS)N)Ú__dict__Úupdater¶)r·rÁrrrÚ__setstate__szLRUCache.__setstate__cCs|jfS)N)r³)r·rrrÚ__getnewargs__szLRUCache.__getnewargs__cCs,|j|jƒ}|jj|jƒ|jj|jƒ|S)z&Return a shallow copy of the instance.)Ú	__class__r³r´rÃrµÚextend)r·r¯rrrÚcopysz
LRUCache.copy)ÚkeyÚdefaultrcCs"y||Stk
r|SXdS)z/Return an item from the cache dict or `default`N)ÚKeyError)r·rÉrÊrrrÚgetszLRUCache.getcCs*y||Stk
r$|||<|SXdS)zvSet `default` if the key is not in the cache otherwise
        leave unchanged. Return the value of this key.
        N)rË)r·rÉrÊrrrÚ
setdefault$s
zLRUCache.setdefaultc	Cs*|j|jjƒ|jjƒWdQRXdS)zClear the cache.N)r¾r´rDrµ)r·rrrrD.s
zLRUCache.clear)rÉrcCs
||jkS)z$Check if a key exists in this cache.)r´)r·rÉrrrÚ__contains__4szLRUCache.__contains__cCs
t|jƒS)z%Return the current size of the cache.)rer´)r·rrrÚ__len__8szLRUCache.__len__cCsdt|ƒj›d|j›dS)Nrnr™ri)r\r+r´)r·rrrr
<szLRUCache.__repr__cCs\|jL|j|}|jd|krNy|j|ƒWntk
rBYnX|j|ƒ|SQRXdS)zšGet an item from the cache. Moves the item up so that it has the
        highest priority then.

        Raise a `KeyError` if it does not exist.
        r:Nrœ)r¾r´rµr½Ú
ValueErrorr¿)r·rÉr¯rrrÚ__getitem__?s

zLRUCache.__getitem__)rÉÚvaluerc
Cs\|jL||jkr|j|ƒnt|jƒ|jkr:|j|jƒ=|j|ƒ||j|<WdQRXdS)zhSets the value for an item. Moves the item up so that it
        has the highest priority then.
        N)r¾r´r½rer³rºr¿)r·rÉrÒrrrÚ__setitem__Us

zLRUCache.__setitem__cCsB|j2|j|=y|j|ƒWntk
r2YnXWdQRXdS)z]Remove an item from the cache dict.
        Raise a `KeyError` if it does not exist.
        N)r¾r´r½rÐ)r·rÉrrrÚ__delitem__bszLRUCache.__delitem__cs$‡fdd„tˆjƒDƒ}|jƒ|S)zReturn a list of items.csg|]}|ˆj|f‘qSr)r´)ršrÉ)r·rrú
<listcomp>psz"LRUCache.items.<locals>.<listcomp>)ÚlistrµÚreverse)r·r¡r)r·rÚitemsnszLRUCache.itemscCsdd„|jƒDƒS)zReturn a list of all values.cSsg|]}|d‘qS)r:r)ršr
rrrrÕvsz#LRUCache.values.<locals>.<listcomp>)rØ)r·rrrÚvaluestszLRUCache.valuescCst|ƒS)z7Return a list of all keys ordered by most recent usage.)rÖ)r·rrrÚkeysxsz
LRUCache.keyscCstt|jƒƒS)N)ÚreversedÚtuplerµ)r·rrrÚ__iter__|szLRUCache.__iter__cCstt|jƒƒS)zTIterate over the keys in the cache dict, oldest items
        coming first.
        )ÚiterrÜrµ)r·rrrÚ__reversed__szLRUCache.__reversed__)N)N)"r+r,r-Ú__doc__Úintr¸r¶r1ÚMappingruÚAnyrÀrÄÚTuplerÅrÈrÌrÍrDÚboolrÎrÏr
rÑrÓrÔÚIterablerØrÙrÚÚIteratorrÝrßÚ__copy__rrrrr²òs,

"r²r“ÚhtmÚxml)Úenabled_extensionsÚdisabled_extensionsÚdefault_for_stringrÊrcsHtdd„|Dƒƒ‰tdd„|Dƒƒ‰tjttdœ‡‡‡‡fdd„}|S)acIntelligently sets the initial value of autoescaping based on the
    filename of the template.  This is the recommended way to configure
    autoescaping if you do not want to write a custom function yourself.

    If you want to enable it for all templates created from strings or
    for all templates with `.html` and `.xml` extensions::

        from jinja2 import Environment, select_autoescape
        env = Environment(autoescape=select_autoescape(
            enabled_extensions=('html', 'xml'),
            default_for_string=True,
        ))

    Example configuration to turn it on at all times except if the template
    ends with `.txt`::

        from jinja2 import Environment, select_autoescape
        env = Environment(autoescape=select_autoescape(
            disabled_extensions=('txt',),
            default_for_string=True,
            default=True,
        ))

    The `enabled_extensions` is an iterable of all the extensions that
    autoescaping should be enabled for.  Likewise `disabled_extensions` is
    a list of all templates it should be disabled for.  If a template is
    loaded from a string then the default from `default_for_string` is used.
    If nothing matches then the initial value of autoescaping is set to the
    value of `default`.

    For security reasons this function operates case insensitive.

    .. versionadded:: 2.9
    css"|]}d|jdƒjƒ›VqdS)rIN)ÚlstripÚlower)ršr
rrrr›°sz$select_autoescape.<locals>.<genexpr>css"|]}d|jdƒjƒ›VqdS)rIN)rîrï)ršr
rrrr›±s)Ú
template_namercs4|dkrˆS|jƒ}|jˆƒr"dS|jˆƒr0dSˆS)NTF)rïr})rð)rÊríÚdisabled_patternsÚenabled_patternsrrÚ
autoescape³s

z%select_autoescape.<locals>.autoescape)rÜr1r2rurå)rërìrírÊrór)rÊrírñròrÚselect_autoescapeˆs( 
rô)rÚdumpsÚkwargsrcKs@|dkrtj}tj||f|Žjddƒjddƒjddƒjdd	ƒƒS)
aÐSerialize an object to a string of JSON with :func:`json.dumps`,
    then replace HTML-unsafe characters with Unicode escapes and mark
    the result safe with :class:`~markupsafe.Markup`.

    This is available in templates as the ``|tojson`` filter.

    The following characters are escaped: ``<``, ``>``, ``&``, ``'``.

    The returned string is safe to render in HTML documents and
    ``<script>`` tags. The exception is in HTML attributes that are
    double quoted; either use single quotes or the ``|forceescape``
    filter.

    :param obj: The object to serialize to JSON.
    :param dumps: The ``dumps`` function to use. Defaults to
        ``env.policies["json.dumps_function"]``, which defaults to
        :func:`json.dumps`.
    :param kwargs: Extra arguments to pass to ``dumps``. Merged onto
        ``env.policies["json.dumps_kwargs"]``.

    .. versionchanged:: 3.0
        The ``dumper`` parameter is renamed to ``dumps``.

    .. versionadded:: 2.9
    Nrnz\u003criz\u003eú&z\u0026ú'z\u0027)Újsonrõrwr r")rrõrörrrÚhtmlsafe_json_dumpsÀsrúc@sXeZdZdZejddœdd„Zddœdd„Zeejdœd	d
„ƒZ	ejdœdd„Z
e
ZdS)
ÚCycleraDCycle through values by yield them one at a time, then restarting
    once the end is reached. Available as ``cycler`` in templates.

    Similar to ``loop.cycle``, but can be used outside loops or across
    multiple loops. For example, render a list of folders and files in a
    list, alternating giving them "odd" and "even" classes.

    .. code-block:: html+jinja

        {% set row_class = cycler("odd", "even") %}
        <ul class="browser">
        {% for folder in folders %}
          <li class="folder {{ row_class.next() }}">{{ folder }}
        {% endfor %}
        {% for file in files %}
          <li class="file {{ row_class.next() }}">{{ file }}
        {% endfor %}
        </ul>

    :param items: Each positional argument will be yielded in the order
        given for each cycle.

    .. versionadded:: 2.1
    N)rØrcGs|stdƒ‚||_d|_dS)Nz$at least one item has to be providedr)ÚRuntimeErrorrØÚpos)r·rØrrrr¸szCycler.__init__)rcCs
d|_dS)z*Resets the current item to the first item.rN)rý)r·rrrÚresetszCycler.resetcCs|j|jS)zxReturn the current item. Equivalent to the item that will be
        returned next time :meth:`next` is called.
        )rØrý)r·rrrÚcurrentszCycler.currentcCs |j}|jdt|jƒ|_|S)zXReturn the current item, then advance :attr:`current` to the
        next item.
        r:)rÿrýrerØ)r·r¯rrrÚnextszCycler.next)r+r,r-ràr1rãr¸rþÚpropertyrÿrÚ__next__rrrrrûèsrûc@s0eZdZdZd
eddœdd„Zedœdd	„ZdS)ÚJoinerzA joining helper for templates.ú, N)ÚseprcCs||_d|_dS)NF)rÚused)r·rrrrr¸!szJoiner.__init__)rcCs|jsd|_dS|jS)NTr)rr)r·rrrÚ__call__%szJoiner.__call__)r)r+r,r-ràrur¸rrrrrrsrc@sZeZdZdZejejddœdd„Zeejdœdd„Zeejdd	œd
d„Z	edœd
d„Z
dS)Ú	Namespacez~A namespace object that can hold arbitrary attributes.  It may be
    initialized from a dictionary or with keyword arguments.N)ÚargsrörcOs&|d|dd…}}t||Ž|_dS)Nrr:)ÚdictÚ_Namespace__attrs)r	rör·rrrr¸0szNamespace.__init__)r)rcCsB|dkrtj||ƒSy
|j|Stk
r<t|ƒd‚YnXdS)NrrÆ>rÆr)ÚobjectÚ__getattribute__rrËrN)r·r)rrrr
4s
zNamespace.__getattribute__)r)rÒrcCs||j|<dS)N)r)r·r)rÒrrrrÓ=szNamespace.__setitem__)rcCsd|j›dS)Nz<Namespace ri)r)r·rrrr
@szNamespace.__repr__)r+r,r-ràr1rãr¸rur
rÓr
rrrrr,s
	rcseZdZd‡fdd„	Z‡ZS)r rNÚstrictcs"tjdtddtƒj||||ƒS)Nzc'jinja2.Markup' is deprecated and will be removed in Jinja 3.1. Import 'markupsafe.Markup' instead.r)r )r$r%r&ÚsuperÚ__new__)r'ÚbaseÚencodingÚerrors)rÆrrrEs
zMarkup.__new__)rNr)r+r,r-rÚ
__classcell__rr)rÆrr Dsr )ÚsrcCstjdtddtj|ƒS)Nzc'jinja2.escape' is deprecated and will be removed in Jinja 3.1. Import 'markupsafe.escape' instead.r)r )r$r%r&rwrx)rrrrrxOs
rx)F)rQ)NNNN)rTrr‘)r¦F)r¦F)r“rérê)N)Lr.rùrTrvÚtypingr1r$ÚcollectionsrrÚrandomrrÚ	threadingrÚtypesrÚurllib.parserrwZ
TYPE_CHECKINGZtyping_extensionsÚteZTypeVarÚCallablerãr	r\rÚsetr6Ú
MutableSetr‡ÚconcatrrrÚEnumrr3r4r5r9rår=rær?rErurPr2ZIOrXr]r^ÚcompileÚ
IGNORECASEÚVERBOSEr„r†rárŽr¥r°r±ÚMutableMappingÚregisterr²Ú
Collectionrôr rúrûrrrxrrrrÚ<module>s|



*t
5 4&6