uawdijnntqw1x1x1
IP : 3.139.80.169
Hostname : ns1.eurodns.top
Kernel : Linux ns1.eurodns.top 4.18.0-553.5.1.lve.1.el7h.x86_64 #1 SMP Fri Jun 14 14:24:52 UTC 2024 x86_64
Disable Function : mail,sendmail,exec,passthru,shell_exec,system,popen,curl_multi_exec,show_source,eval,open_base
OS : Linux
PATH:
/
home
/
..
/
lib
/
python2.7
/
site-packages
/
procfs
/
..
/
.
/
jinja2
/
utils.pyc
/
/
� ��Rc@sKdZddlZddlZddlmZddlmZmZmZm Z m Z ejd�Zejddj eejd5��dj eejd6��f�Zejd�Zejd�Zejd�ZdZdZedd7id�d6��Ze�Zdj Zd�Zd�Zd�Zd�Zd�Zd�Z d �Z!e"d!�Z#d"d#�Z$d$�Z%e"d%�Z&de"d&�Z(d'e)d(d)d*�Z*d+d,�Z+d-e,fd.��YZ-y!dd/lm.Z.e.j/e-�Wne0k r�nXed0e,fd1��Y�Z1d2e,fd3��YZ2dd4l3m4Z4mZm5Z5dS(8s� jinja2.utils ~~~~~~~~~~~~ Utility functions. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. i����N(tdeque(t text_typetstring_typestimplements_iteratort allocate_lockt url_quotes(\s+)s4^(?P<lead>(?:%s)*)(?P<middle>.*?)(?P<trail>(?:%s)*)$t|t(t<s<t.t,t)t>s s>s&^\S+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+$s(<!--.*?-->|<[^>]*>)s &([^;]+);t4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZt 0123456789tMissingTypecCsdS(Ntmissing((tx((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt<lambda> st__repr__ucCs 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((s0/usr/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((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyR8s 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((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyREs cCstj|j�|S(s%Marks the function as internally used(t internal_codetaddt__code__(R((s0/usr/lib/python2.7/site-packages/jinja2/utils.pytinternalcodeOscCsddlm}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((s0/usr/lib/python2.7/site-packages/jinja2/utils.pytis_undefinedUscCsx|D]}qWdS(s4Consumes an iterable without doing anything with it.N((titerabletevent((s0/usr/lib/python2.7/site-packages/jinja2/utils.pytconsumees 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 messuring memory consumption you may want to clean the caches. i����(t_spontaneous_environments(t_lexer_cacheN(tjinja2.environmentR%tjinja2.lexerR&tclear(R%R&((s0/usr/lib/python2.7/site-packages/jinja2/utils.pytclear_cachesks 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((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt import_stringws #trbcCsLyt||�SWn4tk rG}|jtjtjfkrH�qHnXdS(sZReturns a file descriptor for the filename if that file exists, otherwise `None`. N(topentIOErrorterrnotENOENTtEISDIR(tfilenametmodete((s0/usr/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`). R0tEllipsist__builtin__tbuiltinsR s %s objectN(s__builtin__RD(R0RBt __class__t __module__t__name__(R tname((s0/usr/lib/python2.7/site-packages/jinja2/utils.pytobject_type_repr�scCsSy$ddlm}||d|�SWn(tk rNddlm}||�SXdS(sYPrettyprint an object. Either use the `pretty` library or the builtin `pprint`. i����(tprettytverbose(tpformatN(RJR1tpprintRL(R RKRJRL((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyRL�s cCs�|d�}tjtt|���}|r3dp6d}x�t|�D]�\}}tj|�}|rF|j�\} } }| jd�s d| kr&| jd�r&| jd�r&t | �dkr&| dt tkr&| jd �s | jd �s | jd�r&d| ||| �f} n| jd�sD| jd�r`d | ||| �f} nd| kr�| jd�r�d| kr�t j| �r�d| | f} n| | ||kr�| | |||<q�qFqFWdj|�S(s�Converts 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. cSs6|dk r2|| t|�|kr+dp.dp5|S(Ns...t(R0tlen(Rtlimit((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyR�ss rel="nofollow"RNswww.t@shttp://shttps://is.orgs.nets.coms<a href="http://%s"%s>%s</a>s<a href="%s"%s>%s</a>R+s<a href="mailto:%s">%s</a>u(t_word_split_reR,Rtescapet enumeratet_punctuation_retmatchtgroupst startswithROt_letterst_digitstendswitht_simple_email_reR-(ttextttrim_url_limittnofollowttrim_urltwordst nofollow_attrtitwordRVtleadtmiddlettrail((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyturlize�s8iiidcCs�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�Wdj |�}|jd�r�|d d}n|jd�s�|d7}n|j|�qEW|s�d j |�Stdj d�|D���S(s,Generate some lorem impsum for the template.i����(tLOREM_IPSUM_WORDS(tchoicet randrangeiiiiR i iR u u u css|]}dt|�VqdS(u <p>%s</p>N(RS(t.0R((s0/usr/lib/python2.7/site-packages/jinja2/utils.pys <genexpr>sN(tjinja2.constantsRitrandomRjRkR,trangeRR0RTt capitalizetFalsetappendR-R[tMarkup(tnthtmltmintmaxRiRjRkRatresultt_tnext_capitalizedt last_commat last_fullstopRdtlasttptidx((s0/usr/lib/python2.7/site-packages/jinja2/utils.pytgenerate_lorem_ipsum�sJ ( sutf-8cCsOt|t�st|�}nt|t�r?|j|�}ntt|��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. (RRRtencodeR(R tcharset((s0/usr/lib/python2.7/site-packages/jinja2/utils.pytunicode_urlencodes tLRUCachecBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zdd�Z dd�Zd �Zd �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�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt__init__-s cCsL|jj|_|jj|_|jj|_t�|_|jj |_ dS(N(R�tpopleftt_poplefttpopt_poptremovet_removeRt_wlockRrt_append(R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyR�3s cCs"i|jd6|jd6|jd6S(NR�R�R�(R�R�R�(R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt__getstate__;s cCs|jj|�|j�dS(N(t__dict__tupdateR�(R�td((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt__setstate__BscCs |jfS(N(R�(R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt__getnewargs__FscCs;|j|j�}|jj|j�t|j�|_|S(s&Return a shallow copy of the instance.(RER�R�R�RR�(R�trv((s0/usr/lib/python2.7/site-packages/jinja2/utils.pytcopyIscCs%y||SWntk r |SXdS(s/Return an item from the cache dict or `default`N(tKeyError(R�tkeytdefault((s0/usr/lib/python2.7/site-packages/jinja2/utils.pytgetPs 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�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt setdefaultWs cCs@|jj�z|jj�|jj�Wd|jj�XdS(sClear the cache.N(R�R�R�R)R�R�(R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyR)es cCs ||jkS(s$Check if a key exists in this cache.(R�(R�R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt__contains__nscCs t|j�S(s%Return the current size of the cache.(ROR�(R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt__len__rscCsd|jj|jfS(Ns<%s %r>(RERGR�(R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyRvs 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�((s0/usr/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�ROR�R�R�R�(R�R�tvalue((s0/usr/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�((s0/usr/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�Rx((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyR6�s/ cCst|j��S(sIterate over all items.(titerR6(R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt iteritems�scCs!g|j�D]}|d^q S(sReturn a list of all values.i(R6(R�R((s0/usr/lib/python2.7/site-packages/jinja2/utils.pytvalues�scCst|j��S(sIterate over all values.(R�R�(R�((s0/usr/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�((s0/usr/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�((s0/usr/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�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt__reversed__�sN(RGRFt__doc__R�R�R�R�R�R�R0R�R�R)R�R�RR�R�R�R6R�R�R�R�R�t__iter__R�t__copy__(((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyR�&s2 (tMutableMappingtCyclercBs8eZdZd�Zd�Zed��Zd�ZRS(sA cycle helper for templates.cGs,|std��n||_|j�dS(Ns$at least one item has to be provided(tRuntimeErrorR6treset(R�R6((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyR��s cCs d|_dS(sResets the cycle.iN(tpos(R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyR��scCs|j|jS(sReturns the current item.(R6R�(R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pytcurrent�scCs*|j}|jdt|j�|_|S(s#Goes one item ahead and returns it.i(R�R�ROR6(R�R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt__next__�s (RGRFR�R�R�tpropertyR�R�(((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyR��s tJoinercBs#eZdZdd�Zd�ZRS(sA joining helper for templates.u, cCs||_t|_dS(N(tsepRqtused(R�R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyR��s cCs|jst|_dS|jS(Nu(R�RR�(R�((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt__call__s (RGRFR�R�R�(((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyR��s(RsRStsoft_unicode(RRs<(R R RRs s>((6R�treR;tcollectionsRtjinja2._compatRRRRRtcompileRRR-tmapRSRUR\t _striptags_ret _entity_reRYRZttypeRtsetRtconcatRRRRR!R$R*RqR7RARIRLR0RhRR�R�tobjectR�R�tregisterR1R�R�t markupsafeRsR�(((s0/usr/lib/python2.7/site-packages/jinja2/utils.pyt<module> sR(" -1�
/home/../lib/python2.7/site-packages/procfs/.././jinja2/utils.pyc