/opt/alt/python27/lib/python2.7/site-packages/jinja2
NameSizeModeActions
testsuite/-0755rm
bccache.py123340644editdlrm
bccache.pyc145570644editdlrm
bccache.pyo146050644editdlrm
compiler.py617850644editdlrm
compiler.pyc560400644editdlrm
compiler.pyo565520644editdlrm
constants.py16260644editdlrm
constants.pyc17070644editdlrm
constants.pyo17070644editdlrm
debug.py109800644editdlrm
debug.pyc110910644editdlrm
debug.pyo110190644editdlrm
defaults.py10680644editdlrm
defaults.pyc16700644editdlrm
defaults.pyo16780644editdlrm
environment.py472440644editdlrm
environment.pyc470130644editdlrm
environment.pyo468190644editdlrm
exceptions.py44280644editdlrm
exceptions.pyc65210644editdlrm
exceptions.pyo65510644editdlrm
ext.py250780644editdlrm
ext.pyc248010644editdlrm
ext.pyo247340644editdlrm
filters.py298360644editdlrm
filters.pyc347800644editdlrm
filters.pyo349660644editdlrm
lexer.py283930644editdlrm
lexer.pyc231650644editdlrm
lexer.pyo232260644editdlrm
loaders.py170360644editdlrm
loaders.pyc194990644editdlrm
loaders.pyo195830644editdlrm
meta.py41900644editdlrm
meta.pyc41220644editdlrm
meta.pyo41220644editdlrm
nodes.py288750644editdlrm
nodes.pyc436530644editdlrm
nodes.pyo438390644editdlrm
optimizer.py23020644editdlrm
optimizer.pyc29290644editdlrm
optimizer.pyo29390644editdlrm
parser.py351860644editdlrm
parser.pyc319130644editdlrm
parser.pyo323340644editdlrm
runtime.py195580644editdlrm
runtime.pyc237850644editdlrm
runtime.pyo239840644editdlrm
sandbox.py134450644editdlrm
sandbox.pyc122710644editdlrm
sandbox.pyo122710644editdlrm
tests.py34440644editdlrm
tests.pyc52570644editdlrm
tests.pyo52590644editdlrm
utils.py161650644editdlrm
utils.pyc201650644editdlrm
utils.pyo203070644editdlrm
visitor.py33160644editdlrm
visitor.pyc39160644editdlrm
visitor.pyo39380644editdlrm
_compat.py40420644editdlrm
_compat.pyc64210644editdlrm
_compat.pyo64310644editdlrm
_stringdefs.py4042910644editdlrm
_stringdefs.pyc2086050644editdlrm
_stringdefs.pyo2086050644editdlrm
__init__.py22700644editdlrm
__init__.pyc24450644editdlrm
__init__.pyo24450644editdlrm
Edit: /opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyc (24801B)
Ñò ÈÏRc @södZddklZddklZlZlZlZlZl Z l Z l Z l Z l Z lZlZddklZddklZddklZlZddklZlZlZddklZlZlZlZd"Z d e!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_PREFIXt TRIM_BLOCKStNEWLINE_SEQUENCEtKEEP_TRAILING_NEWLINEt LSTRIP_BLOCKS(t Environment(tconcat(tTemplateAssertionErrortTemplateSyntaxError(tcontextfunctiont import_stringtMarkup(tnexttwith_metaclasst string_typest iteritemst_tgettexttngettexttExtensionRegistrycBseZdZd„ZRS(s)Gives the extension an unique identifier.cCs3ti||||ƒ}|id|i|_|S(Nt.(ttypet__new__t __module__t__name__t identifier(tclstnametbasestdtrv((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyR#s(R Rt__doc__R(((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyR st ExtensioncBsqeZdZeƒZdZd„Zd„Zd d„Z d„Z d„Z d d„Z d 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(t environment(tselfR)((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyt__init__FscCs2ti|iƒ}|ii|iƒ||_|S(s=Create a copy of this extension bound to another environment.(tobjectRt __class__t__dict__tupdateR)(R*R)R&((s;/opt/alt/python27/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;/opt/alt/python27/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;/opt/alt/python27/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;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pytparsecscCsti|i|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;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pytattrkscCs\|djo g}n|djo g}nti|i|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;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyt call_methodus     N(R RR'tsetttagstpriorityR+R0R<R3R5R8R;RB(((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyR()s      cOs|i|idƒ||ŽS(NR(tcalltresolve(t __contextR>R?((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyt_gettext_alias‚scst‡fd†ƒ}|S(Ncs7|iˆ|ƒ}|iiot|ƒ}n||S(N(RFteval_ctxt autoescapeR(RHt__stringt variablesR&(tfunc(s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyRˆs (R(RNR((RNs;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyt_make_new_gettext‡scst‡fd†ƒ}|S(NcsM|id|ƒ|iˆ|||ƒ}|iiot|ƒ}n||S(Ntnum(t setdefaultRFRJRKR(RHt __singulart__pluralt__numRMR&(RN(s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyR’s  (R(RNR((RNs;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyt_make_new_ngettext‘stInternationalizationExtensioncBszeZdZedgƒZd„Zd d„Zd d„Zd d„Z d„Z e d„Z d„Z d „Zd „ZRS( s.This extension adds gettext support to Jinja2.ttransc Cs^ti||ƒt|id<|id|id|id|id|id|i 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;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyR+§s       cCsot|ddƒ}|djo |i}nt|ddƒ}|djo |i}n|i|||ƒdS(Ntugettextt ungettext(tgetattrR<RRRb(R*t translationstnewstyleRR((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyR`³s    cCs|id„d„|ƒdS(NcSs|S(((tx((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyt¾scSs"|djo |fp|fdS(ii((tstptn((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyRl¿s(Rb(R*Rj((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyRa¼scCsf|dj o||i_n|iiot|ƒ}t|ƒ}n|iiid|d|ƒdS(NRR(R<R)R]RORUR^R/(R*RRRj((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyRbÃs   cCs+x$dD]}|iii|dƒqWdS(NRR(sgettextsngettext(R)R^tpopR<(R*Ritkey((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyRcÎscCs3t|tƒo|ii|ƒ}nt||ƒS(N(t isinstanceRR)R8textract_from_ast(R*R1tgettext_functions((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyRdÒsc Csãt|iƒi}t}d}d}h}xl|iiidjoU|o|iidƒn|iidƒoPn|iidƒ}|i |jo$|i d|i |idt ƒn|iiidjo(t|iƒ|i ƒ||i <}n!t i|i dƒ||i <}|djomt|t iƒoAt id dƒ}|||i >> 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*x#|]}|dj o |VqqWdS(N(R<(t.0Rk((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pys ùs iiN(tfind_allRR=RrR•RƒR#R>R¡R€RR›R<R?R@RAttupletlenR9(R•Rtt babel_styletstringstarg((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyRsÀs6$    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(ttokenst comment_tagstoffsett last_lineno(R*RÌRÍ((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyR+ s   c Csªz™xŽt|i|i|!ƒD]s\}}}|djoWy|iddƒ\}}Wntj o qnX||ijo|iƒgSqqWgSWd||_XdS(Ntcommentt linecommenti(scommentRÑ(treversedRÌRÎtsplitR<t ValueErrorRÍtrstrip(R*RÎRt token_typet token_valuetprefixRÐ((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pytfind_backwardss cCsˆ|i p|i|jogSxOt|i|iƒD]7\}\}}}||jo|i|i|ƒSq7W|it|iƒƒS(N(RÍRÏt enumerateRÌRÎRÙRÇ(R*R9tidxt token_linenoR((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyt find_comments s (R RR'R+RÙRÝ(((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyRËs  ccsLtƒ}xP|iddƒidƒD]3}|iƒ}|pq%n|it|ƒƒq%Wt|jo|itƒntd„}||dtƒ}t |idt ƒ|idt ƒ|idt ƒ|id t ƒ|id tƒ|id tƒ|id ƒpt|id ƒpt||dtƒ||dtƒt||dtƒt|ƒdddtƒ }||dƒo t|_n|iƒi|iddƒƒ} y1|i| ƒ} t|i|i| ƒƒƒ} Wn$tj o} |p‚ndSXt| |ƒ} x:t | |ƒD])\}}}|||| i!|ƒ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"|i|t|ƒƒiƒdjS(Nt1tontyesttrue(RáRâRãRä(tgettstrtlower(RÃRqtdefault((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pytgetboolNstsilenttblock_start_stringtblock_end_stringtvariable_start_stringtvariable_end_stringtcomment_start_stringtcomment_end_stringtline_statement_prefixtline_comment_prefixt trim_blockst lstrip_blockstkeep_trailing_newlinet cache_sizeit auto_reloadR]tencodingsutf-8N("RCRåRÓtstriptaddRRVReR†R RRRRRRRRR R R R t frozensetR]treadtdecodeR8R»tlexR3RRËRsRÝ(tfileobjtkeywordsRÍRÃRÞt extensionRéRêR)R1R•RÌtetfinderR9RNtmessage((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyt babel_extract)sR       !"N(Rsgettextsngettext(6R'tjinja2Rtjinja2.defaultsRRRRRRRRR R R R tjinja2.environmentR tjinja2.runtimeRtjinja2.exceptionsRRt jinja2.utilsRRRtjinja2._compatRRRRR«RRR,R(RIRORURVR¬R°R¶RÁR†RsRËRti18nR­t loopcontrolstwith_RK(((s;/opt/alt/python27/lib/python2.7/site-packages/jinja2/ext.pyt s6R" Y ê   C% O