Viewing File: /opt/imunify360/venv/lib/python3.11/site-packages/jinja2/__pycache__/utils.cpython-311.pyc



]jWddlZddlZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZddlm
Z
dd	lmZdd
lmZddlmZddlmZejd
ZejddeejdddeejddZejdZejdZejdZdZdZeddddiZeZ djZ!dej"dvZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*dBd(Z+dCd*Z,d+Z-dBd,Z.dDd-Z/dEd2Z0dFd4Z1Gd5d6e2Z3ej45e3				dGd8Z6dHd9Z7Gd:d;e2Z8Gd<d=e2Z9Gd>d?e2Z:	e;d@d/Z<n
#e=$rd'Z<YnwxYwdAZ>dS)IN)deque)choice)	randrange)Lockescape)Markup)abc)string_types)	text_type)	url_quotez(\s+)z
^(?P<lead>(?:|)(<z&lt;z)*)(?P<middle>.*?)(?P<trail>(?:).,)>
z&gt;z)*)$z&^\S+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$z(<!--.*?-->|<[^>]*>)z	&([^;]+);4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
0123456789MissingType__repr__cdS)Nmissingr)xs l/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/jinja2/utils.py<lambda>r "sz\//cd|_|S)a+This decorator can be used to mark a function or method context callable.
    A context callable is passed the active :class:`Context` as first argument when
    called from the template.  This is useful if a function wants to get access
    to the context or functions provided on the context object.  For example
    a function that returns a sorted list of template variables the current
    template exports could look like this::

        @contextfunction
        def get_exported_names(context):
            return sorted(context.exported_vars)
    T)contextfunctionfs rr%r%,sAHr!cd|_|S)aGThis decorator can be used to mark a function or method as an eval
    context callable.  This is similar to the :func:`contextfunction`
    but instead of passing the context, an evaluation context object is
    passed.  For more information about the eval context, see
    :ref:`eval-context`.

    .. versionadded:: 2.4
    T)evalcontextfunctionr&s rr)r)<s!AHr!cd|_|S)zThis decorator can be used to mark a function or method as environment
    callable.  This decorator works exactly like the :func:`contextfunction`
    decorator just that the first argument is the active :class:`Environment`
    and not context.
    T)environmentfunctionr&s rr+r+Is!AHr!cDt|j|S)z%Marks the function as internally used)
internal_codeadd__code__r&s rinternalcoder0Ssaj!!!Hr!c.ddlm}t||S)aCheck 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
    r
)	Undefined)runtimer2
isinstance)objr2s  ris_undefinedr6Ys&#"""""c9%%%r!c|D]}dS)z4Consumes an iterable without doing anything with it.Nr)iterable_s  rconsumer:js




r!cnddlm}ddlm}||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
)_spontaneous_environments)_lexer_cacheN)environmentr<lexerr=clear)r<r=s  rclear_cachesrApsR766666########%%%r!Fc	d|vr|dd\}}n-d|vr|d\}}}nt|Stt|dd|g|S#tt
f$r|sYdSwxYw)aImports 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
rN)split
rpartition
__import__getattrImportErrorAttributeError)import_namesilentmoduler5r9s     r
import_stringrM}s
+%++C33KFCC
K

(33C88NFAssk***z&$se<<cBBB(				sA
A.
 A..BBrbcdtj|sdSt||S)z\Returns a file descriptor for the filename if that file exists,
    otherwise ``None``.
    N)ospathisfileopen)filenamemodes  ropen_if_existsrVs/7>>(##t$r!c|dS|turdSt|}|jdvr|j}n|jdz|jz}d|zS)zReturns 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`).
    NNoneEllipsis)__builtin__builtinsrz	%s object)rYtype
__module____name__)r5clsnames   robject_type_reprras^
{v	z
s))C~444|~#cl2r!cl	ddlm}|||S#t$rddlm}||cYSwxYw)zYPrettyprint an object.  Either use the `pretty` library or the
    builtin `pprint`.
    r)pretty)verbose)pformat)rcrHpprintre)r5rdrcres    rrereso!!!!!!vc7++++""""""ws||s33c
