File "utils.cpython-37.opt-1.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/utils.cpython-37.opt-1.pyc
File size: 26.54 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit

B

g[a[i@shUddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddl
mZddl
mZddlmZddlmZddlZejrddlZejd	ejd
ejfdZedd
dddiZejed<eZej eed<dj!Z"eedddZ#eedddZ$eedddZ%Gdddej&Z'eedddZ(eeddd Z)eedd!d"Z*eedd#d$Z+eje,d%d&d'Z-ej.ejdd(d)d*Z/dd+d,d-Z0d`e1e,ejd/d0d1Z2dae1e1ej3ej4d3d4d5Z5eje1d%d6d7Z6eje1d%d8d9Z7e8d:ej9ej:BZ;e8d;Z<dbe1ej3e=ej3e1ej3e1ej3ej.e1e1d<d=d>Z>dce=e,e=e=e1dCdDdEZ?ddeje1e,e1dGdHdIZ@deeje1e,e1dGdJdKZAejBjCGdLdMdMZDdfejEe1ejEe1e,e,ejej3e1ge,fdOdPdQZFdgejej3ejd
e1fejejGdRdSdTZHGdUdVdVZIGdWdXdXZJGdYdZdZZKGd[d\d\ejGZGeje1d]d^d_ZLdS)hN)abc)deque)choice)	randrange)Lock)CodeType)quote_from_bytesF.)ZboundZMissingType__repr__cCsdS)Nmissingr
)xr
r
=/opt/alt/python37/lib/python3.7/site-packages/jinja2/utils.py<lambda>rr
internal_code)freturncCstj|_|S)aPass 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``.
    )_PassArgcontextjinja_pass_arg)rr
r
rpass_contexts
rcCstj|_|S)aPass 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
rpass_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``.
    )renvironmentr)rr
r
rpass_environment@s	rc@s>eZdZeZeZeZee	e
jddddZdS)r)objrcCst|dr|jSxjdD]b}|dd}xP|d|dfD]8}t||ddkr<tj|d	|d
tdd||Sq<WqWdS)
Nr)rrr_rfunctionfilterFTz= is deprecated and will stop working in Jinja 3.1. Use 'pass_z
' instead.)
stacklevel)hasattrrreplacegetattrwarningswarnDeprecationWarning)clsrprefixZsquashednamer
r
rfrom_objRs

z_PassArg.from_objN)
__name__
__module____qualname__enumautorrrclassmethodr	tOptionalr,r
r
r
rrMs
rcCstjdtddt|S)zPass 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
rcontextfunctiongs
r5cCstjdtddt|S)zPass 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
revalcontextfunctionws

r6cCstjdtddt|S)zPass 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
renvironmentfunctions
r7cCst|j|S)z%Marks the function as internally used)radd__code__)rr
r
rinternalcodesr:)rrcCsddlm}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
    )	Undefined)Zruntimer<
isinstance)rr<r
r
ris_undefinedsr>)iterablercCsx|D]}qWdS)z4Consumes an iterable without doing anything with it.Nr
)r?rr
r
rconsumes
r@)rcCs,ddlm}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;)get_spontaneous_environment)_lexer_cacheN)rrAZlexerrBcache_clearclear)rArBr
r
rclear_cachessrEF)import_namesilentrc	CsvyRd|kr|dd\}}n"d|kr6|d\}}}nt|Stt|dd|g|Sttfk
rp|slYnXdS)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;.N)split
rpartition
__import__r%ImportErrorAttributeError)rFrGmodulerrr
r
r
import_stringsrPrb)filenamemodercCstj|sdSt||S)z\Returns a file descriptor for the filename if that file exists,
    otherwise ``None``.
    N)ospathisfileopen)rRrSr
r
ropen_if_existssrXcCsJ|dkrdS|tkrdSt|}|jdkr6|jdS|jd|jdS)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`).
    NNoneEllipsisbuiltinsz objectrI)rZtyper.r-)rr)r
r
robject_type_reprs
r]cCsddlm}||S)z.Format an object using :func:`pprint.pformat`.r)pformat)Zpprintr^)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+$)texttrim_url_limitreltarget
extra_schemesrc
sdk	rttdfdd}nttddd}tdtt|}|rZdt|dnd	}|rtd
t|dnd	}x@t|D]2\}	}
d	|
d	}}}
td|}|r|}||d}|	drt
d
|}|r|}
|d|}xzdD]r\}}||}|||kr"qxLt
t||
|D]4}|
|t|}||
d|7}|
|d}
q8WqWt|r|ds|drd|d||d||d}n d|d||d||d}n|drt|ddrd|d|ddd}nd|krX|dsXd|krXt|rXd|d|d}nL|dk	rx@|D]8}||krh||rhd|d||d|d}qhW|||
||	<qWd	|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|ddS|S)Nz...)len)r
)r`r
rtrim_urlGszurlize.<locals>.trim_urlcSs|S)Nr
)r
r
r
rreOsz(\s+)z rel=""rz	 target="z
^([(<]|&lt;)+))>rI,
z&gt;z([)>.,\n]|&gt;)+$))(rg)<rh)z&lt;z&gt;zhttps://zhttp://z	<a href="rhz</a>z<a href="https://zmailto:z">@zwww.rHz<a href="mailto:)strrerJ
markupsafeescape	enumeratematchgroupendendswithsearchstartcountrangeminindexrd_http_re
startswith	_email_rejoin)r_r`rarbrcrewordsZrel_attrZtarget_attriwordheadZmiddletailrtZ
start_charZend_charZstart_countrZ	end_indexZschemer
)r`rurlizesT&

