
[c           @@ s  d  d l  m Z m Z d  d l Z d  d l Z d d l m Z d d l m Z d d l m Z d d l m	 Z	 d d l m
 Z
 d d	 l m Z d d
 l m Z d  d l Z e j d e  e j d  d k r e e e e f Z n e e e e e f Z d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ i d d 6d d 6d d 6d d  6d! d" 6d# d$ 6d% d& 6d' d( 6d) d* 6d+ d, 6d- d. 6d/ d0 6d1 d2 6d3 d4 6d5 d6 6d7 d8 6d9 d: 6d; d< 6d= d> 6j Z  i d? d@ 6dA dB 6dC d: 6dD d& 6j Z! dE e f dF     YZ" dG e f dH     YZ# dI   Z$ dJ e f dK     YZ% dL   Z& dM   Z' dN e f dO     YZ( e) dP k rd  d l* Z* e* j+   n  d S(Q   i    (   t   absolute_importt   print_functionNi   (   t	   TypeSlots(   t   Builtin(   t   Nodes(   t	   ExprNodes(   t   Errors(   t
   DebugFlags(   t   Futuret
   _PRINTABLEi   t   TreeVisitorc           B@ s   e  Z d  Z d   Z d   Z d   Z d   Z e j d    Z	 d   Z
 e j d    Z e j d    Z d d	  Z e j e j d
 e  d     Z RS(   s  
    Base class for writing visitors for a Cython tree, contains utilities for
    recursing such trees using visitors. Each node is
    expected to have a child_attrs iterable containing the names of attributes
    containing child nodes or lists of child nodes. Lists are not considered
    part of the tree structure (i.e. contained nodes are considered direct
    children of the parent node).

    visit_children visits each of the children of a given node (see the visit_children
    documentation). When recursing the tree using visit_children, an attribute
    access_path is maintained which gives information about the current location
    in the tree as a stack of tuples: (parent_node, attrname, index), representing
    the node, attribute and optional list index that was taken in each step in the path to
    the current node.

    Example:

    >>> class SampleNode(object):
    ...     child_attrs = ["head", "body"]
    ...     def __init__(self, value, head=None, body=None):
    ...         self.value = value
    ...         self.head = head
    ...         self.body = body
    ...     def __repr__(self): return "SampleNode(%s)" % self.value
    ...
    >>> tree = SampleNode(0, SampleNode(1), [SampleNode(2), SampleNode(3)])
    >>> class MyVisitor(TreeVisitor):
    ...     def visit_SampleNode(self, node):
    ...         print("in %s %s" % (node.value, self.access_path))
    ...         self.visitchildren(node)
    ...         print("out %s" % node.value)
    ...
    >>> MyVisitor().visit(tree)
    in 0 []
    in 1 [(SampleNode(0), 'head', None)]
    out 1
    in 2 [(SampleNode(0), 'body', 0)]
    out 2
    in 3 [(SampleNode(0), 'body', 1)]
    out 3
    out 0
    c         C@ s)   t  t |   j   i  |  _ g  |  _ d  S(   N(   t   superR
   t   __init__t   dispatch_tablet   access_path(   t   self(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR   L   s    	c   
      C@ s  t  | j p g   d d d d d g } g  } t | d d   } | r | d } | r} d d  l } | j j | j    } n  | j d | | d	 | d
 f  n  t	 |  } x | D] } | | k r q n  | j
 d  s | j d  r q n  y t | |  }	 Wn t k
 rq n X|	 d  k s |	 d k r9q nC t |	 t   r[d t |	  }	 n! t |	 t  spq n t |	  }	 | j d | |	 f  q Wd | j j d j |  f S(   Nu   child_attrsu   posu   gil_messageu   cpp_messageu   subexprst   posi    u   %s:%s:%si   i   t   _u   [...]/%du   %s = %su   %s(%s)u   ,
    (   t   listt   child_attrst   getattrt   Nonet   os.patht   patht   basenamet   get_descriptiont   appendt   dirt
   startswitht   endswitht   AttributeErrort
   isinstancet   lenR	   t   reprt	   __class__t   __name__t   join(
   R   t   nodet   ignoredt   valuesR   t   sourcet   ost   attribute_namest   attrt   value(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt	   dump_nodeQ   s:    
%c   
      C@ s   d d  l  } | } g  } x t | d  r | j } | j j d  } t | t j  r | j } | j	 } | j
 j | j  | j f }	 | j | | |	 f  | } n  | j } q W| | f S(   Ni    t   tb_frameu   self(   R   t   hasattrR.   t   f_localst   getR   R   t   Nodet   f_codet   co_nameR   R   t   co_filenamet   f_linenoR   t   tb_next(
   R   t
   stacktraceR)   t   last_tracebackt   nodest   frameR%   t   codet   method_nameR   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   _find_node_pathq   s    				c         C@ s7  d g } x~ |  j  D]s \ } } } t | |  } | d  k rF d } n | | } d | } | j d | j j | | |  j |  f  q W|  j t j	   d  \ } }	 | }
 xK |	 D]C \ } } } | }
 | j d | d | d | |  j |  f  q Wt
 j t |
 d d   |  j j d	 j |  | |   d  S(
   Nt    u   [%d]u   %s.%s%s = %si   u   File '%s', line %d, in %s: %si    i   R   u   
(   R   R   R   R   R"   R#   R-   R>   t   syst   exc_infoR   t   CompilerCrashR$   (   R   t   childt   et   tracet   parentt	   attributet   indexR%   R8   t   called_nodest	   last_nodeR=   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   _raise_compiler_error   s&    		

		)c         C@ s   t  |  } d } t j |  } x7 | D]/ } t |  | | j d   } | d  k	 r( | Sq( Wt t  |   |  |  j r t |  j  t |  j d d j  t |  j d d j	  n  t
 d |  | f   d  S(   Ns   visit_%sii    s%   Visitor %r does not accept object: %s(   t   typet   inspectt   getmroR   R#   R   t   printR   R   t   __dict__t   RuntimeError(   R   t   objt   clst   patternt   mrot   mro_clst   handler_method(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   find_handler   s    	c         C@ s   |  j  |  S(   N(   t   _visit(   R   RR   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit   s    c         C@ s   y[ y |  j  t |  } Wn3 t k
 rO |  j |  } | |  j  t |  <n X| |  SWn^ t j k
 rt   nH t j k
 r   n2 t k
 r } t j	 r   n  |  j
 | |  n Xd  S(   N(   R   RL   t   KeyErrorRX   R   t   CompileErrort
   AbortErrort	   ExceptionR   t   debug_no_exception_interceptRK   (   R   RR   RW   RD   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyRY      s    	c         C@ s9   |  j  j | | | f  |  j |  } |  j  j   | S(   N(   R   R   RY   t   pop(   R   RC   RF   t   attrnamet   idxt   result(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   _visitchild   s    c         C@ s   |  j  | |  S(   N(   t   _visitchildren(   R   RF   t   attrs(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visitchildren   s    Rb   c   	   	   C@ s   | d k r d Si  } x | j D] } | d k	 rD | | k rD q  n  t | |  } | d k	 r  t |  t k r g  t |  D]$ \ } } |  j | | | |  ^ q~ } n> |  j | | | d  } t | t  s t d | | f   | | | <q  q  W| S(   sf  
        Visits the children of the given parent. If parent is None, returns
        immediately (returning None).

        The return value is a dictionary giving the results for each
        child (mapping the attribute name to either the return value
        or a list of return values (in the case of multiple children
        in an attribute)).
        s!   Cannot insert list here: %s in %rN(	   R   R   R   RL   R   t	   enumerateRd   R   t   AssertionError(	   R   RF   Rf   Rc   R+   RC   Rb   t   xt   childretval(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyRe      s      :&N(   R#   t
   __module__t   __doc__R   R-   R>   RK   t   cythont   finalRX   RZ   RY   Rd   R   Rg   t   localst   intRe   (    (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR
   !   s   *		 			t   VisitorTransformc           B@ sh   e  Z d  Z d d d  Z e j d    Z e j d d   Z e j d    Z	 d   Z
 d   Z RS(   s  
    A tree transform is a base class for visitors that wants to do stream
    processing of the structure (rather than attributes etc.) of a tree.

    It implements __call__ to simply visit the argument node.

    It requires the visitor methods to return the nodes which should take
    the place of the visited node in the result tree (which can be the same
    or one or more replacement). Specifically, if the return value from
    a visitor method is:

    - [] or None; the visited node will be removed (set to None if an attribute and
    removed if in a list)
    - A single node; the visited node will be replaced by the returned node.
    - A list of nodes; the visited nodes will be replaced by all the nodes in the
    list. This will only work if the node was already a member of a list; if it
    was not, an exception will be raised. (Typically you want to ensure that you
    are within a StatListNode or similar before doing this.)
    c         C@ sF   | d  k	 r6 |  j | d  k r' | j n | |  } n  |  j | |  S(   N(   R   t   _select_attrsR   t   _process_children(   R   RF   Rf   t   exclude(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyRg      s    *c         C@ s#   g  | D] } | | k r | ^ q S(   N(    (   R   Rf   Ru   t   name(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyRs      s    c         C@ sg   |  j  | |  } xN | j   D]@ \ } } t |  t k rO |  j |  } n  t | | |  q W| S(   N(   Re   t   itemsRL   R   t   _flatten_listt   setattr(   R   RF   Rf   Rc   R+   t   newnode(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyRt     s    c         C@ sY   g  } xL | D]D } | d  k	 r t |  t k rA | j |  qQ | j |  q q W| S(   N(   R   RL   R   t   extendR   (   R   t	   orig_listt   newlistRj   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyRx     s    c         C@ s   |  j  |  | S(   N(   Rt   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   recurse_to_children  s    c         C@ s   |  j  |  S(   N(   RY   (   R   t   root(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   __call__  s    N(   R#   Rl   Rm   R   Rg   Rn   Ro   Rs   Rt   Rx   R~   R   (    (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyRr      s   		t   CythonTransformc           B@ s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s   
    Certain common conventions and utilities for Cython transforms.

     - Sets up the context of the pipeline in self.context
     - Tracks directives in effect in self.current_directives
    c         C@ s    t  t |   j   | |  _ d  S(   N(   R   R   R   t   context(   R   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR   &  s    c         C@ sG   d d l  m } t | | j  r1 | j |  _ n  t t |   j |  S(   Ni   (   t
   ModuleNode(   R?   R   R   t
   directivest   current_directivesR   R   R   (   R   R%   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR   *  s    c         C@ s/   |  j  } | j |  _  |  j |  | |  _  | S(   N(   R   R   Rt   (   R   R%   t   old(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_CompilerDirectivesNode0  s
    		c         C@ s   |  j  |  | S(   N(   Rt   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt
   visit_Node7  s    (   R#   Rl   Rm   R   R   R   R   (    (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s
   			t   ScopeTrackingTransformc           B@ s>   e  Z d    Z d   Z d   Z d   Z d   Z d   Z RS(   c         C@ s#   d |  _  | |  _ |  j |  | S(   Nt   module(   t
   scope_typet
   scope_nodeRt   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_ModuleNodeA  s    		c         C@ sG   |  j  |  j f } | |  _  | |  _ |  j |  | \ |  _  |  _ | S(   N(   R   R   Rt   (   R   R%   R   t   prev(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_scopeG  s    		c         C@ s   |  j  | d  S(   Nt   cclass(   R   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_CClassDefNodeO  s    c         C@ s   |  j  | d  S(   Nt   pyclass(   R   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_PyClassDefNodeR  s    c         C@ s   |  j  | d  S(   Nt   function(   R   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_FuncDefNodeU  s    c         C@ s   |  j  | d  S(   Nt   struct(   R   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_CStructOrUnionDefNodeX  s    (   R#   Rl   R   R   R   R   R   R   (    (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR   <  s   					t   EnvTransformc           B@ sz   e  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 RS(   s@   
    This transformation keeps a stack of the environments.
    c         C@ s2   g  |  _  |  j | | j  t t |   j |  S(   N(   t	   env_stackt   enter_scopet   scopeR   R   R   (   R   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR   `  s    	c         C@ s   |  j  d d S(   Nii   (   R   (   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   current_enve  s    c         C@ s   |  j  d d S(   Nii    (   R   (   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   current_scope_nodeh  s    c         C@ s   |  j    j   S(   N(   R   t   global_scope(   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR   k  s    c         C@ s   |  j  j | | f  d  S(   N(   R   R   (   R   R%   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR   n  s    c         C@ s   |  j  j   d  S(   N(   R   R`   (   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt
   exit_scopeq  s    c         C@ s.   |  j  | | j  |  j |  |  j   | S(   N(   R   t   local_scopeRt   R   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR   t  s    
c         C@ s   |  j  |  | S(   N(   Rt   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_GeneratorBodyDefNodez  s    c         C@ s.   |  j  | | j  |  j |  |  j   | S(   N(   R   R   Rt   R   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_ClassDefNode~  s    
c         C@ s.   |  j  | | j  |  j |  |  j   | S(   N(   R   R   Rt   R   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s    
c         C@ sG   | j  r6 |  j | | j   |  j |  |  j   n |  j |  | S(   N(   t
   expr_scopeR   Rt   R   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_ScopedExprNode  s    	c         C@ s   | j  rw g  | j D] } | d k r | ^ q } |  j | |  |  j | |  j   j  |  j | d  |  j   n |  j |  | S(   Nt   default(   s   default(   R   R   Rt   R   R   t   outer_scopeRg   R   (   R   R%   R+   Rf   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_CArgDeclNode  s    	((   R#   Rl   Rm   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR   \  s   												t   NodeRefCleanupMixinc           B@ s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   ss  
    Clean up references to nodes that were replaced.

    NOTE: this implementation assumes that the replacement is
    done first, before hitting any further references during
    normal tree traversal.  This needs to be arranged by calling
    "self.visitchildren()" at a proper place in the transform
    and by ordering the "child_attrs" of nodes appropriately.
    c         G@ s#   t  t |   j |   i  |  _ d  S(   N(   R   R   R   t   _replacements(   R   t   args(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s    c         C@ sD   | j  } | |  j k r( |  j |  n  |  j j | |  | _  | S(   N(   t   argR   Rg   R1   (   R   R%   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_CloneNode  s
    	c         C@ sh   | j  } | d  k s$ | |  j k r= |  j |  | j  } n  | d  k	 rd |  j j | |  | _  n  | S(   N(   t
   expressionR   R   Rg   R1   (   R   R%   t   expr(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_ResultRefNode  s    	c         C@ s   | |  j  | <| S(   N(   R   (   R   R%   t   replacement(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   replace  s    (   R#   Rl   Rm   R   R   R   R   (    (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s
   					t   __lt__t   <t   __le__s   <=t   __eq__s   ==t   __ne__s   !=t   __ge__s   >=t   __gt__t   >t   __add__t   +t   __and__t   &t   __div__t   /t   __floordiv__s   //t
   __lshift__s   <<t   __mod__t   %t   __mul__t   *t   __or__t   |t   __pow__s   **t
   __rshift__s   >>t   __sub__t   -t   __xor__t   ^t   __contains__t   int   __not__t   nott   __inv__t   ~t   __neg__t   __pos__t   MethodDispatcherTransformc           B@ sz   e  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 RS(   s  
    Base class for transformations that want to intercept on specific
    builtin functions or methods of builtin types, including special
    methods triggered by Python operators.  Must run after declaration
    analysis when entries were assigned.

    Naming pattern for handler methods is as follows:

    * builtin functions: _handle_(general|simple|any)_function_NAME

    * builtin methods: _handle_(general|simple|any)_method_TYPENAME_METHODNAME
    c         C@ s   |  j  |  | j } | j j s& | S| j } t | t j  sE | S| j } | rk t | t j	  rk | S| j
 } |  j | | | |  S(   N(   Rt   R   RL   t   is_pyobjectt   positional_argsR   R   t	   TupleNodet   keyword_argst   DictNodeR   t   _dispatch_to_handler(   R   R%   R   t	   arg_tupleR   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_GeneralCallNode  s    				c         C@ sl   |  j  |  | j } | j j rM | j } t | t j  sA | S| j } n	 | j } |  j	 | | | d   S(   N(   Rt   R   RL   R   R   R   R   R   R   R   R   (   R   R%   R   R   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_SimpleCallNode  s    			c         C@ s'   | j  r |  j |  | S|  j |  S(   N(   t   cascadeRt   t   _visit_binop_node(   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_PrimaryCmpNode  s    	c         C@ s   |  j  |  S(   N(   R   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_BinopNode  s    c      	   C@ s   |  j  |  t | j  } | r | j | j } } | d k rQ | | } } n9 | d k r t j |  j   j   j	 j
 k r d } q n  | j } | j r | j } n d } |  j | d  t | | d  | | g d   } n  | S(   NR   R   t   __truediv__t   object(   Rt   t'   find_special_method_for_binary_operatort   operatort   operand1t   operand2R   t   divisionR   R   R   t   future_directivesRL   t   is_builtin_typeRv   t   _dispatch_to_method_handlerR   t   False(   R   R%   t   special_method_nameR   R   t   obj_typet	   type_name(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s"    !		c      	   C@ s}   |  j  |  t | j  } | ry | j } | j } | j rI | j } n d } |  j | d  t	 | | d  | g d   } n  | S(   NR   (
   Rt   t&   find_special_method_for_unary_operatorR   t   operandRL   R   Rv   R   R   R   (   R   R%   R   R   R   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   visit_UnopNode*  s    			c         C@ sW   | r d p d } t  |  d | | f d   } | d  k rS t  |  d | d   } n  | S(   Nt   generalt   simples   _handle_%s_%ss   _handle_any_%s(   R   R   (   R   t
   match_namet
   has_kwargst	   call_typet   handler(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   _find_handler;  s
    c         C@ s   | j  d } | j } | j rH | j sA t | j j  d k r | SnH | j r | j j r | j j s t | j j j  d k r | Sn | S|  j | | | |  S(   Ni    i   (	   t   cf_statet   rhst   is_namet   entryR    t   cf_assignmentst   is_attributeRR   R   (   R   R%   R   t   arg_listt   kwargst
   assignmentR,   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   _delegate_to_assigned_valueB  s    		"(c         C@ s  | j  rt| j s | S| j } | j pI | |  j   j   j | j  k } | s| j r} | j j r} |  j	 | | | |  S| r| j
 r| j r| j j j r| j j | d j k r|  j | j d d  d t d | j j j d | d | d | d | Sn  | S|  j d	 | j |  } | d  k rH|  j | | j | | |  S| ra| | | | |  S| | | |  Sn| j r}| j } | j j r| j }	 nM | j r| j r| j j } | s| j r| S| j }	 | d
 } n | S|	 j }
 t } |
 j rU|
 t j k rI|	 j  rI| rI| d j j rI|	 j } d  }	 t } q[|
 j } n d } |  j | |	 | | | | | |  S| Sd  S(   Ni    t   self_argt   is_unbound_methodR   R%   R   R  R  s   function_%si   R   (   R   R   t
   is_builtinR   t   builtin_scopet   lookup_hereRv   R   t	   is_singleR  t
   is_cmethodR   t   parent_typeR   RL   R   R   t   TrueR   t   _handle_functionR  RG   R   RR   R   t   as_variableR   R   t	   type_type(   R   R%   R   R  R  R   R  t   function_handlert	   attr_nameR  R   R  R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR   R  s`    				$'					.		c	      	   C@ s   |  j  d | | f |  }	 |	 d  k r | t j k sC | d k r\ |  j  d | |  }	 n  |	 d  k r |  j | | | | | | |  Sn  | d  k	 r | g t |  } n  | r |	 | | | | |  }
 n |	 | | | |  }
 |
 S(   Ns   method_%s_%st   __new__s   slot%s(   R   R   R   t   method_name_to_slott   _handle_methodR   (   R   R  R  R  R   R%   R   R  R  t   method_handlerRc   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s&    c         C@ s   | S(   s   Fallback handler(    (   R   R%   t   function_nameR   R  R  (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR    s    c         C@ s   | S(   s   Fallback handler(    (   R   R%   R   R  R   R  R  R  (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR    s    (   R#   Rl   Rm   R   R   R   R   R   R   R   R  R   R   R  R  (    (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s   									A		t   RecursiveNodeReplacerc           B@ s)   e  Z d  Z d   Z d   Z d   Z RS(   sY   
    Recursively replace all occurrences of a node in a subtree by
    another node.
    c         C@ s*   t  t |   j   | | |  _ |  _ d  S(   N(   R   R  R   t	   orig_nodet   new_node(   R   R  R  (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s    c         C@ s;   | |  j  k r |  j S| j |  j  k r7 |  j | _ n  | S(   N(   R  R  R   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s
    c         C@ s+   |  j  |  | |  j k r# |  j S| Sd  S(   N(   Rt   R  R  (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s    (   R#   Rl   Rm   R   R   R   (    (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR    s   		c         C@ s   t  | |  } | |   d  S(   N(   R  (   t   treet   old_nodeR  t
   replace_in(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   recursively_replace_node  s    t
   NodeFinderc           B@ s    e  Z d  Z d   Z d   Z RS(   s2   
    Find out if a node appears in a subtree.
    c         C@ s)   t  t |   j   | |  _ t |  _ d  S(   N(   R   R   R   R%   R   t   found(   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s    	c         C@ s;   |  j  r n+ | |  j k r' t |  _  n |  j | d   d  S(   N(   R!  R%   R  Re   R   (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s
    	(   R#   Rl   Rm   R   R   (    (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s   	c         C@ s    t  |  } | j |   | j S(   N(   R   RZ   R!  (   R  R%   t   finder(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   tree_contains  s    c         C@ sE   |  \ } } } | d k r. t | | |  n | t | |  | <d S(   sk   Replaces a node. ptr is of the form used on the access path stack
    (parent, attrname, listidx|None)
    N(   R   Ry   R   (   t   ptrR,   RF   Ra   t   listidx(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   replace_node  s    t	   PrintTreec           B@ s_   e  Z d  Z d	 d	 d  Z d   Z d   Z d	 d  Z d   Z d   Z	 d   Z
 d   Z RS(
   s   Prints a representation of the tree to standard output.
    Subclass and override repr_of to provide more information
    about nodes. c         C@ sY   t  j |   d |  _ | d  k	 s. | d  k	 rL | p7 d | p@ d f |  _ n	 d  |  _ d  S(   NR?   i    i   i   i   @(   R
   R   t   _indentR   t   _line_range(   R   t   startt   end(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s
    	c         C@ s   |  j  d 7_  d  S(   Ns     (   R(  (   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   indent   s    c         C@ s   |  j  d  |  _  d  S(   Ni(   R(  (   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   unindent  s    c         C@ s   t  d |  |  j |  | S(   Ns   Parse tree dump at phase '%s'(   RO   RZ   (   R   R  t   phase(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s    c         C@ s2   |  j  |  |  j   |  j |  |  j   | S(   N(   t   _print_nodeR,  Rg   R-  (   R   R%   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s
    

c         C@ s   |  j  |  |  j   | j d } |  j d  k s] |  j d | k oX |  j d k n r t d |  j d |  j | j  f  n  |  j   |  j	 | j  |  j
   |  j
   | S(   Ni   i    s
   %s- %s: %sR   (   R/  R,  R   R)  R   RO   R(  t   repr_ofR   Rg   R-  (   R   R%   t   line(    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR     s    
9)


c         C@ s   | j  d } |  j d  k sF |  j d | k oA |  j d k n r t |  j  d k rd d } n; |  j d \ } } } | d  k	 r d | | f } n | } t d |  j | |  j |  f  n  d  S(   Ni   i    s   (root)is   %s[%d]s
   %s- %s: %s(   R   R)  R   R    R   RO   R(  R0  (   R   R%   R1  Rv   RF   R+   Rb   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR/  "  s    9	c         C@ s9  | d  k r d S| j j } t | t j  rQ | d t | j  | j f 7} n t | t	 j
  rw | d | j 7} n t | t j  r | j } | d t |  7} n | j r1| j } | d j   } d | k r | j d  d } n  d | k r| j d  d } n  | d	 | | d
 | d f 7} n  | Sd  S(   Ns   (none)s   (type=%s, name="%s")s   (name="%s")s	   (type=%s)i    R   is   \s   (pos=(%s:%s:%s))i   i   (   R   R"   R#   R   R   t   NameNodeR!   RL   Rv   R   t   DefNodet   ExprNodeR   R   t   split(   R   R%   Rc   t   tR   R   (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR0  /  s&    #			"N(   R#   Rl   Rm   R   R   R,  R-  R   R   R   R/  R0  (    (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyR'    s   						t   __main__(,   t
   __future__R    R   R@   RM   R?   R   R   R   R   R   R   R   Rn   t   declaret   tuplet   version_infot   bytest   strRq   t   floatR	   t   unicodet   longR   R
   Rr   R   R   R   R   R1   R   R   R   R  R  R   R#  R&  R'  R#   t   doctestt   testmod(    (    (    sg   /home/psgendb/BIRCHDEV/lib-linux-x86_64/python/lib64/python2.7/site-packages/Cython/Compiler/Visitor.pyt   <module>	   sn   < D#			R