^|fd}ttt|}|rdtt|zpd}|rdt|zpd}t	|D]\}}	t
|	}
|
rs|
\}}}
|dsd|vr|ds|dst|d	krm|d	ttzvrV|d
s*|ds|drd
|d||d||d}|ds|drd|d||d||d}d|vr<|ds'd|vr#t|r	d|d|d}||z|
z|	kr||z|
z||<d|S)aConverts any URLs in text into clickable links. Works on http://,
    https:// and www. links. Links can have trailing punctuation (periods,
    commas, close-parens) and leading punctuation (opening parens) and
    it'll still do the right thing.

    If trim_url_limit is not None, the URLs in link text will be limited
    to trim_url_limit characters.

    If nofollow is True, the URLs in link text will get a rel="nofollow"
    attribute.

    If target is not None, a target attribute will be added to the link.
    cR|dur"|d|t||krdpdzp|S)Nz...r")len)rlimits  rr zurlize.<locals>.<lambda>s?T(9)<
vvY#a&&E/3e9r
:)
r!z	 rel="%s"r"z target="%s"zwww.@zhttp://zhttps://rz.orgz.netz.comz<a href="http://"rz</a>z	<a href="rCz<a href="mailto:z">)_word_split_rerDr
r	enumerate_punctuation_rematchgroups
startswithri_letters_digitsendswith_simple_email_rejoin)texttrim_url_limitreltargettrim_urlwordsrel_attrtarget_attriwordrpleadmiddletrails              rurlizers'	
	
	


  6$<<!8!899E;{Yvc{{%;%;;ArH<^fVnn<BKU##%1%14%%d++#	1"',,..D&%  ((
6!!)))44"))*55"KK!OO1IG!333OOF++4v..4v..	4FFHKKHV$$$$	  ++
v/@/@/L/L
FFHKKHV$$$$	v

))&11v%%$**622&%:@Hf}u$,,&=50a88E??r!Tdc	Fddlm}|}g}t|D]2}d}dx}	}
d}d}g}
t	tt||D]\}}	t
|}||kr|}n|r|}d}|tddz
|	kr|}	|
d	z
}
|d
z
}|tddz
|
kr|x}	}
|d
z
}d}|
|d	|
}
|
d
r|
ddd
z}
n|
d
s|
d
z
}
||
4|sd	|Std	d|DS)z+Generate some lorem ipsum for the template.r
)LOREM_IPSUM_WORDSTrNFr
rr z

rc3:K|]}dt|zVdS)z	<p>%s</p>Nr.0rs  r	<genexpr>z'generate_lorem_ipsum.<locals>.<genexpr>0s-FF!\F1II5FFFFFFr!)	constantsrrDrangernrr
capitalizeappendrwrur	)nhtmlminmaxrr}resultr9next_capitalized
last_comma
last_fullstoprlastpidxs               rgenerate_lorem_ipsumrs,,,,,,##%%E
F
1XX##%&&
] iS&9&9 : :;;		FC
e}}4<<D	

 
)((#( Yq!__$z11 
"
Yr2&&&66-00
]#' 
HHTNNNN
IIaLL::c??	#2#AAC	
HA

a$||F###%**FFvFFFFFGGGr!utf-8cRt|tst|}t|tr||}|rdnd}t	||}t|ts|d}|r|dd}|S)aQuote a string for use in a URL using the given charset.

    This function is misnamed, it is a wrapper around
    :func:`urllib.parse.quote`.

    :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.
    r!/rz%20+)r4rr
encoderdecodereplace)r5charsetfor_qssafervs     runicode_urlencoder3sc<((nn#y!!"jj!!"33dD	3		Bb)$$ 
YYw


$
ZZs
#
#
Ir!ceZdZdZdZdZdZdZdZdZ	dd	Z
dd
ZdZdZ
d
ZdZdZdZdZdZdZdZdZdZdZdZdZdZe	ZdS)LRUCachez"A simple LRU Cache implementation.cp||_i|_t|_|dSN)capacity_mappingr_queue	_postinit)selfrs  r__init__zLRUCache.__init__Ws1 

ggr!c|jj|_|jj|_|jj|_t|_|jj	|_
dSr)rpopleft_popleftpop_popremove_remover_wlockr_appendrs rrzLRUCache._postinit]s@+
KO	{)ff{)r!c,|j|j|jdS)Nrrrrrs r__getstate__zLRUCache.__getstate__es 

k

	
r!cb|j||dSr)__dict__updater)rds  r__setstate__zLRUCache.__setstate__ls.
Qr!c|jfSr)rrs r__getnewargs__zLRUCache.__getnewargs__ps

r!c||j}|j|j|j|j|S)z&Return a shallow copy of the instance.)	__class__rrrrextendrrs  rcopyz
LRUCache.copyssJ
^^DM
*
*
4=)))
	%%%	r!Nc8	||S#t$r|cYSwxYw)z/Return an item from the cache dict or `default`KeyErrorrkeydefaults   rgetzLRUCache.getzs5	9			NNN	s
