uawdijnntqw1x1x1
IP : 3.15.17.60
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
/
rhn
/
..
/
jinja2
/
ext.pyo
/
/
� ��Rc@s�dZddlmZddlmZmZmZmZmZm Z m Z mZmZm Z mZmZddlmZddlmZddlmZmZddlmZmZmZddlmZmZmZmZd"Z de!fd ��YZ"dee"e#�fd��YZ$ed��Z%d�Z&d�Z'de$fd��YZ(de$fd��YZ)de$fd��YZ*de$fd��YZ+de$fd��YZ,e e-d�Z.de#fd��YZ/d �Z0e(Z1e)Z2e*Z3e+Z4e,Z5d!S(#s jinja2.ext ~~~~~~~~~~ Jinja extensions allow to add custom tags similar to the way django custom tags work. By default two example extensions exist: an i18n and a cache extension. :copyright: (c) 2010 by the Jinja Team. :license: BSD. i����(tnodes(tBLOCK_START_STRINGtBLOCK_END_STRINGtVARIABLE_START_STRINGtVARIABLE_END_STRINGtCOMMENT_START_STRINGtCOMMENT_END_STRINGtLINE_STATEMENT_PREFIXtLINE_COMMENT_PREFIXtTRIM_BLOCKStNEWLINE_SEQUENCEtKEEP_TRAILING_NEWLINEt LSTRIP_BLOCKS(tEnvironment(tconcat(tTemplateAssertionErrortTemplateSyntaxError(tcontextfunctiont import_stringtMarkup(tnexttwith_metaclasststring_typest iteritemst_tgettexttngettexttExtensionRegistrycBseZdZd�ZRS(s)Gives the extension an unique identifier.cCs3tj||||�}|jd|j|_|S(Nt.(ttypet__new__t __module__t__name__t identifier(tclstnametbasestdtrv((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR#s(R Rt__doc__R(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR st ExtensioncBsqeZdZe�ZdZd�Zd�Zd d�Z d�Z d�Zd d�Zd d d d d d�Z RS( sgExtensions can be used to add extra functionality to the Jinja template system at the parser level. Custom extensions are bound to an environment but may not store environment specific data on `self`. The reason for this is that an extension can be bound to another environment (for overlays) by creating a copy and reassigning the `environment` attribute. As extensions are created by the environment they cannot accept any arguments for configuration. One may want to work around that by using a factory function, but that is not possible as extensions are identified by their import name. The correct way to configure the extension is storing the configuration values on the environment. Because this way the environment ends up acting as central configuration storage the attributes may clash which is why extensions have to ensure that the names they choose for configuration are not too generic. ``prefix`` for example is a terrible name, ``fragment_cache_prefix`` on the other hand is a good name as includes the name of the extension (fragment cache). idcCs ||_dS(N(tenvironment(tselfR)((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt__init__FscCs2tj|j�}|jj|j�||_|S(s=Create a copy of this extension bound to another environment.(tobjectRt __class__t__dict__tupdateR)(R*R)R&((s./usr/lib/python2.7/site-packages/jinja2/ext.pytbindIs cCs|S(s�This method is called before the actual lexing and can be used to preprocess the source. The `filename` is optional. The return value must be the preprocessed source. ((R*tsourceR#tfilename((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt preprocessPscCs|S(s�It's passed a :class:`~jinja2.lexer.TokenStream` that can be used to filter tokens returned. This method has to return an iterable of :class:`~jinja2.lexer.Token`\s, but it doesn't have to return a :class:`~jinja2.lexer.TokenStream`. In the `ext` folder of the Jinja2 source distribution there is a file called `inlinegettext.py` which implements a filter that utilizes this method. ((R*tstream((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt filter_streamWs cCs t��dS(sIf any of the :attr:`tags` matched this method is called with the parser as first argument. The token the parser stream is pointing at is the name token that matched. This method has to return one or a list of multiple nodes. N(tNotImplementedError(R*tparser((s./usr/lib/python2.7/site-packages/jinja2/ext.pytparsecscCstj|j|d|�S(s�Return an attribute node for the current extension. This is useful to pass constants on extensions to generated template code. :: self.attr('_my_attribute', lineno=lineno) tlineno(RtExtensionAttributeR!(R*R#R9((s./usr/lib/python2.7/site-packages/jinja2/ext.pytattrkscCsX|dkrg}n|dkr*g}ntj|j|d|�||||d|�S(ssCall a method of the extension. This is a shortcut for :meth:`attr` + :class:`jinja2.nodes.Call`. R9N(tNoneRtCallR;(R*R#targstkwargstdyn_argst dyn_kwargsR9((s./usr/lib/python2.7/site-packages/jinja2/ext.pytcall_methodus N(R RR'tsetttagstpriorityR+R0R<R3R5R8R;RB(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR()s cOs|j|jd�||�S(NR(tcalltresolve(t __contextR>R?((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt_gettext_alias�scst�fd��}|S(Ncs5|j�|�}|jjr-t|�}n||S(N(RFteval_ctxt autoescapeR(RHt__stringt variablesR&(tfunc(s./usr/lib/python2.7/site-packages/jinja2/ext.pyR�s(R(RNR((RNs./usr/lib/python2.7/site-packages/jinja2/ext.pyt_make_new_gettext�scst�fd��}|S(NcsK|jd|�|j�|||�}|jjrCt|�}n||S(Ntnum(t setdefaultRFRJRKR(RHt __singulart__pluralt__numRMR&(RN(s./usr/lib/python2.7/site-packages/jinja2/ext.pyR�s (R(RNR((RNs./usr/lib/python2.7/site-packages/jinja2/ext.pyt_make_new_ngettext�stInternationalizationExtensioncBszeZdZedg�Zd�Zdd�Zdd�Zdd�Z d�Z ed�Zd�Z d �Zd �ZRS(s.This extension adds gettext support to Jinja2.ttransc Cs^tj||�t|jd<|jd|jd|jd|jd|jd|j dt �dS(NRtinstall_gettext_translationstinstall_null_translationstinstall_gettext_callablestuninstall_gettext_translationstextract_translationstnewstyle_gettext(R(R+RItglobalstextendt_installt _install_nullt_install_callablest _uninstallt_extracttFalse(R*R)((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR+�s cCskt|dd�}|dkr*|j}nt|dd�}|dkrT|j}n|j|||�dS(Ntugettextt ungettext(tgetattrR<RRRb(R*ttranslationstnewstyleRR((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR`�scCs|jd�d�|�dS(NcSs|S(N((tx((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt<lambda>�scSs |dkr|fp|fdS(Nii((tstptn((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRl�s(Rb(R*Rj((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRa�scCsb|dk r||j_n|jjrBt|�}t|�}n|jjjd|d|�dS(NRR(R<R)R]RORUR^R/(R*RRRj((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRb�scCs+x$dD]}|jjj|d�qWdS(NRR(sgettextsngettext(R)R^tpopR<(R*Ritkey((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRc�s cCs1t|t�r$|jj|�}nt||�S(N(t isinstanceRR)R8textract_from_ast(R*R1tgettext_functions((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRd�scCs�t|j�j}t}d}d}i}x^|jjjdkr�|r[|jjd�n|jjd�rqPn|jjd�}|j |kr�|j d|j |jdt�n|jjjdkr�t|j�|j�||j <}n t j|j d�||j <}|dkr-t|t j�rot jd d�}|||j <t jt jd d �|�}n|}|j dk}q-q-W|jjd�d} } t}t�}|j|t�\} }| r|j| �|dkrt j| dd�}| ddk}qn|jjjd �r�t}t|j�|jjjdkr�|jjd�}|j |kr�|j d|j |jdt�n||j }|j dk}n|jjd�|j|t�\} } t|j�|j| �n t|j�x3|D]+}||krt j|d�||<qqW|sNd}n|dkrm|j d|�n|j|| ||t|�|o�|�}|j|�|dk r�||gS|SdS(sParse a translatable tag.t block_endtcommatcolonR#s'translatable variable %r defined twice.texctassigntloadt_tranststoreRPisname:pluralizes%unknown variable %r for pluralizationspluralize without variablesN(RR4R9ReR<tcurrentRtexpecttskip_iftvaluetfailRtparse_expressionRtNameRrR=tAssignRCt_parse_blocktTrueR/ttestt _make_nodetboolt set_lineno(R*R7R9tnum_called_numtplural_exprtplural_expr_assignmentRMR#tvartpluraltplural_namesthave_pluralt referencedtsingular_namestsingulartnode((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR8�s� cCsgg}g}xH|jjjdkrV|j|jjjjdd��t|j�q|jjjdkr�t|j�|jjd�j}|j|�|jd|�|jjd�q|jjjdkr8t|j�|jjjd �r�Pn/|jjjd �r(|rPn|j d�n|j d�q|jj r|j d �qq|t|�fS(s1Parse until the next block tag with a given name.tdatat%s%%tvariable_beginR#s%%(%s)stvariable_endtblock_begins name:endtranssname:pluralizes:a translatable section can have only one pluralize sections;control structures in translatable sections are not allowedsunclosed translation block(R4R}RtappendR�treplaceRR~R�R�teosR(R*R7tallow_pluralizeR�tbufR#((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR�5s2" c Cs�|rD|jjrD|jdd�}|rD|jdd�}qDn|dkr�tjdd�}tj|tj|�ggdd�}nHtjdd�} tj| tj|�tj|�|ggdd�}|jjr4x�t|�D]@\} }|r| dkrq�n|j j tj| |��q�Wngtj|�}|r�tj |tjg|j�D]'\} }tjtj| �|�^qe��}ntj|g�S(s/Generates a useful node from the data provided.s%%R�RRzRRPN(R)R]R�R<RR�R=tConstRR?R�tKeywordtMarkSafeIfAutoescapetModtDicttitemstPairtOutput(R*R�R�RMR�tvars_referencedR�RR�RRqR�((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR�Us2 #@N(R RR'RCRDR+R<R`RaRbRctGETTEXT_FUNCTIONSRdR8R�R�(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRV�s ^ tExprStmtExtensioncBs&eZdZedg�Zd�ZRS(ssAdds a `do` tag to Jinja2 that works like the print statement just that it doesn't print the return value. tdocCs1tjdt|j�j�}|j�|_|S(NR9(RtExprStmtRR4R9tparse_tupleR�(R*R7R�((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR8�s(R RR'RCRDR8(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR��stLoopControlExtensioncBs)eZdZeddg�Zd�ZRS(s/Adds break and continue to the template engine.tbreaktcontinuecCsDt|j�}|jdkr1tjd|j�Stjd|j�S(NR�R9(RR4R�RtBreakR9tContinue(R*R7ttoken((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR8�s(R RR'RCRDR8(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR��st WithExtensioncBs&eZdZedg�Zd�ZRS(s*Adds support for a django-like with block.twithcCs�tjdt|j�j�}g}x�|jjjdkr�|jjj}|rd|jjd�n|j�}|jjd�|j �}|j tj||d|��q'W|t|j ddt��|_|S(NR9RuRvRysname:endwithtdrop_needle(sname:endwith(RtScopeRR4R9R}RR~tparse_assign_targetR�R�R�tlisttparse_statementsR�tbody(R*R7R�tassignmentsR9ttargettexpr((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR8�s#(R RR'RCRDR8(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR��stAutoEscapeExtensioncBs&eZdZedg�Zd�ZRS(s&Changes auto escape rules for a scope.RKcCsdtjdt|j�j�}tjd|j��g|_|jddt �|_ tj|g�S(NR9RKsname:endautoescapeR�(sname:endautoescape(RtScopedEvalContextModifierRR4R9R�R�toptionsR�R�R�R�(R*R7R�((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR8�s (R RR'RCRDR8(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR��sccsyxr|jtj�D]^}t|jtj�s|jj|krGqng}xU|jD]J}t|tj�r�t|j t �r�|j|j �qW|jd�qWWx|j D]}|jd�q�W|jdk r�|jd�n|jdk r|jd�n|s/td�|D��}|sZqqZn+t|�dkrN|d}nt|�}|j|jj|fVqWdS(s�Extract localizable strings from the given template node. Per default this function returns matches in babel style that means non string parameters as well as keyword arguments are returned as `None`. This allows Babel to figure out what you really meant if you are using gettext functions that allow keyword arguments for placeholder expansion. If you don't want that behavior set the `babel_style` parameter to `False` which causes only strings to be returned and parameters are always stored in tuples. As a consequence invalid gettext calls (calls without a single string parameter or string parameters after non-string parameters) are skipped. This example explains the behavior: >>> from jinja2 import Environment >>> env = Environment() >>> node = env.parse('{{ (_("foo"), _(), ngettext("foo", "bar", 42)) }}') >>> list(extract_from_ast(node)) [(1, '_', 'foo'), (1, '_', ()), (1, 'ngettext', ('foo', 'bar', None))] >>> list(extract_from_ast(node, babel_style=False)) [(1, '_', ('foo',)), (1, 'ngettext', ('foo', 'bar'))] For every string found this function yields a ``(lineno, function, message)`` tuple, where: * ``lineno`` is the number of the line on which the string was found, * ``function`` is the name of the ``gettext`` function used (if the string was extracted from embedded Python code), and * ``message`` is the string itself (a ``unicode`` object, or a tuple of ``unicode`` objects for functions with multiple string arguments). This extraction function operates on the AST and is because of that unable to extract any comments. For comment support you have to use the babel extraction interface or extract comments yourself. css!|]}|dk r|VqdS(N(R<(t.0Rk((s./usr/lib/python2.7/site-packages/jinja2/ext.pys <genexpr>�siiN(tfind_allRR=RrR�R�R#R>R�R�RR�R<R?R@RAttupletlenR9(R�Rttbabel_styletstringstarg((s./usr/lib/python2.7/site-packages/jinja2/ext.pyRs�s0$ t_CommentFindercBs)eZdZd�Zd�Zd�ZRS(s�Helper class to find comments in a token stream. Can only find comments for gettext calls forwards. Once the comment from line 4 is found, a comment for line 1 will not return a usable value. cCs(||_||_d|_d|_dS(Ni(ttokenstcomment_tagstoffsettlast_lineno(R*R�R�((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR+s cCs�z�x�t|j|j|!�D]m\}}}|dkry|jdd�\}}Wntk rjqnX||jkr�|j�gSqqWgSWd||_XdS(Ntcommenttlinecommenti(scommentR�(treversedR�R�tsplitR<t ValueErrorR�trstrip(R*R�Rt token_typettoken_valuetprefixR�((s./usr/lib/python2.7/site-packages/jinja2/ext.pytfind_backwardss& cCs�|js|j|krgSxMt|j|j�D]5\}\}}}||kr4|j|j|�Sq4W|jt|j��S(N(R�R�t enumerateR�R�R�R�(R*R9tidxttoken_linenoR((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt find_comments s,(R RR'R+R�R�(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyR�s ccs@t�}xN|jdd�jd�D]1}|j�}|sCq%n|jt|��q%Wt|krv|jt�ntd�}||dt�}t |jdt �|jdt�|jdt�|jd t �|jd t�|jdt�|jd�pt|jd �pt||dt�||dt�t||dt�t|�dddt� }||d�r{t|_n|j�j|jdd��} y1|j| �} t|j|j| ���}Wn tk r�}|s��ndSXt||�} x:t | |�D])\}}}|||| j!|�fVqWdS(sBabel extraction method for Jinja templates. .. versionchanged:: 2.3 Basic support for translation comments was added. If `comment_tags` is now set to a list of keywords for extraction, the extractor will try to find the best preceeding comment that begins with one of the keywords. For best results, make sure to not have more than one gettext call in one line of code and the matching comment in the same line or the line before. .. versionchanged:: 2.5.1 The `newstyle_gettext` flag can be set to `True` to enable newstyle gettext calls. .. versionchanged:: 2.7 A `silent` option can now be provided. If set to `False` template syntax errors are propagated instead of being ignored. :param fileobj: the file-like object the messages should be extracted from :param keywords: a list of keywords (i.e. function names) that should be recognized as translation functions :param comment_tags: a list of translator tags to search for and include in the results. :param options: a dictionary of additional options (optional) :return: an iterator over ``(lineno, funcname, message, comments)`` tuples. (comments will be empty currently) t extensionstt,cSs"|j|t|��j�dkS(Nt1tontyesttrue(R�R�syesR�(tgettstrtlower(R�Rqtdefault((s./usr/lib/python2.7/site-packages/jinja2/ext.pytgetboolNstsilenttblock_start_stringtblock_end_stringtvariable_start_stringtvariable_end_stringtcomment_start_stringtcomment_end_stringtline_statement_prefixtline_comment_prefixttrim_blockst lstrip_blockstkeep_trailing_newlinet cache_sizeitauto_reloadR]tencodingsutf-8N("RCR�R�tstriptaddRRVReR�R RRRRRRRRR RR Rt frozensetR]treadtdecodeR8R�tlexR3RR�RsR�(tfileobjtkeywordsR�R�R�t extensionR�R�R)R1R�R�tetfinderR9RNtmessage((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt babel_extract)sN " !"N(Rsgettextsngettext(6R'tjinja2Rtjinja2.defaultsRRRRRRRRR R RRtjinja2.environmentR tjinja2.runtimeRtjinja2.exceptionsRRtjinja2.utilsRRRtjinja2._compatRRRRR�RRR,R(RIRORURVR�R�R�R�R�RsR�Rti18nR�tloopcontrolstwith_RK(((s./usr/lib/python2.7/site-packages/jinja2/ext.pyt<module>s6R" Y �C% O
/home/../lib/python2.7/site-packages/rhn/../jinja2/ext.pyo