"" 



"rTd)nhtmlr|maxrcCsXddlm}|}g}xt|D]}d}d}	}
d}d}g}
xttt||D]\}}xt|}||kr`|}Pq`W|r|}d}|tdd|	kr|}	|
d	7}
|d
7}|tdd|
kr|}	}
|d
7}d}|
|qVWd	|
}|
d
r|ddd
}n|
d
s |d
7}||q$W|s>d	|Std	dd|DS)z+Generate some lorem ipsum for the template.r;)LOREM_IPSUM_WORDSTrNFr!ri
rrI z

rjcss |]}dt|dVqdS)z<p>z</p>N)rqrr).0r
r
r
r	<genexpr>sz'generate_lorem_ipsum.<locals>.<genexpr>)
Z	constantsrrJr{rsrr
capitalizeappendrrwrqMarkup)rrr|rrrresultrZnext_capitalizedZ
last_commaZ
last_fullstoprZlastpidxZp_strr
r
rgenerate_lorem_ipsumsJ

rutf-8)rcharsetfor_qsrcCsPt|ts&t|tst|}||}|r.dnd}t||}|rL|dd}|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.
    r/z%20+)r=bytesroencoderr$)rrrZsafervr
r
r	url_quotes



rcCs&ddl}|jdtddt|||dS)Nrz_'unicode_urlencode' has been renamed to 'url_quote'. The old name will be removed in Jinja 3.1.r!)r")rr)r&r'r(r)rrrr&r
r
runicode_urlencodesrc@seZdZdZeddddZddddZeje	ej
fdd	d
Zeje	ej
fdddd
Zej
dddZddddZd1ej
ej
ej
dddZd2ej
ej
ej
dddZddddZej
edddZedddZe	dddZej
ej
dd d!Zej
ej
dd"d#d$Zej
ddd%d&Zejej
ej
ej
fdd'd(Zejej
dd)d*Zejej
dd+d,Zejej
dd-d.Zejej
dd/d0Z eZ!dS)3LRUCachez"A simple LRU Cache implementation.N)capacityrcCs ||_i|_t|_|dS)N)r_mappingr_queue	_postinit)selfrr
r
r__init__szLRUCache.__init__)rcCs4|jj|_|jj|_|jj|_t|_|jj	|_
dS)N)rpopleft_popleftpopZ_popremove_remover_wlockr_append)rr
r
rrs



zLRUCache._postinitcCs|j|j|jdS)N)rrr)rrr)rr
r
r__getstate__szLRUCache.__getstate__)drcCs|j||dS)N)__dict__updater)rrr
r
r__setstate__szLRUCache.__setstate__cCs|jfS)N)r)rr
r
r__getnewargs__szLRUCache.__getnewargs__cCs,||j}|j|j|j|j|S)z&Return a shallow copy of the instance.)	__class__rrrrextend)rrr
r
rcopysz
LRUCache.copy)keydefaultrcCs"y||Stk
r|SXdS)z/Return an item from the cache dict or `default`N)KeyError)rrrr
r
rgetsz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)rrrr
r
r
setdefault$s
zLRUCache.setdefaultc	Cs*|j|j|jWdQRXdS)zClear the cache.N)rrrDr)rr
r
rrD.s
zLRUCache.clear)rrcCs
||jkS)z$Check if a key exists in this cache.)r)rrr
r
r__contains__4szLRUCache.__contains__cCs
t|jS)z%Return the current size of the cache.)rdr)rr
r
r__len__8szLRUCache.__len__cCsdt|jd|jdS)Nrlrrh)r\r-r)rr
r
rr<szLRUCache.__repr__c	Cs\|jL|j|}|jd|krNy||Wntk
rBYnX|||SQRXdS)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.
        rN)rrrr
ValueErrorr)rrrr
r
r__getitem__?s

zLRUCache.__getitem__)rvaluerc	Cs\|jL||jkr||nt|j|jkr:|j|=||||j|<WdQRXdS)zhSets the value for an item. Moves the item up so that it
        has the highest priority then.
        N)rrrrdrrr)rrrr
r
r__setitem__Us

zLRUCache.__setitem__c	CsB|j2|j|=y||Wntk
r2YnXWdQRXdS)z]Remove an item from the cache dict.
        Raise a `KeyError` if it does not exist.
        N)rrrr)rrr
