ó
ži‚Nc           @   sæ  d  Z  d d l Ti d e 6d e 6Z i d e 6d e 6d e 6d e 6d	 e	 6d
 e
 6d e 6d e 6d e 6d e 6d e 6Z i
 d e 6d e 6d e 6d e 6d e 6d e 6d e 6d e 6d e 6d e 6Z i d e 6d e 6d e 6d e 6Z  i  Z! e! j" e ƒ e! j" e ƒ e! j" e ƒ e! j" e  ƒ d d d „ Z# d5 d! „ Z$ d" „  Z% d# „  Z& d$ „  Z' d% d& „ Z( d' „  Z) d( „  Z* d) „  Z+ d* „  Z, d+ „  Z- d, „  Z. d- „  Z/ d. e0 f d/ „  ƒ  YZ1 d0 e1 f d1 „  ƒ  YZ2 d2 e1 f d3 „  ƒ  YZ3 d4 S(6   sH  
    ast
    ~~~

    The `ast` module helps Python applications to process trees of the Python
    abstract syntax grammar.  The abstract syntax itself might change with
    each Python release; this module helps to find out programmatically what
    the current grammar looks like and allows modifications of it.

    An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as
    a flag to the `compile()` builtin function or by using the `parse()`
    function from this module.  The result will be a tree of objects whose
    classes all inherit from `ast.AST`.

    A modified abstract syntax tree can be compiled into a Python code object
    using the built-in `compile()` function.

    Additionally various helper functions are provided that make working with
    the trees simpler.  The main intention of the helper functions and this
    module in general is to provide an easy to use interface for libraries
    that work tightly with the python syntax (template engines for example).


    :copyright: Copyright 2008 by Armin Ronacher.
    :license: Python License.
