ok
Direktori : /proc/thread-self/root/proc/self/root/usr/lib/python2.7/site-packages/jinja2/ |
Current File : //proc/thread-self/root/proc/self/root/usr/lib/python2.7/site-packages/jinja2/optimizer.pyo |
� ,��Qc @ sI d Z d d l m Z d d l m Z d � Z d e f d � � YZ d S( s[ jinja2.optimizer ~~~~~~~~~~~~~~~~ The jinja optimizer is currently trying to constant fold a few expressions and modify the AST in place so that it should be easier to evaluate it. Because the AST does not contain all the scoping information and the compiler has to find that out, we cannot do all the optimizations we want. For example loop unrolling doesn't work because unrolled loops would have a different scoping. The solution would be a second syntax tree that has the scoping rules stored. :copyright: (c) 2010 by the Jinja Team. :license: BSD. i����( t nodes( t NodeTransformerc C s t | � } | j | � S( s^ The context hint can be used to perform an static optimization based on the context given.( t Optimizert visit( t nodet environmentt optimizer( ( s4 /usr/lib/python2.7/site-packages/jinja2/optimizer.pyt optimize s R c B st e Z d � Z d � Z d � Z e Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z [ RS( c C s | | _ d S( N( R ( t selfR ( ( s4 /usr/lib/python2.7/site-packages/jinja2/optimizer.pyt __init__ s c C s� | j t j � d k r% | j | � Sy | j | j � j � } Wn t j k ra | j | � SX| rt | j } n | j } g } x$ | D] } | j | j | � � q� W| S( s Eliminate dead code.N( t findR t Blockt Nonet generic_visitR t testt as_constt Impossiblet bodyt else_t extendt visit_list( R R t valR t result( ( s4 /usr/lib/python2.7/site-packages/jinja2/optimizer.pyt visit_If# s c C sW | j | � } y, t j j | j � d | j d | j �SWn t j k rR | SXd S( s Do constant folding.t linenoR N( R R t Constt from_untrustedR R R R ( R R ( ( s4 /usr/lib/python2.7/site-packages/jinja2/optimizer.pyt fold6 s ( t __name__t __module__R R R t visit_Addt visit_Subt visit_Mult visit_Divt visit_FloorDivt visit_Powt visit_Modt visit_Andt visit_Ort visit_Post visit_Negt visit_Nott visit_Comparet visit_Getitemt visit_Getattrt visit_Callt visit_Filtert visit_Testt visit_CondExpr( ( ( s4 /usr/lib/python2.7/site-packages/jinja2/optimizer.pyR s NN( t __doc__t jinja2R t jinja2.visitorR R R ( ( ( s4 /usr/lib/python2.7/site-packages/jinja2/optimizer.pyt <module> s