https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/jinja2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/jinja2/utils.pyc
�
-/�_c@sddlZddlZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZddlm
Z
dd	lmZdd
lmZddlmZddlmZejd
�ZejddjeejdF��djeejdG��f�Zejd�Zejd�Zejd�ZdZdZeddHid�d 6��Ze�Z d!jZ!d"ej"d#�kZ#d$�Z$d%�Z%d&�Z&d'�Z'd(�Z(d)�Z)d*�Z*e+d+�Z,d,d-�Z-d.�Z.e+d/�Z/dddd0�Z1d1e2d2d3d4�Z3d5e+d6�Z4d7e5fd8��YZ6ej7j8e6�dIdJe2e+d<�Z9dd=�Z:d>e5fd?��YZ;d@e5fdA��YZ<dBe5fdC��YZ=ydDdUe2Z>Wne?k
r�e+Z>nXdE�Z@dS(Ki����N(tdeque(tchoice(t	randrange(tLock(tescape(tMarkupi(tabc(tstring_types(t	text_type(t	url_quotes(\s+)s4^(?P<lead>(?:%s)*)(?P<middle>.*?)(?P<trail>(?:%s)*)$t|t(t<s&lt;t.t,t)t>s
s&gt;s&^\S+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$s(<!--.*?-->|<[^>]*>)s	&([^;]+);t4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZt
0123456789tMissingTypecCsdS(Ntmissing((tx((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt<lambda>"st__repr__us\/t/cCs
t|_|S(s+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)
    (tTruetcontextfunction(tf((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR,s	cCs
t|_|S(sGThis 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
    (Rtevalcontextfunction(R((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR<s		cCs
t|_|S(s�This 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.
    (Rtenvironmentfunction(R((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyRIs	cCstj|j�|S(s%Marks the function as internally used(t
internal_codetaddt__code__(R((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytinternalcodeSscCsddlm}t||�S(s�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
    i(t	Undefined(truntimeR"t
isinstance(tobjR"((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytis_undefinedYscCsx|D]}qWdS(s4Consumes an iterable without doing anything with it.N((titerablet_((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytconsumejs
cCs8ddlm}ddlm}|j�|j�dS(s 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.
    i(t_spontaneous_environments(t_lexer_cacheN(tenvironmentR*tlexerR+tclear(R*R+((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytclear_cachesps
cCs�y{d|kr*|jdd�\}}n1d|krQ|jd�\}}}n
t|�Stt|dd|g�|�SWn#ttfk
r�|s��q�nXdS(s�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
    t:iR
N(tsplitt
rpartitiont
__import__tgetattrtNonetImportErrortAttributeError(timport_nametsilenttmoduleR%R(((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt
import_string}s
#trbcCs#tjj|�sdSt||�S(s\Returns a file descriptor for the filename if that file exists,
    otherwise ``None``.
    N(tostpathtisfileR5topen(tfilenametmode((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytopen_if_exists�scCsc|dkrdS|tkr dSt|�}|jdkrG|j}n|jd|j}d|S(	s�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`).
    R5tEllipsist__builtin__tbuiltinsR
s	%s objectN(s__builtin__sbuiltins(R5RDttypet
__module__t__name__(R%tclstname((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytobject_type_repr�scCsSy$ddlm}||d|�SWn(tk
rNddlm}||�SXdS(sYPrettyprint an object.  Either use the `pretty` library or the
    builtin `pprint`.
    i����(tprettytverbose(tpformatN(RMR6tpprintRO(R%RNRMRO((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyRO�s
cCs|d�}tjtt|���}|rCdtt|��pFd}|r_dt|�pbd}x�t|�D]�\}}	tj|	�}
|
rr|
j�\}}}
|jd�s6d|krU|jd�rU|jd�rUt	|�d	krU|d	t
tkrU|jd
�s6|jd�s6|jd�rUd
|||||�f}n|jd�ss|jd�r�d|||||�f}nd|kr�|jd�r�d|kr�t
j|�r�d||f}n|||
|	kr|||
||<qqrqrWdj|�S(sConverts 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.
    cSs6|dk	r2|| t|�|kr+dp.dp5|S(Ns...t(R5tlen(Rtlimit((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR�s&s	 rel="%s"RQs target="%s"swww.t@shttp://shttps://is.orgs.nets.coms<a href="http://%s"%s%s>%s</a>s<a href="%s"%s%s>%s</a>R0s<a href="mailto:%s">%s</a>u(t_word_split_reR1RRt	enumeratet_punctuation_retmatchtgroupst
startswithRRt_letterst_digitstendswitht_simple_email_retjoin(ttextttrim_url_limittrelttargetttrim_urltwordstrel_attrttarget_attrtitwordRXtleadtmiddlettrail((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyturlize�sH"iiidcCs�ddlm}|j�}g}x}t|�D]o}t}d}	}
d}d}g}
x�ttt||���D]�\}}x,tr�t|�}||kr�|}Pq�q�W|r�|j	�}t
}n|tdd�|	kr�|}	|
d7}
|d7}n|tdd	�|
kr5|}	}
|d
7}t}n|
j|�qsWdj|
�}
|
j
d�ru|
d d
}
n|
j
d
�s�|
d
7}
n|j|
�q/W|s�d
j|�Stdjd�|D���S(s+Generate some lorem ipsum for the template.i(tLOREM_IPSUM_WORDSiiiiRi
iR
u i����u

u
css|]}dt|�VqdS(u	<p>%s</p>N(R(t.0R((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pys	<genexpr>0sN(t	constantsRnR1trangeRR5RVRRt
capitalizetFalsetappendR_R]R(tnthtmltmintmaxRnRetresultR(tnext_capitalizedt
last_commat
last_fullstopRitlasttptidx((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytgenerate_lorem_ipsumsH
(		



	

sutf-8cCs�t|t�st|�}nt|t�r?|j|�}n|rKdnd}t||�}t|t�s�|jd�}n|r�|jdd�}n|S(s�Quote 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.
    RQRsutf-8s%20t+(R$RRtencodeR	tdecodetreplace(R%tcharsettfor_qstsafetrv((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytunicode_urlencode3stLRUCachecBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zdd�Z
dd�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZeZRS(s"A simple LRU Cache implementation.cCs,||_i|_t�|_|j�dS(N(tcapacityt_mappingRt_queuet	_postinit(tselfR�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__init__Ws		cCsL|jj|_|jj|_|jj|_t�|_|jj	|_
dS(N(R�tpopleftt_poplefttpopt_poptremovet_removeRt_wlockRtt_append(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR�]s
cCs"i|jd6|jd6|jd6S(NR�R�R�(R�R�R�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__getstate__es

cCs|jj|�|j�dS(N(t__dict__tupdateR�(R�td((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__setstate__lscCs
|jfS(N(R�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__getnewargs__pscCs<|j|j�}|jj|j�|jj|j�|S(s&Return a shallow copy of the instance.(t	__class__R�R�R�R�textend(R�R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytcopysscCs%y||SWntk
r |SXdS(s/Return an item from the cache dict or `default`N(tKeyError(R�tkeytdefault((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytgetzs
cCs/y||SWntk
r*|||<|SXdS(svSet `default` if the key is not in the cache otherwise
        leave unchanged. Return the value of this key.
        N(R�(R�R�R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt
setdefault�s


cCs@|jj�z|jj�|jj�Wd|jj�XdS(sClear the cache.N(R�tacquireR�R.R�trelease(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR.�s


cCs
||jkS(s$Check if a key exists in this cache.(R�(R�R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__contains__�scCs
t|j�S(s%Return the current size of the cache.(RRR�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__len__�scCsd|jj|jfS(Ns<%s %r>(R�RIR�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR�scCs|jj�z]|j|}|jd|krey|j|�Wntk
rTnX|j|�n|SWd|jj�XdS(s�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.
        i����N(R�R�R�R�R�t
ValueErrorR�R�(R�R�R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__getitem__�s


cCs�|jj�zh||jkr/|j|�n+t|j�|jkrZ|j|j�=n|j|�||j|<Wd|jj�XdS(shSets the value for an item. Moves the item up so that it
        has the highest priority then.
        N(	R�R�R�R�RRR�R�R�R�(R�R�tvalue((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__setitem__�s

cCsU|jj�z3|j|=y|j|�Wntk
r>nXWd|jj�XdS(s]Remove an item from the cache dict.
        Raise a `KeyError` if it does not exist.
        N(R�R�R�R�R�R�(R�R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__delitem__�s


cCs=gt|j�D]}||j|f^q}|j�|S(sReturn a list of items.(tlistR�R�treverse(R�R�Ry((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytitems�s/
cCs&tjdtdd�t|j��S(sIterate over all items.sP'iteritems()' will be removed in version 3.0. Use 'iter(cache.items())' instead.t
stackleveli(twarningstwarntDeprecationWarningtiterR�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt	iteritems�s
cCs!g|j�D]}|d^q
S(sReturn a list of all values.i(R�(R�R((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytvalues�scCs&tjdtdd�t|j��S(sIterate over all values.sQ'itervalue()' will be removed in version 3.0. Use 'iter(cache.values())' instead.R�i(R�R�R�R�R�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt	itervalue�s
cCs&tjdtdd�t|j��S(sIterate over all values.sR'itervalues()' will be removed in version 3.0. Use 'iter(cache.values())' instead.R�i(R�R�R�R�R�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt
itervalues�s
cCs
t|�S(s7Return a list of all keys ordered by most recent usage.(R�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytkeys�scCs tjdtdd�t|�S(s[Iterate over all keys in the cache dict, ordered by
        the most recent usage.
        sN'iterkeys()' will be removed in version 3.0. Use 'iter(cache.keys())' instead.R�i(R�R�R�R�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytiterkeys�s
cCstt|j��S(N(treversedttupleR�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__iter__
scCstt|j��S(sTIterate over the keys in the cache dict, oldest items
        coming first.
        (R�R�R�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__reversed__
sN(RIRHt__doc__R�R�R�R�R�R�R5R�R�R.R�R�RR�R�R�R�R�R�R�R�R�R�R�R�t__copy__(((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR�Ps4						
										
		
	
				RvthtmtxmlcsHtd�|D���td�|D�������fd�}|S(scIntelligently 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(R
N(tlstriptlower(RoR((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pys	<genexpr>Ascss(|]}d|jd�j�VqdS(R
N(R�R�(RoR((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pys	<genexpr>BscsF|dkr�S|j�}|j��r/tS|j��rBtS�S(N(R5R�R]RRs(t
template_name(R�tdefault_for_stringtdisabled_patternstenabled_patterns(s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt
autoescapeDs(R�(tenabled_extensionstdisabled_extensionsR�R�R�((R�R�R�R�s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytselect_autoescapes(
cKsa|d	krtj}n|||�jdd�jdd�jdd�jdd�}t|�S(
s�Works 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.
    u<u\u003cu>u\u003eu&u\u0026u'u\u0027N(R5tjsontdumpsR�R(R%tdumpertkwargsR�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pythtmlsafe_json_dumpsQstCyclercBs>eZdZd�Zd�Zed��Zd�ZeZRS(sDCycle 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
    cGs+|std��n||_d|_dS(Ns$at least one item has to be providedi(tRuntimeErrorR�tpos(R�R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR��s	cCs
d|_dS(s*Resets the current item to the first item.iN(R�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytreset�scCs|j|jS(sxReturn the current item. Equivalent to the item that will be
        returned next time :meth:`next` is called.
        (R�R�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytcurrent�scCs*|j}|jdt|j�|_|S(sXReturn the current item, then advance :attr:`current` to the
        next item.
        i(R�R�RRR�(R�R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pytnext�s	(	RIRHR�R�R�tpropertyR�R�t__next__(((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR�os			tJoinercBs#eZdZdd�Zd�ZRS(sA joining helper for templates.u, cCs||_t|_dS(N(tsepRstused(R�R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR��s	cCs|jst|_dS|jS(Nu(R�RR�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt__call__�s		(RIRHR�R�R�(((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR��st	NamespacecBs2eZdZd�Zd�Zd�Zd�ZRS(s~A namespace object that can hold arbitrary attributes.  It may be
    initialized from a dictionary or with keyword arguments.cOs+|d|d}}t||�|_dS(Nii(tdictt_Namespace__attrs(targsR�R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR��scCsU|ddhkr"tj||�Sy|j|SWntk
rPt|��nXdS(NR�R�(tobjectt__getattribute__R�R�R7(R�RK((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR��s
cCs||j|<dS(N(R�(R�RKR�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR��scCsd|jS(Ns<Namespace %r>(R�(R�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR�s(RIRHR�R�R�R�R(((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR��s
				s,async def _():
 async for _ in ():
  yield _cCs0ddlm}tjdtdd�||�S(Ni����(tsoft_unicodesb'jinja2.utils.soft_unicode' will be removed in version 3.0. Use 'markupsafe.soft_unicode' instead.R�i(t
markupsafeR�R�R�R�(tsR�((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyR��s(RRs&lt;(R
RRRs
s&gt;((shtmlR�sxml((AR�R=treR�tcollectionsRtrandomRRt	threadingRR�RRt_compatRRRR	tcompileRUR_tmapRWR^t
_striptags_ret
_entity_reR[R\RGRtsetRtconcatR�t
_slash_escapeRRRR!R&R)R/RsR;RCRLROR5RmRR�R�R�R�tMutableMappingtregisterR�R�R�R�R�thave_async_gentSyntaxErrorR�(((s./tmp/pip-install-sTXtzD/Jinja2/jinja2/utils.pyt<module>sr"				
	
				

	@1�46




https://t.me/AnonymousX5 - 2025