r
r__delitem__bszLRUCache.__delitem__cs$fddtjD}||S)zReturn a list of items.csg|]}|j|fqSr
)r)rr)rr
r
<listcomp>psz"LRUCache.items.<locals>.<listcomp>)listrreverse)rrr
)rritemsnszLRUCache.itemscCsdd|DS)zReturn a list of all values.cSsg|]}|dqS)r;r
)rr
r
r
rrvsz#LRUCache.values.<locals>.<listcomp>)r)rr
r
rvaluestszLRUCache.valuescCst|S)z7Return a list of all keys ordered by most recent usage.)r)rr
r
rkeysxsz
LRUCache.keyscCstt|jS)N)reversedtupler)rr
r
r__iter__|szLRUCache.__iter__cCstt|jS)zTIterate over the keys in the cache dict, oldest items
        coming first.
        )iterrr)rr
r
r__reversed__szLRUCache.__reversed__)N)N)"r-r.r/__doc__intrrr3MappingroAnyrrZTuplerrrrrDboolrrrrrrIterablerrrIteratorrr__copy__r
r
r
rrs,

"rrZhtmZxml)enabled_extensionsdisabled_extensionsdefault_for_stringrrcsHtdd|Dtdd|Dtjttdfdd}|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|dVqdS)rIN)lstriplower)rr
r
r
rrsz$select_autoescape.<locals>.<genexpr>css"|]}d|dVqdS)rIN)rr)rr
r
r
rrs)
template_namercs4|dkrS|}|r"dS|r0dSS)NTF)rrw)r)rrdisabled_patternsenabled_patternsr
r
autoescapes

z%select_autoescape.<locals>.autoescape)rr3r4ror)rrrrrr
)rrrrrselect_autoescapes( 
r)rdumpskwargsrcKs@|dkrtj}t||f|dddddddd	S)
aSerialize 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
    Nrlz\u003crhz\u003e&z\u0026'z\u0027)jsonrrqrr$)rrrr
r
rhtmlsafe_json_dumpssrc@sXeZdZdZejddddZddddZeejdd	d
Z	ejddd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)rrcGs|std||_d|_dS)Nz$at least one item has to be providedr)RuntimeErrorrpos)rrr
r
rrszCycler.__init__)rcCs
d|_dS)z*Resets the current item to the first item.rN)r)rr
r
rresetszCycler.resetcCs|j|jS)zxReturn the current item. Equivalent to the item that will be
        returned next time :meth:`next` is called.
        )rr)rr
r
rcurrentszCycler.currentcCs |j}|jdt|j|_|S)zXReturn the current item, then advance :attr:`current` to the
        next item.
        r;)rrrdr)rrr
r
rnextszCycler.next)r-r.r/rr3rrrpropertyrr__next__r
r
r
rrsrc@s0eZdZdZd
eddddZeddd	ZdS)JoinerzA joining helper for templates., N)seprcCs||_d|_dS)NF)rused)rrr
r
rr!szJoiner.__init__)rcCs|jsd|_dS|jS)NTr)rr)rr
r
r__call__%szJoiner.__call__)r)r-r.r/rrorrr
r
r
rrsrc@sZeZdZdZejejddddZeejdddZeejdd	d
dZ	edd
dZ
dS)	Namespacez~A namespace object that can hold arbitrary attributes.  It may be
    initialized from a dictionary or with keyword arguments.N)argsrrcOs&|d|dd}}t|||_dS)Nrr;)dict_Namespace__attrs)rrrr
r
rr0szNamespace.__init__)r+rcCsB|dkrt||Sy
|j|Stk
r<t|dYnXdS)N>rr)object__getattribute__rrrN)rr+r
r
rr4s
zNamespace.__getattribute__)r+rrcCs||j|<dS)N)r)rr+rr
r
rr=szNamespace.__setitem__)rcCsd|jdS)Nz<Namespace rh)r)rr
r
rr@szNamespace.__repr__)r-r.r/rr3rrrorrrr
r
r
rr,s
	rcseZdZdfdd	ZZS)rrNstrictcs"tjdtddt||||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)baseencodingerrors)rr
rrEs
zMarkup.__new__)rNr)r-r.r/r
__classcell__r
r
)rrrDsr)srcCstjdtddt|S)Nzc'jinja2.escape' is deprecated and will be removed in Jinja 3.1. Import 'markupsafe.escape' instead.r!)r")r&r'r(rqrr)rr
r
rrrOs
rr)F)rQ)NNNN)rTrr)rF)rF)rr
TF)N)Mr0rrTrptypingr3r&collectionsrrZrandomrr	threadingrtypesrZurllib.parserrqZ
TYPE_CHECKINGZtyping_extensionsZteZTypeVarCallablerr	r\r__annotations__setr
MutableSetrconcatrrrEnumrr5r6r7r:rr>rr@rErorPr4ZIOrXr]r^compile
IGNORECASEVERBOSEr~rrrrrrMutableMappingregisterr
Collectionrrrrrrrrr
r
r
r<module>s| 



*t
5 4&6