cB	||S#t$r
|||<|cYSwxYw)zvSet `default` if the key is not in the cache otherwise
        leave unchanged. Return the value of this key.
        rrs   r
setdefaultzLRUCache.setdefaults>	9			DINNN	s
c|j	|j|j|jdS#|jwxYw)zClear the cache.N)racquirerr@rreleasers rr@zLRUCache.clearsw	"M!!!KK!!!!!DK!!!!s2A((Bc||jvS)z$Check if a key exists in this cache.rrrs  r__contains__zLRUCache.__contains__sdm##r!c*t|jS)z%Return the current size of the cache.)rirrs r__len__zLRUCache.__len__s4=!!!r!c2d|jjd|jdS)Nrrr)rr^rrs rrzLRUCache.__repr__s  N333T]]]CCr!c\|j	|j|}|jd|kr<	||n#t
$rYnwxYw||||jS#|jwxYw)zGet 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)rrrrr
ValueErrorrr)rrrs   r__getitem__zLRUCache.__getitem__s	

	"s#B{2#%%LL%%%%!D	
S!!!K!!!!DK!!!!s.BAB
ABABB+c|j	||jvr||n7t	|j|jkr|j|=||||j|<|jdS#|jwxYw)zhSets the value for an item. Moves the item up so that it
        has the highest priority then.
        N)	rrrrrirrrr)rrvalues   r__setitem__zLRUCache.__setitem__s	
	"dm##S!!!!T]##t}44M$--//2LL!&DM#K!!!!!DK!!!!sA5B++Cc|j	|j|=	||n#t$rYnwxYw|jdS#|jwxYw)z]Remove an item from the cache dict.
        Raise a `KeyError` if it does not exist.
        N)rrrrrrrs  r__delitem__zLRUCache.__delitem__s	
	"
c"
S!!!!




