Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
¡‹EYc@sÉdZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZmZej
dƒZej
ddjeejd>ƒƒdjeejd?ƒƒfƒZej
dƒZej
dƒZej
dƒZdZdZedd@id„d6ƒƒZeƒZdjZdejdƒkZd„Zd„Z d„Z!d „Z"d!„Z#d"„Z$d#„Z%e&d$„Z'd%d&„Z(d'„Z)e&d(„Z*dddd)„Z,d*e-d+d,d-„Z.d.e&d/„Z/d0e0fd1„ƒYZ1y!dd2lm2Z2e2j3e1ƒWne4k
r)nXdAdBe-e&d6„Z5dd7„Z6ed8e0fd9„ƒYƒZ7d:e0fd;„ƒYZ8yd<dUe-Z9Wne:k
r¨e&Z9nXdd=l;m<Z<mZm=Z=dS(Cs™
    jinja2.utils
    ~~~~~~~~~~~~

    Utility functions.

    :copyright: (c) 2017 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
iÿÿÿÿN(tdeque(tLock(t	text_typetstring_typestimplements_iteratort	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((sA/home/tvault/.virtenv/lib/python2.7/site-packages/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((sA/home/tvault/.virtenv/lib/python2.7/site-packages/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((sA/home/tvault/.virtenv/lib/python2.7/site-packages/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((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyRIs	cCstj|jƒ|S(s%Marks the function as internally used(t
internal_codetaddt__code__(R((sA/home/tvault/.virtenv/lib/python2.7/site-packages/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(tjinja2.runtimeRt
isinstance(tobjR((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytis_undefinedYscCsx|D]}qWdS(s4Consumes an iterable without doing anything with it.N((titerabletevent((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytconsumeis
cCs8ddlm}ddlm}|jƒ|jƒdS(s"Jinja2 keeps internal caches for environments and lexers.  These are
    used so that Jinja2 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(tjinja2.environmentR&tjinja2.lexerR'tclear(R&R'((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytclear_cachesos
cCs¹yd|kr*|jddƒ\}}nEd|kre|jdƒ}dj|d ƒ}|d}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	iÿÿÿÿN(tsplittjoint
__import__tgetattrtNonetImportErrortAttributeError(timport_nametsilenttmoduleR!titems((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt
import_string{s

#trbcCsRyt||ƒSWn:tk
rM}|jtjtjtjfkrN‚qNnXdS(sZReturns a file descriptor for the filename if that file exists,
    otherwise `None`.
    N(topentIOErrorterrnotENOENTtEISDIRtEINVAL(tfilenametmodete((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytopen_if_exists•s
!cCsc|dkrdS|tkr dS|jjdkrA|jj}n|jjd|jj}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`).
    R1tEllipsist__builtin__tbuiltinsR	s	%s objectN(s__builtin__sbuiltins(R1RDt	__class__t
__module__t__name__(R!tname((sA/home/tvault/.virtenv/lib/python2.7/site-packages/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(RLR2tpprintRN(R!RMRLRN((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyRN±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(R1tlen(Rtlimit((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyRËss	 rel="%s"RPs 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>R,s<a href="mailto:%s">%s</a>u(t_word_split_reR-Rtescapet	enumeratet_punctuation_retmatchtgroupst
startswithRQt_letterst_digitstendswitht_simple_email_reR.(ttextttrim_url_limittrelttargetttrim_urltwordstrel_attrttarget_attrtitwordRXtleadtmiddlettrail((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyturlize½s:"iiidcCsèddlm}ddlm}m}|jƒ}g}x}t|ƒD]o}	t}
d}}d}
d}g}xìt	t|||ƒƒƒD]Ï\}}	x,trÃ||ƒ}
|
|kr˜|
}Pq˜q˜W|
rß|
j
ƒ}
t}
n||ddƒ|kr|}|d7}|
d7}
n||d	d
ƒ|krK|}}|
d7}
t}
n|j|
ƒq‰Wdj
|ƒ}|jdƒr‹|d d}n|jdƒs§|d7}n|j|ƒqEW|sËd
j
|ƒStdj
d„|DƒƒƒS(s+Generate some lorem ipsum for the template.iÿÿÿÿ(tLOREM_IPSUM_WORDS(tchoicet	randrangeiiiiR
i
iR	u u

u
css|]}dt|ƒVqdS(u	<p>%s</p>N(RU(t.0R((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pys	<genexpr>sN(tjinja2.constantsRmtrandomRnRoR-trangeRR1RVt
capitalizetFalsetappendR.R]tMarkup(tnthtmltmintmaxRmRnRoRdtresultt_tnext_capitalizedt
last_commat
last_fullstopRhtlasttptidx((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytgenerate_lorem_ipsumîsJ
(		



	

sutf-8cCs†t|tƒst|ƒ}nt|tƒr?|j|ƒ}n|rLdpOd}tt||ƒƒ}|r‚|jddƒ}n|S(s&URL escapes a single bytestring or unicode string with the
    given charset if applicable to URL safe quoting under all rules
    that need to be considered under all supported Python versions.

    If non strings are provided they are converted to their unicode
    representation first.
    RRPs%20t+(R RRtencodeRtreplace(R!tcharsettfor_qstsafetrv((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytunicode_urlencodestLRUCachecBsæeZdZd„Zd„Zd„Zd„Zd„Zd„Zdd„Z
dd„Zd	„Zd
„Z
d„Zd„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZeZd„ZeZRS(s"A simple LRU Cache implementation.cCs,||_i|_tƒ|_|jƒdS(N(tcapacityt_mappingRt_queuet	_postinit(tselfRŽ((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt__init__9s		cCsL|jj|_|jj|_|jj|_tƒ|_|jj	|_
dS(N(Rtpopleftt_poplefttpopt_poptremovet_removeRt_wlockRvt_append(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyR‘?s
cCs"i|jd6|jd6|jd6S(NRŽRR(RŽRR(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt__getstate__Gs

cCs|jj|ƒ|jƒdS(N(t__dict__tupdateR‘(R’td((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt__setstate__NscCs
|jfS(N(RŽ(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt__getnewargs__RscCs;|j|jƒ}|jj|jƒt|jƒ|_|S(s&Return a shallow copy of the instance.(RGRŽRRžRR(R’R‹((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytcopyUscCs%y||SWntk
r |SXdS(s/Return an item from the cache dict or `default`N(tKeyError(R’tkeytdefault((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytget\s
cCsQ|jjƒz/y||SWntk
r:|||<|SXWd|jjƒXdS(svSet `default` if the key is not in the cache otherwise
        leave unchanged. Return the value of this key.
        N(RštacquireR£trelease(R’R¤R¥((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt
setdefaultcs


	cCs@|jjƒz|jjƒ|jjƒWd|jjƒXdS(sClear the cache.N(RšR§RR*RR¨(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyR*qs


cCs
||jkS(s$Check if a key exists in this cache.(R(R’R¤((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt__contains__zscCs
t|jƒS(s%Return the current size of the cache.(RQR(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt__len__~scCsd|jj|jfS(Ns<%s %r>(RGRIR(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyR‚s	cCs|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‹((sA/home/tvault/.virtenv/lib/python2.7/site-packages/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™RQRŽR•R›R¨(R’R¤tvalue((sA/home/tvault/.virtenv/lib/python2.7/site-packages/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¤((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt__delitem__­s


cCs=gt|jƒD]}||j|f^q}|jƒ|S(sReturn a list of items.(tlistRRtreverse(R’R¤R|((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyR7¼s/
cCst|jƒƒS(sIterate over all items.(titerR7(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt	iteritemsÂscCs!g|jƒD]}|d^q
S(sReturn a list of all values.i(R7(R’R((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytvaluesÆscCst|jƒƒS(sIterate over all values.(R³Rµ(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt	itervalueÊscCs
t|ƒS(s7Return a list of all keys ordered by most recent usage.(R±(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytkeysÎscCstt|jƒƒS(s[Iterate over all keys in the cache dict, ordered by
        the most recent usage.
        (treversedttupleR(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytiterkeysÒscCstt|jƒƒS(sVIterate over the values in the cache dict, oldest items
        coming first.
        (R³R¹R(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt__reversed__ÚsN(RIRHt__doc__R“R‘RœR R¡R¢R1R¦R©R*RªR«RR­R¯R°R7R´RµR¶R·Rºt__iter__R»t__copy__(((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyR2s2																					(tMutableMappingRythtmtxmlcsHtd„|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(RpR((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pys	<genexpr>scss(|]}d|jdƒjƒVqdS(R	N(RÂRÃ(RpR((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pys	<genexpr>scsF|dkrˆS|jƒ}|jˆƒr/tS|jˆƒrBtSˆS(N(R1RÃR]RRu(t
template_name(R¥tdefault_for_stringtdisabled_patternstenabled_patterns(sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt
autoescapes(R¹(tenabled_extensionstdisabled_extensionsRÅR¥RÈ((R¥RÅRÆRÇsA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytselect_autoescapeës&	
	
	cKs[|d	krtj}n|||jddƒjddƒjddƒjddƒ}|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(R1tjsontdumpsR‡(R!tdumpertkwargsR‹((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pythtmlsafe_json_dumps!stCyclercBs>eZdZd„Zd„Zed„ƒZd„ZeZRS(sA cycle helper for templates.cGs,|stdƒ‚n||_|jƒdS(Ns$at least one item has to be provided(tRuntimeErrorR7treset(R’R7((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyR“As	cCs
d|_dS(sResets the cycle.iN(tpos(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyRÓGscCs|j|jS(sReturns the current item.(R7RÔ(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytcurrentKscCs*|j}|jdt|jƒ|_|S(s#Goes one item ahead and returns it.i(RÕRÔRQR7(R’R‹((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pytnextPs	(	RIRHR¼R“RÓtpropertyRÕRÖt__next__(((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyRÑ=s			tJoinercBs#eZdZdd„Zd„ZRS(sA joining helper for templates.u, cCs||_t|_dS(N(tsepRutused(R’RÚ((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyR“\s	cCs|jst|_dS|jS(Nu(RÛRRÚ(R’((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt__call__`s		(RIRHR¼R“RÜ(((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyRÙYss,async def _():
 async for _ in ():
  yield _(RwRUtsoft_unicode(RRs&lt;(R	R
RRs
s&gt;((shtmlRÀsxml((>R¼treRÌR<tcollectionsRt	threadingRtjinja2._compatRRRRtcompileRTR.tmapRURWR^t
_striptags_ret
_entity_reR[R\ttypeRtsetRtconcatRÍt
_slash_escapeRRRRR"R%R+RuR8RCRKRNR1RlRR„RŒtobjectRR¿tregisterR2RËRÐRÑRÙthave_async_gentSyntaxErrort
markupsafeRwRÝ(((sA/home/tvault/.virtenv/lib/python2.7/site-packages/jinja2/utils.pyt<module>
sl""				
	
					11²
3