iÿÿÿÿ(   t   *t   andt   ort   +t   -R    t   /s   //t   %s   <<s   >>t   |t   &t   ^s   ==t   >s   >=t   int   iss   is nott   <s   <=s   !=s   not int   ~t   nots	   <unknown>t   execc         C   s   t  |  | | t ƒ S(   s%   Parse an expression into an AST node.(   t   compilet   PyCF_ONLY_AST(   t   exprt   filenamet   mode(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   parseR   s    t    i   c         C   s)   t  | ƒ } | j |  ƒ d j | j ƒ S(   sŒ  
    This function can convert a node tree back into python sourcecode.  This
    is useful for debugging purposes, especially if you're dealing with custom
    asts not generated by python itself.

    It could be that the sourcecode is evaluable when the AST itself is not
    compilable / evaluable.  The reason for this is that the AST contains some
    more data than regular sourcecode does, which is dropped during
    conversion.

    Each level of indentation is replaced with `indent_with`.  Per default this
    parameter is equal to four spaces as suggested by PEP 8, but it might be
    adjusted to match the application's styleguide.
    t    (   t   SourceGeneratort   visitt   joint   result(   t   nodet   indent_witht	   generator(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt	   to_sourceW   s    c            sA   ‡  f d †  ‰  t  |  t ƒ s7 t d |  j j ƒ ‚ n  ˆ  |  ƒ S(   sg   
    A very verbose representation of the node passed.  This is useful for
    debugging purposes.
    c            s|   t  |  t ƒ rB d |  j j d j ‡  f d †  t |  ƒ Dƒ ƒ f St  |  t ƒ rr d d j ‡  f d †  |  Dƒ ƒ St |  ƒ S(   Ns   %s(%s)s   , c         3   s+   |  ]! \ } } d  | ˆ  | ƒ f Vq d S(   s   %s=%sN(    (   t   .0t   at   b(   t   _format(    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pys	   <genexpr>s   s   s   [%s]c         3   s   |  ] } ˆ  | ƒ Vq d  S(   N(    (   R!   t   x(   R$   (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pys	   <genexpr>v   s    (   t
   isinstancet   ASTt	   __class__t   __name__R   t   iter_fieldst   listt   repr(   R   (   R$   (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyR$   p   s    !s   expected AST, got %r(   R&   R'   t	   TypeErrorR(   R)   (   R   (    (   R$   s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   dumpk   s    c      	   C   s^   xW d D]O } | | j  k r | |  j  k r t | | ƒ r t |  | t | | ƒ ƒ q q W|  S(   sˆ   
    Copy the source location hint (`lineno` and `col_offset`) from the
    old to the new node if possible and return the new one.
    t   linenot
   col_offset(   s   linenos
   col_offset(   t   _attributest   hasattrt   setattrt   getattr(   t   new_nodet   old_nodet   attr(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   copy_location}   s
     c            s#   ‡  f d †  ‰  ˆ  |  d d ƒ |  S(   sú  
    Some nodes require a line number and the column offset.  Without that
    information the compiler will abort the compilation.  Because it can be
    a dull task to add appropriate line numbers and column offsets when
    adding new nodes this function can help.  It copies the line number and
    column offset of the parent node to the child nodes without this
    information.

    Unlike `copy_location` this works recursive and won't touch nodes that
    already have a location information.
    c            s—   d |  j  k r6 t |  d ƒ s* | |  _ q6 |  j } n  d |  j  k rl t |  d ƒ s` | |  _ ql |  j } n  x$ t |  ƒ D] } ˆ  | | | ƒ qy Wd  S(   NR/   R0   (   R1   R2   R/   R0   t   iter_child_nodes(   R   R/   R0   t   child(   t   _fix(    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyR;   •   s    i   i    (    (   R   (    (   R;   s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   fix_missing_locations‰   s    i   c         C   sR   xK t  |  f t |  ƒ ƒ D]1 }  d |  j k r t |  d d ƒ | |  _ q q Wd S(   s§   
    Increment the line numbers of all nodes by `n` if they have line number
    attributes.  This is useful to "move code" to a different location in a
    file.
    R/   i    N(   t   zipt   walkR1   R4   R/   (   R   t   n(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   increment_lineno¦   s    c         c   sb   t  |  d ƒ s |  j r d Sx= |  j D]2 } y | t |  | ƒ f VWq( t k
 rY q( Xq( Wd S(   sA   Iterate over all fields of a node, only yielding existing fields.t   _fieldsN(   R2   RA   R4   t   AttributeError(   R   t   field(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyR*   ±   s    c         C   s   t  t |  ƒ ƒ S(   s%   Like `iter_fiels` but returns a dict.(   t   dictR*   (   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt
   get_fields½   s    c         c   sr   xk t  |  ƒ D]] \ } } t | t ƒ r0 | Vq t | t ƒ r x( | D] } t | t ƒ rF | VqF qF Wq q Wd S(   s'   Iterate over all child nodes or a node.N(   R*   R&   R'   R+   (   R   t   nameRC   t   item(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyR9   Â   s    c         C   s   t  t |  ƒ ƒ S(   s+   Like `iter_child_nodes` but returns a list.(   R+   R9   (   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   get_child_nodesÍ   s    c         C   sI   t  |  t ƒ s( t d |  j j ƒ ‚ n  i d t 6d t 6j |  j d ƒ S(   s‘   
    Get the mode for `compile` of a given node.  If the node is not a `mod`
    node (`Expression`, `Module` etc.) a `TypeError` is thrown.
    s   expected mod node, got %rt   evalt   singleR   (   R&   t   modR-   R(   R)   t
   Expressiont   Interactivet   get(   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   get_compile_modeÒ   s    
c         C   sb   t  |  t t t f ƒ s1 t d |  j j ƒ ‚ n  |  j r^ t  |  j d t ƒ r^ |  j d j	 Sd S(   s°   
    Return the docstring for the given node or `None` if no docstring can be
    found.  If the node provided does not accept docstrings a `TypeError`
    will be raised.
    s   %r can't have docstringsi    N(
   R&   t   FunctionDeft   ClassDeft   ModuleR-   R(   R)   t   bodyt   Strt   s(   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   get_docstringß   s    c         c   sT   d d l  m } | |  g ƒ } x. | rO | j ƒ  }  | j t |  ƒ ƒ |  Vq" Wd S(   s¥   
    Iterate over all nodes.  This is useful if you only want to modify nodes in
    place and don't care about the context or the order the nodes are returned.
    iÿÿÿÿ(   t   dequeN(   t   collectionsRW   t   popleftt   extendR9   (   R   RW   t   todo(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyR>   ë   s    	t   NodeVisitorc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sÖ  
    Walks the abstract syntax tree and call visitor functions for every node
    found.  The visitor functions may return values which will be forwarded
    by the `visit` method.

    Per default the visitor functions for the nodes are ``'visit_'`` +
    class name of the node.  So a `TryFinally` node visit function would
    be `visit_TryFinally`.  This behavior can be changed by overriding
    the `get_visitor` function.  If no visitor function exists for a node
    (return value `None`) the `generic_visit` visitor is used instead.

    Don't use the `NodeVisitor` if you want to apply changes to nodes during
    traversing.  For this a special visitor exists (`NodeTransformer`) that
    allows modifications.
    c         C   s    d | j  j } t |  | d ƒ S(   s³   
        Return the visitor function for this node or `None` if no visitor
        exists for this node.  In that case the generic visit function is
        used instead.
        t   visit_N(   R(   R)   R4   t   None(   t   selfR   t   method(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   get_visitor	  s    c         C   s2   |  j  | ƒ } | d k	 r% | | ƒ S|  j | ƒ S(   s   Visit a node.N(   Ra   R^   t   generic_visit(   R_   R   t   f(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyR     s    
c         C   s‚   x{ t  | ƒ D]m \ } } t | t ƒ r[ xO | D]% } t | t ƒ r/ |  j | ƒ q/ q/ Wq t | t ƒ r |  j | ƒ q q Wd S(   s9   Called if no explicit visitor function exists for a node.N(   R*   R&   R+   R'   R   (   R_   R   RC   t   valueRG   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyRb     s    (   R)   t
   __module__t   __doc__Ra   R   Rb   (    (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyR\   ø   s   			t   NodeTransformerc           B   s   e  Z d  Z d „  Z RS(   s  
    Walks the abstract syntax tree and allows modifications of nodes.

    The `NodeTransformer` will walk the AST and use the return value of the
    visitor functions to replace or remove the old node.  If the return
    value of the visitor function is `None` the node will be removed
    from the previous location otherwise it's replaced with the return
    value.  The return value may be the original node in which case no
    replacement takes place.

    Here an example transformer that rewrites all `foo` to `data['foo']`::

        class RewriteName(NodeTransformer):

            def visit_Name(self, node):
                return copy_location(Subscript(
                    value=Name(id='data', ctx=Load()),
                    slice=Index(value=Str(s=node.id)),
                    ctx=node.ctx
                ), node)

    Keep in mind that if the node you're operating on has child nodes
    you must either transform the child nodes yourself or call the generic
    visit function for the node first.

    Nodes that were part of a collection of statements (that applies to
    all statement nodes) may also return a list of nodes rather than just
    a single node.

    Usually you use the transformer like this::

        node = YourTransformer().visit(node)
    c         C   s  xt  | ƒ D]ý \ } } t | | d  ƒ } t | t ƒ r½ g  } xp | D]h } t | t ƒ r¢ |  j | ƒ } | d  k r} qG q¢ t | t ƒ s¢ | j | ƒ qG q¢ n  | j | ƒ qG W| | (q t | t ƒ r |  j | ƒ } | d  k r÷ t	 | | ƒ q
t
 | | | ƒ q q W| S(   N(   R*   R4   R^   R&   R+   R'   R   RZ   t   appendt   delattrR3   (   R_   R   RC   t	   old_valuet
   new_valuesRd   R5   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyRb   G  s(    	
(   R)   Re   Rf   Rb   (    (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyRg   $  s   !R   c           B   sZ  e  Z d  Z d „  Z d „  Z d d „ Z d „  Z d „  Z d „  Z d „  Z	 d	 „  Z
 d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z  d  „  Z! d! „  Z" d" „  Z# d# „  Z$ d$ „  Z% d% „  Z& d& „  Z' e' d' d( ƒ Z( e' d) d* ƒ Z) [' d+ „  Z* d, „  Z+ d- „  Z, d. „  Z- d/ „  Z. d0 „  Z/ d1 „  Z0 d2 „  Z1 d3 „  Z2 d4 „  Z3 d5 „  Z4 d6 „  Z5 e5 d' d( ƒ Z6 e5 d7 d8 ƒ Z7 e5 d) d* ƒ Z8 [5 d9 „  Z9 d: „  Z: d; „  Z; d< „  Z< d= „  Z= d> „  Z> d? „  Z? RS(@   s¶   
    This visitor is able to transform a well formed syntax tree into python
    sourcecode.  For more details have a look at the docstring of the
    `node_to_source` function.
    c         C   s(   g  |  _  | |  _ d |  _ d |  _ d  S(   Ni    (   R   R   t   indentationt	   new_lines(   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   __init__f  s    			c         C   sf   |  j  rR |  j r, |  j j d |  j  ƒ n  |  j j |  j |  j ƒ d |  _  n  |  j j | ƒ d  S(   Ns   
i    (   Rm   R   Rh   R   Rl   (   R_   R%   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   writel  s    		i   c         C   s   t  |  j | ƒ |  _ d  S(   N(   t   maxRm   (   R_   R?   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   newlinet  s    c         C   sI   t  |  _ |  j d 7_ x | D] } |  j | ƒ q W|  j d 8_ d  S(   Ni   (   t   Truet   new_lineRl   R   (   R_   t
   statementst   stmt(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyRS   w  s
    	c         C   sG   |  j  | j  ƒ | j rC |  j ƒ  |  j d ƒ |  j  | j ƒ n  d  S(   Ns   else:(   RS   t   orelseRq   Ro   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   body_or_else~  s
    	
c            s   g  ‰  ‡ ‡  f d †  } d  g t | j ƒ t | j ƒ } xd t | j | | j ƒ D]I \ } } | ƒ  ˆ j | ƒ | d  k	 rU ˆ j d ƒ ˆ j | ƒ qU qU W| j d  k	 rÏ | ƒ  ˆ j d | j ƒ n  | j d  k	 rü | ƒ  ˆ j d | j ƒ n  d  S(   Nc              s'   ˆ r ˆ  j  d ƒ n ˆ j t ƒ d  S(   Ns   , (   Ro   Rh   Rr   (    (   R_   t
   want_comma(    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   write_comma‡  s    t   =R    s   **(	   R^   t   lent   argst   defaultsR=   R   Ro   t   varargt   kwarg(   R_   R   Ry   t   paddingt   argt   default(    (   Rx   R_   s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt	   signature…  s    #&c         C   s<   x5 | j  D]* } |  j ƒ  |  j d ƒ |  j | ƒ q
 Wd  S(   Nt   @(   t   decorator_listRq   Ro   R   (   R_   R   t	   decorator(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt
   decorators›  s    
c         C   sn   |  j  ƒ  x@ t | j ƒ D]/ \ } } | r< |  j d ƒ n  |  j | ƒ q W|  j d ƒ |  j | j ƒ d  S(   Ns   , s    = (   Rq   t	   enumeratet   targetsRo   R   Rd   (   R_   R   t   idxt   target(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Assign£  s    
c         C   sL   |  j  ƒ  |  j | j ƒ |  j t t | j ƒ d ƒ |  j | j ƒ d  S(   NRz   (   Rq   R   R‹   Ro   t   BINOP_SYMBOLSt   typet   opRd   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_AugAssign¬  s    
c         C   sr   |  j  ƒ  |  j d d | j | j f ƒ x@ t | j ƒ D]/ \ } } | r] |  j d ƒ n  |  j | ƒ q; Wd  S(   Ns   from %s%s import t   .s   , (   Rq   Ro   t   levelt   moduleRˆ   t   names(   R_   R   RŠ   RG   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_ImportFrom²  s    
!c         C   s<   |  j  ƒ  x+ | j D]  } |  j d ƒ |  j | ƒ q Wd  S(   Ns   import (   Rq   R”   Ro   R   (   R_   R   RG   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Importº  s    
c         C   s   |  j  ƒ  |  j | ƒ d  S(   N(   Rq   Rb   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt
   visit_ExprÀ  s    
c         C   sl   |  j  d d ƒ |  j | ƒ |  j  ƒ  |  j d | j ƒ |  j | j ƒ |  j d ƒ |  j | j ƒ d  S(   NR?   i   s   def %s(s   ):(   Rq   R‡   Ro   RF   Rƒ   R|   RS   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_FunctionDefÄ  s    
c            se  g  ‰  ‡ ‡  f d †  } ˆ j  d d ƒ ˆ j | ƒ ˆ j  ƒ  ˆ j d | j ƒ x% | j D] } | ƒ  ˆ j | ƒ q] Wt | d ƒ r8x< | j D]1 } | ƒ  ˆ j | j d ƒ ˆ j | j	 ƒ q” W| j
 d  k	 rÿ | ƒ  ˆ j d ƒ ˆ j | j
 ƒ n  | j d  k	 r8| ƒ  ˆ j d ƒ ˆ j | j ƒ q8n  ˆ j ˆ  rJd	 pMd
 ƒ ˆ j | j ƒ d  S(   Nc              s4   ˆ r ˆ  j  d ƒ n ˆ j t ƒ ˆ  j  d ƒ d  S(   Ns   , t   ((   Ro   Rh   Rr   (    (   R_   t	   have_args(    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   paren_or_commaÏ  s    R?   i   s   class %st   keywordsRz   R    s   **s   ):t   :(   Rq   R‡   Ro   RF   t   basesR   R2   Rœ   R   Rd   t   starargsR^   t   kwargsRS   (   R_   R   R›   t   baset   keyword(    (   Rš   R_   s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_ClassDefÍ  s0    
c         C   sù   |  j  ƒ  |  j d ƒ |  j | j ƒ |  j d ƒ |  j | j ƒ x® t rô | j } t | ƒ d k rÌ t | d t	 ƒ rÌ | d } |  j  ƒ  |  j d ƒ |  j | j ƒ |  j d ƒ |  j | j ƒ qG |  j  ƒ  |  j d ƒ |  j | ƒ PqG Wd  S(   Ns   if R   i   i    s   elif s   else:(
   Rq   Ro   R   t   testRS   Rr   Rv   R{   R&   t   If(   R_   R   t   else_(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Ifï  s$    
		%


c         C   sb   |  j  ƒ  |  j d ƒ |  j | j ƒ |  j d ƒ |  j | j ƒ |  j d ƒ |  j | ƒ d  S(   Ns   for s    in R   (   Rq   Ro   R   R‹   t   iterRw   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt	   visit_For  s    
c         C   sE   |  j  ƒ  |  j d ƒ |  j | j ƒ |  j d ƒ |  j | ƒ d  S(   Ns   while R   (   Rq   Ro   R   R¤   Rw   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_While  s
    
c         C   sw   |  j  ƒ  |  j d ƒ |  j | j ƒ | j d  k	 rV |  j d ƒ |  j | j ƒ n  |  j d ƒ |  j | j ƒ d  S(   Ns   with s    as R   (   Rq   Ro   R   t   context_exprt   optional_varsR^   RS   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt
   visit_With  s    
c         C   s   |  j  ƒ  |  j d ƒ d  S(   Nt   pass(   Rq   Ro   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt
   visit_Pass  s    
c         C   s¬   |  j  ƒ  |  j d ƒ t } | j d  k	 rR |  j d ƒ |  j | j ƒ t } n  x: | j D]/ } | rx |  j d ƒ n  |  j | ƒ t } q\ W| j s¨ |  j d ƒ n  d  S(   Ns   print s    >> s   , t   ,(	   Rq   Ro   t   Falset   destR^   R   Rr   t   valuest   nl(   R_   R   Rx   Rd   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Print"  s    
	
	c         C   s[   |  j  ƒ  |  j d ƒ x= t | ƒ D]/ \ } } | rF |  j d ƒ n  |  j | ƒ q$ Wd  S(   Ns   del s   , (   Rq   Ro   Rˆ   R   (   R_   R   RŠ   R‹   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Delete3  s    
c         C   sL   |  j  ƒ  |  j d ƒ |  j | j ƒ x | j D] } |  j | ƒ q1 Wd  S(   Ns   try:(   Rq   Ro   RS   t   handlersR   (   R_   R   t   handler(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_TryExcept;  s
    
c         C   sR   |  j  ƒ  |  j d ƒ |  j | j ƒ |  j  ƒ  |  j d ƒ |  j | j ƒ d  S(   Ns   try:s   finally:(   Rq   Ro   RS   t	   finalbody(   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_TryFinallyB  s    

c         C   s+   |  j  ƒ  |  j d d j | j ƒ ƒ d  S(   Ns   global s   , (   Rq   Ro   R   R”   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_GlobalJ  s    
c         C   s+   |  j  ƒ  |  j d d j | j ƒ ƒ d  S(   Ns	   nonlocal s   , (   Rq   Ro   R   R”   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_NonlocalN  s    
c         C   s+   |  j  ƒ  |  j d ƒ |  j | j ƒ d  S(   Ns   return (   Rq   Ro   R   Rd   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_ReturnR  s    
c         C   s   |  j  ƒ  |  j d ƒ d  S(   Nt   break(   Rq   Ro   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_BreakW  s    
c         C   s   |  j  ƒ  |  j d ƒ d  S(   Nt   continue(   Rq   Ro   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Continue[  s    
c         C   s  |  j  ƒ  |  j d ƒ t | d ƒ r„ | j d  k	 r„ |  j d ƒ |  j | j ƒ | j d  k	 r|  j d ƒ |  j | j ƒ qn t | d ƒ r| j d  k	 r|  j | j ƒ | j d  k	 rá |  j d ƒ |  j | j ƒ n  | j	 d  k	 r|  j d ƒ |  j | j	 ƒ qn  d  S(   Nt   raiset   excR   s    from RŽ   s   , (
   Rq   Ro   R2   RÄ   R^   R   t   causeRŽ   t   instt   tback(   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Raise_  s     
c         C   s(   |  j  | j ƒ |  j d | j ƒ d  S(   NR‘   (   R   Rd   Ro   R7   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Attributet  s    c            s  g  ‰  ‡ ‡  f d †  } ˆ j  | j ƒ ˆ j d ƒ x% | j D] } | ƒ  ˆ j  | ƒ q? Wx< | j D]1 } | ƒ  ˆ j | j d ƒ ˆ j  | j ƒ qg W| j d  k	 rÒ | ƒ  ˆ j d ƒ ˆ j  | j ƒ n  | j	 d  k	 r| ƒ  ˆ j d ƒ ˆ j  | j	 ƒ n  ˆ j d ƒ d  S(   Nc              s'   ˆ r ˆ  j  d ƒ n ˆ j t ƒ d  S(   Ns   , (   Ro   Rh   Rr   (    (   R_   Rx   (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyRy   z  s    R™   Rz   R    s   **t   )(
   R   t   funcRo   R|   Rœ   R   Rd   RŸ   R^   R    (   R_   R   Ry   R   R¢   (    (   Rx   R_   s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt
   visit_Callx  s(    c         C   s   |  j  | j ƒ d  S(   N(   Ro   t   id(   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt
   visit_Name“  s    c         C   s   |  j  t | j ƒ ƒ d  S(   N(   Ro   R,   RU   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt	   visit_Str–  s    c         C   s   |  j  t | j ƒ ƒ d  S(   N(   Ro   R,   RU   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Bytes™  s    c         C   s   |  j  t | j ƒ ƒ d  S(   N(   Ro   R,   R?   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt	   visit_Numœ  s    c         C   ss   |  j  d ƒ d } x@ t | j ƒ D]/ \ } } | rE |  j  d ƒ n  |  j | ƒ q# W|  j  | rh d pk d ƒ d  S(   NR™   iÿÿÿÿs   , RÊ   s   ,)(   Ro   Rˆ   t   eltsR   (   R_   R   RŠ   RG   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_TupleŸ  s    c            s   ‡  ‡ f d †  } | S(   Nc            sa   |  j  ˆ ƒ x@ t | j ƒ D]/ \ } } | r? |  j  d ƒ n  |  j | ƒ q W|  j  ˆ  ƒ d  S(   Ns   , (   Ro   Rˆ   RÒ   R   (   R_   R   RŠ   RG   (   t   rightt   left(    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyR   ©  s    (    (   RÕ   RÔ   R   (    (   RÔ   RÕ   s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   sequence_visit¨  s    t   [t   ]t   {t   }c         C   s   |  j  d ƒ xl t t | j | j ƒ ƒ D]O \ } \ } } | rQ |  j  d ƒ n  |  j | ƒ |  j  d ƒ |  j | ƒ q) W|  j  d ƒ d  S(   NRÙ   s   , s   : RÚ   (   Ro   Rˆ   R=   t   keysR³   R   (   R_   R   RŠ   t   keyRd   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt
   visit_Dict¶  s    .c         C   s\   |  j  d ƒ |  j | j ƒ |  j  d t t | j ƒ ƒ |  j | j ƒ |  j  d ƒ d  S(   NR™   s    %s RÊ   (   Ro   R   RÕ   R   RŽ   R   RÔ   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_BinOpÀ  s
    c         C   sr   |  j  d ƒ xQ t | j ƒ D]@ \ } } | rP |  j  d t t | j ƒ ƒ n  |  j | ƒ q W|  j  d ƒ d  S(   NR™   s    %s RÊ   (   Ro   Rˆ   R³   t   BOOLOP_SYMBOLSRŽ   R   R   (   R_   R   RŠ   Rd   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_BoolOpÇ  s    !c         C   s|   |  j  d ƒ |  j | j ƒ xK t | j | j ƒ D]4 \ } } |  j  d t t | ƒ ƒ |  j | ƒ q3 W|  j  d ƒ d  S(   NR™   s    %s RÊ   (   Ro   R   RÕ   R=   t   opst   comparatorst   CMPOP_SYMBOLSRŽ   (   R_   R   R   RÔ   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_CompareÏ  s    "c         C   sj   |  j  d ƒ t t | j ƒ } |  j  | ƒ | d k rI |  j  d ƒ n  |  j | j ƒ |  j  d ƒ d  S(   NR™   R   R   RÊ   (   Ro   t   UNARYOP_SYMBOLSRŽ   R   R   t   operand(   R_   R   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_UnaryOp×  s    c         C   s>   |  j  | j ƒ |  j d ƒ |  j  | j ƒ |  j d ƒ d  S(   NR×   RØ   (   R   Rd   Ro   t   slice(   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Subscriptà  s    c         C   s«   | j  d  k	 r" |  j | j  ƒ n  |  j d ƒ | j d  k	 rQ |  j | j ƒ n  | j d  k	 r§ |  j d ƒ t | j t ƒ oŽ | j j d k s§ |  j | j ƒ q§ n  d  S(   NR   R^   (	   t   lowerR^   R   Ro   t   uppert   stepR&   t   NameRÍ   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Sliceæ  s    $c         C   sA   x: | j  D]/ \ } } | r, |  j d ƒ n  |  j | ƒ q
 Wd  S(   Ns   , (   t   dimsRo   R   (   R_   R   RŠ   RG   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_ExtSliceñ  s    c         C   s!   |  j  d ƒ |  j | j ƒ d  S(   Ns   yield (   Ro   R   Rd   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Yield÷  s    c         C   s>   |  j  d ƒ |  j | j ƒ |  j  d ƒ |  j | j ƒ d  S(   Ns   lambda s   : (   Ro   Rƒ   R|   R   RS   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Lambdaû  s    c         C   s   |  j  d ƒ d  S(   Nt   Ellipsis(   Ro   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Ellipsis  s    c            s   ‡  ‡ f d †  } | S(   Nc            sO   |  j  ˆ ƒ |  j | j ƒ x | j D] } |  j | ƒ q' W|  j  ˆ  ƒ d  S(   N(   Ro   R   t   eltt
   generators(   R_   R   t   comprehension(   RÔ   RÕ   (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyR     s
    (    (   RÕ   RÔ   R   (    (   RÔ   RÕ   s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   generator_visit  s    R™   RÊ   c         C   sl   |  j  d ƒ |  j | j ƒ |  j  d ƒ |  j | j ƒ x | j D] } |  j | ƒ qD W|  j  d ƒ d  S(   NRÙ   s   : RÚ   (   Ro   R   RÜ   Rd   Rö   (   R_   R   R÷   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_DictComp  s    c         C   sN   |  j  | j ƒ |  j d ƒ |  j  | j ƒ |  j d ƒ |  j  | j ƒ d  S(   Ns    if s    else (   R   RS   Ro   R¤   Rv   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_IfExp  s
    c         C   s!   |  j  d ƒ |  j | j ƒ d  S(   NR    (   Ro   R   Rd   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_Starred"  s    c         C   s.   |  j  d ƒ |  j | j ƒ |  j  d ƒ d  S(   Nt   `(   Ro   R   Rd   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt
   visit_Repr&  s    c         C   s:   |  j  | j ƒ | j d  k	 r6 |  j  d | j ƒ n  d  S(   Ns    as (   Ro   RF   t   asnameR^   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_alias.  s    c         C   sx   |  j  d ƒ |  j | j ƒ |  j  d ƒ |  j | j ƒ | j rt x. | j D]  } |  j  d ƒ |  j | ƒ qM Wn  d  S(   Ns    for s    in s    if (   Ro   R   R‹   R¨   t   ifs(   R_   R   t   if_(    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_comprehension3  s    	c         C   s–   |  j  ƒ  |  j d ƒ | j d  k	 ru |  j d ƒ |  j | j ƒ | j d  k	 ru |  j d ƒ |  j | j ƒ qu n  |  j d ƒ |  j | j ƒ d  S(   Nt   exceptR   s    as R   (   Rq   Ro   RŽ   R^   R   RF   RS   (   R_   R   (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   visit_excepthandler=  s    
(@   R)   Re   Rf   Rn   Ro   Rq   RS   Rw   Rƒ   R‡   RŒ   R   R•   R–   R—   R˜   R£   R§   R©   Rª   R­   R¯   Rµ   R¶   R¹   R»   R¼   R½   R¾   RÀ   RÂ   RÈ   RÉ   RÌ   RÎ   RÏ   RÐ   RÑ   RÓ   RÖ   t
   visit_Listt	   visit_SetRÝ   RÞ   Rà   Rä   Rç   Ré   Rî   Rð   Rñ   Rò   Rô   Rø   t   visit_ListCompt   visit_GeneratorExpt   visit_SetCompRù   Rú   Rû   Rý   Rÿ   R  R  (    (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyR   _  s€   															"					
																				
	
																				
Ns       (4   Rf   t   _astt   Andt   OrRß   t   Addt   Subt   Multt   Divt   FloorDivt   Modt   LShiftt   RShiftt   BitOrt   BitAndt   BitXorR   t   Eqt   Gtt   GtEt   Int   Ist   IsNott   Ltt   LtEt   NotEqt   NotInRã   t   Invertt   Nott   UAddt   USubRå   t   ALL_SYMBOLSt   updateR   R    R.   R8   R<   R@   R*   RE   R9   RH   RO   RV   R>   t   objectR\   Rg   R   (    (    (    s2   /usr/lib/python2.7/dist-packages/mako/_ast_util.pyt   <module>    sj   




										,;