K!!!!!DK!!!!s+A%:A%
AA%AA%%BcpfdtjD}||S)zReturn a list of items.c.g|]}|j|fSrr)rrrs  r
<listcomp>z"LRUCache.items.<locals>.<listcomp>s%III3
c*+IIIr!)listrreverse)rrs` ritemszLRUCache.itemss;IIIItDK7H7HIII
r!c|tjdtdt|S)zIterate over all items.zP'iteritems()' will be removed in version 3.0. Use 'iter(cache.items())' instead.r
stacklevel)warningswarnDeprecationWarningiterrrs r	iteritemszLRUCache.iteritemss>

.		
	
	
	
DJJLL!!!r!c>d|DS)zReturn a list of all values.cg|]
}|dS)r
rrs  rrz#LRUCache.values.<locals>.<listcomp>s+++!+++r!)rrs rvalueszLRUCache.valuess++djjll++++r!c|tjdtdt|S)Iterate over all values.zQ'itervalue()' will be removed in version 3.0. Use 'iter(cache.values())' instead.rrrrrrrrs r	itervaluezLRUCache.itervalue>

/		
	
	
	
DKKMM"""r!c|tjdtdt|S)rzR'itervalues()' will be removed in version 3.0. Use 'iter(cache.values())' instead.rrrrs r
itervalueszLRUCache.itervaluesrr!c t|S)z7Return a list of all keys ordered by most recent usage.)rrs rkeysz
LRUCache.keyssDzzr!cXtjdtdt|S)z[Iterate over all keys in the cache dict, ordered by
        the most recent usage.
        zN'iterkeys()' will be removed in version 3.0. Use 'iter(cache.keys())' instead.rr)rrrrrs riterkeyszLRUCache.iterkeyss6	

-		
	
	
	
Dzzr!cDtt|jSr)reversedtuplerrs r__iter__zLRUCache.__iter__
sdk**+++r!cDtt|jS)zTIterate over the keys in the cache dict, oldest items
        coming first.
        )rr
rrs r__reversed__zLRUCache.__reversed__
sE$+&&'''r!r)r^r]__qualname____doc__rrrrrrrrr@rrrrrrrrrrrrr
rr__copy__rr!rrrPs,,***


   """$$$"""DDD""",
"
"
""""""",,,######


,,,(((HHHr!rrhtmxmlctd|Dtd|Dfd}|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
    c3jK|].}d|dzV/dSrNlstriplowerrs  rrz$select_autoescape.<locals>.<genexpr>As=UUQS188C==#6#6#8#88UUUUUUr!c3jK|].}d|dzV/dSrrrs  rrz$select_autoescape.<locals>.<genexpr>Bs=WWacAHHSMM$7$7$9$99WWWWWWr!c|S|}|rdS|rdSS)NTF)rru)
template_namerdefault_for_stringdisabled_patternsenabled_patternss r
autoescapez%select_autoescape.<locals>.autoescapeDs] %%%++--
!!"233	4!!"344	5r!)r
)enabled_extensionsdisabled_extensionsr rr#r!r"s  `` @@rselect_autoescaper&suPUUBTUUUUUWWCVWWWWWr!c|tj}||fi|dddddddd	}t|S)
aWorks exactly like :func:`dumps` but is safe for use in ``<script>``
    tags.  It accepts the same arguments and returns a JSON string.  Note that
    this is available in templates through the ``|tojson`` filter which will
    also mark the result as safe.  Due to how this function escapes certain
    characters this is safe even if used outside of ``<script>`` tags.

    The following characters are escaped in strings:

    -   ``<``
    -   ``>``
    -   ``&``
    -   ``'``

    This makes it safe to embed such strings in any place in HTML with the
    notable exception of double quoted attributes.  In that case single
    quote your attributes or HTML escape it in addition.
    Nrz\u003crz\u003e&z\u0026'z\u0027)jsondumpsrr	)r5dumperkwargsrs    rhtmlsafe_json_dumpsr.Qst$~sf	z	"	"	z	"	"	z	"	"	z	"	""::r!c>eZdZdZdZdZedZdZeZ	dS)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
    cD|std||_d|_dS)Nz$at least one item has to be providedr)RuntimeErrorrpos)rrs  rrzCycler.__init__s,	GEFFF
r!cd|_dS)z*Resets the current item to the first item.rN)r3rs rresetzCycler.resets
r!c&|j|jS)zxReturn the current item. Equivalent to the item that will be
        returned next time :meth:`next` is called.
        )rr3rs rcurrentzCycler.currents
z$(##r!c\|j}|jdzt|jz|_|S)zXReturn the current item, then advance :attr:`current` to the
        next item.
        r
)r7r3rirrs  rnextzCycler.nexts*\HqLC
OO3	r!N)
r^r]rrrr5propertyr7r9__next__rr!rr0r0osg2$$X$HHHr!r0c eZdZdZddZdZdS)JoinerzA joining helper for templates., c"||_d|_dS)NF)sepused)rr@s  rrzJoiner.__init__s			r!c0|js	d|_dS|jS)NTr")rAr@rs r__call__zJoiner.__call__sy	DI3xr!N)r>)r^r]rrrrCrr!rr=r=s=))r!r=c*eZdZdZdZdZdZdZdS)	Namespacez~A namespace object that can hold arbitrary attributes.  It may be
    initialized from a dictionary or with keyword arguments.cL|d|dd}}t|i||_dS)Nrr
)dict_Namespace__attrs)argsr-rs   rrzNamespace.__init__s/!Wd122hdT,V,,r!c|dvrt||S	|j|S#t$rt	|wxYw)N>rrH)object__getattribute__rHrrI)rr`s  rrLzNamespace.__getattribute__s_555**4666	'<%%	'	'	' &&&	's	.Ac||j|<dSrrH)rr`rs   rrzNamespace.__setitem__s"Tr!cd|jzS)Nz<Namespace %r>rNrs rrzNamespace.__repr__s$,..r!N)r^r]rrrrLrrrr!rrErEs\@@---'''###/////r!rEz,async def _():
 async for _ in ():
  yield _c\ddlm}tjdtd||S)Nr)soft_unicodezb'jinja2.utils.soft_unicode' will be removed in version 3.0. Use 'markupsafe.soft_unicode' instead.rr)
markupsaferQrrr)srQs  rrQrQsH''''''M	2	<??r!)F)rN)NNN)rTrr)rF)rrTFr)?r*rPrercollectionsrrandomrr	threadingrrRrr	_compatrrr
rcompilermrwmaprorv
_striptags_re
_entity_rersrtr\rsetr-concatr+
_slash_escaper%r)r+r0r6r:rArMrVrarerrrrKrMutableMappingregisterr&r.r0r=rEexechave_async_genSyntaxErrorrQrr!r<module>res5								!!!!!!H%%"**	RY 2334444RY BCCDDDD2:GHH
233

RZ
%
%
A
E$$}b:/B/B"C
D
D
F
F
	ZTZ__,






 











&&&"





0    *====@.H.H.H.Hb:CCCCCvCCCLH%%%.	5555p<33333V333lV////////2D	9:::NNNNN					s6
GG
G
Back to Directory File Manager