
NWc           @@  s0  d  d l  m Z d  d l Z e j d e d e d e d e d e d e d	 e d
 e d e d e d e d e d e d e  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 m Z d d l m Z m Z m Z d d l m Z m Z d d l m Z d d l m Z m Z d d l m Z m Z m Z m Z d d l m  Z  d e f d      YZ! d! e f d"     YZ" d# e f d$     YZ# d% e f d&     YZ$ d' Z% d( Z& d) Z' d* e f d+     YZ( d,   Z) d-   Z* d.   Z+ d/   Z, d0   Z- d1 e e" f d2     YZ. d3 e e" f d4     YZ/ d5 e e" f d6     YZ0 d7 e e" f d8     YZ1 d9 e e" f d:     YZ2 d; e e" f d<     YZ3 d= e f d>     YZ4 d? e f d@     YZ5 dA e f dB     YZ6 dC e f dD     YZ7 dE e f dF     YZ8 dG e f dH     YZ9 dI e e" f dJ     YZ: dK e f dL     YZ; dM e f dN     YZ< dO e f dP     YZ= dQ e f dR     YZ> dS e f dT     YZ? dU e f dV     YZ@ dW e f dX     YZA dY e f dZ     YZB d[ e f d\     YZC d S(]   i    (   t   absolute_importNt
   PyrexTypest   Namingt	   ExprNodest   Nodest   Optionst	   UtilNodest   LetNodet
   LetRefNodet   TreeFragmentt   EncodedStringt   errort   warningt   copyt   _unicodei   (   R   (   R   (   R   (   R   (   R   (   t   Builtin(   t   VisitorTransformt   TreeVisitor(   t   CythonTransformt   EnvTransformt   ScopeTrackingTransform(   R   R   (   R	   (   R
   R   (   R   R   t   CompileErrort   InternalError(   t   UtilityCodet   NameNodeCollectorc           B@  s)   e  Z d  Z d   Z d   Z d   Z RS(   sO   Collect all NameNodes of a (sub-)tree in the ``name_nodes``
    attribute.
    c         C@  s    t  t |   j   g  |  _ d  S(   N(   t   superR   t   __init__t
   name_nodes(   t   self(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR      s    c         C@  s   |  j  j |  d  S(   N(   R   t   append(   R   t   node(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_NameNode#   s    c         C@  s   |  j  | d   d  S(   N(   t   _visitchildrent   None(   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt
   visit_Node&   s    (   t   __name__t
   __module__t   __doc__R   R   R"   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR      s   		t   SkipDeclarationsc           B@  sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s)  
    Variable and function declarations can often have a deep tree structure,
    and yet most transformations don't need to descend to this depth.

    Declaration nodes are removed after AnalyseDeclarationsTransform, so there
    is no need to use this for transformations after that point.
    c         C@  s   | S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CTypeDefNode2   s    c         C@  s   | S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CVarDefNode5   s    c         C@  s   | S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CDeclaratorNode8   s    c         C@  s   | S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CBaseTypeNode;   s    c         C@  s   | S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CEnumDefNode>   s    c         C@  s   | S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CStructOrUnionDefNodeA   s    (	   R#   R$   R%   R'   R(   R)   R*   R+   R,   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR&   *   s   					t   NormalizeTreec           B@  sk   e  Z d  Z d   Z d   Z e d  Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z RS(   s\  
    This transform fixes up a few things after parsing
    in order to make the parse tree more suitable for
    transforms.

    a) After parsing, blocks with only one statement will
    be represented by that statement, not by a StatListNode.
    When doing transforms this is annoying and inconsistent,
    as one cannot in general remove a statement in a consistent
    way and so on. This transform wraps any single statements
    in a StatListNode containing a single statement.

    b) The PassStatNode is a noop and serves no purpose beyond
    plugging such one-statement blocks; i.e., once parsed a
`    "pass" can just as well be represented using an empty
    StatListNode. This means less special cases to worry about
    in subsequent transforms (one always checks to see if a
    StatListNode has no children to see if the block is empty).
    c         C@  s,   t  t |   j |  t |  _ t |  _ d  S(   N(   R   R-   R   t   Falset   is_in_statlistt
   is_in_expr(   R   t   context(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   Y   s    	c         C@  s,   |  j  } t |  _  |  j |  | |  _  | S(   N(   R0   t   Truet   visitchildren(   R   R   t   stacktmp(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ExprNode^   s
    			c         C@  s`   |  j  } | |  _  |  j |  | |  _  |  j  rX |  j rX t j d | j d | g  S| Sd  S(   Nt   post   stats(   R/   R3   R0   R   t   StatListNodeR6   (   R   R   t   is_listcontainerR4   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_StatNodee   s    			c         C@  s#   t  |  _ |  j |  t |  _ | S(   N(   R2   R/   R3   R.   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_StatListNodeo   s    		c         C@  s   |  j  | t  S(   N(   R:   R2   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ParallelAssignmentNodeu   s    c         C@  s   |  j  | t  S(   N(   R:   R2   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR+   x   s    c         C@  s   |  j  | t  S(   N(   R:   R2   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR,   {   s    c         C@  s*   |  j  s" t j d | j d g   Sg  Sd S(   s   Eliminate PassStatNodeR6   R7   N(   R/   R   R8   R6   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_PassStatNode~   s    	c         C@  s*   | j  j r |  j |  S|  j |  Sd S(   s!   Eliminate useless string literalsN(   t   exprt   is_string_literalR=   R:   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ExprStatNode   s    c         C@  s   | S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR)      s    (   R#   R$   R%   R   R5   R.   R:   R;   R<   R+   R,   R=   R@   R)   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR-   D   s   		
						t   PostParseErrorc           B@  s   e  Z RS(    (   R#   R$   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRA      s    sH   Cannot assign default value to fields in cdef classes, structs or unionss0   Invalid buffer defaults specification (see docs)s0   Special attributes must not have a type declaredt	   PostParsec           B@  sq   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 RS(   sf  
    Basic interpretation of the parse tree, as well as validity
    checking that can be done on a very basic level on the parse
    tree (while still not being a problem with the basic syntax,
    as such).

    Specifically:
    - Default values to cdef assignments are turned into single
    assignments following the declaration (everywhere but in class
    bodies, where they raise a compile error)

    - Interpret some node structures into Python runtime values.
    Some nodes take compile-time arguments (currently:
    TemplatedTypeNode[args] and __cythonbufferdefaults__ = {args}),
    which should be interpreted. This happens in a general way
    and other steps should be taken to ensure validity.

    Type arguments cannot be interpreted in this way.

    - For __cythonbufferdefaults__ the arguments are checked for
    validity.

    TemplatedTypeNode has its directives interpreted:
    Any first positional argument goes into the "dtype" attribute,
    any "ndim" keyword argument goes into the "ndim" attribute and
    so on. Also it is checked that the directive combination is valid.
    - __cythonbufferdefaults__ attributes are parsed and put into the
    type information.

    Note: Currently Parsing.py does a lot of interpretation and
    reorganization that can be refactored into this transform
    if a more pure Abstract Syntax Tree is wanted.
    c         C@  s-   t  t |   j |  i |  j d 6|  _ d  S(   Nt   __cythonbufferdefaults__(   R   RB   R   t   handle_bufferdefaultst   specialattribute_handlers(   R   R1   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR      s    c         C@  s   t    } | j | j  | j s@ | j s@ t | j t j  ra t j	 | j j
 d | j } n t j | j j
 d | j } t j | j
 d | j d | j d | j d | j d | d d  | _ |  j |  | S(	   NR>   t   valuet   namet   argst   star_argt   starstar_argt   bodyt   doc(   t   YieldNodeCollectorR3   t   result_exprt   yieldst   awaitst
   isinstanceR   t   YieldExprNodeR   t   ExprStatNodeR6   t   ReturnStatNodet   DefNodeRG   RH   RI   RJ   R!   t   def_node(   R   R   t	   collectorRK   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_LambdaNode   s    	'	c         C@  sP   t  j | j d | j d d  d g  d d  d d  d | j | _ |  j |  | S(   NRG   RL   RH   RI   RJ   RK   (   R   RU   R6   RG   R!   t   loopRV   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_GeneratorExpressionNode   s    c         C@  sL   t  | j t j  s* t | j t   n  | j |  j _ | j |  j _	 d  S(   N(
   RQ   t   defaultR   t   DictNodeRA   R6   t   ERR_BUF_DEFAULTSt
   scope_nodet   buffer_defaults_nodet   buffer_defaults_pos(   R   t   decl(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRD      s    c   	   
   C@  s  y|  j  |  | g } g  } xP| j D]E} | } x t | t j  rV | j } q8 Wt | t j  ra| j d  k	 ra|  j	 d	 k r t |  j
 t j  r |  j j | j  } | r | | k	 r t | j t   n  | |  q) q n  t | j t   n  |  j	 d k } | j t j | j d t j | j d | j d | j d |  d  | _ qan  | j |  q) W| | _ | SWn$ t k
 r} |  j j |  d  SXd  S(
   Nt   cclasst   pyclasst   structt   modulet   lhsRG   t   rhst   first(   s   cclasss   pyclasss   struct(   R3   t   declaratorsRQ   R   t   CPtrDeclaratorNodet   baset   CNameDeclaratorNodeR[   R!   t
   scope_typeR^   t   CClassDefNodeRE   t   getRG   RA   R6   t   ERR_INVALID_SPECIALATTR_TYPEt   ERR_CDEF_INCLASSR   t   SingleAssignmentNodeR   t   NameNodeR1   t   nonfatal_error(	   R   R   R7   t   newdeclsRa   t   declbaset   handlert   first_assignmentt   e(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR(      s<    	
		c         C@  s)   |  j  |  |  j | | j | j g  S(   N(   R3   t   _visit_assignment_nodeRf   Rg   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_SingleAssignmentNode  s    c         C@  s*   |  j  |  |  j | | j | j g  S(   N(   R3   Rz   t   lhs_listRg   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CascadedAssignmentNode  s    c         C@  s  t  g  | D] } | j s" | j r
 d ^ q
  d k  r; | Sg  } t | |  g  } t | |  g  } x | D]| } | d  } | d } t |  d k r t j | j d | d d | } n t j	 | j d | d | } | j
 |  qn Wt |  d k r| d }	 n t j | d j d | }	 | rg  | D] }
 |
 j |
 f ^ q6} t |  x3 | d	 d	 d  D] \ } } t | |	  }	 qoWn  |	 S(
   sg   Flatten parallel assignments into separate single
        assignments or cascaded assignments.
        i   i   iRf   i    Rg   R|   R7   N(   t   sumt   is_sequence_constructorR?   t   flatten_parallel_assignmentst   eliminate_rhs_duplicatest   lenR   Rr   R6   t   CascadedAssignmentNodeR   t   ParallelAssignmentNodet
   expressiont   sort_common_subsequencesR   (   R   R   t	   expr_listR>   t   expr_list_listt	   temp_refst   nodesR|   Rg   t   assign_nodet   tempt   duplicates_and_tempst   _t   temp_ref(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRz     s6    '


 c         C@  sA   x: | j  D]/ } | j r, |  j | |  q
 | j |  q
 W| S(   N(   RH   R   t   _flatten_sequenceR   (   R   t   seqt   resultt   arg(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   ?  s
    	c         C@  s&   |  j  |  |  j | g   | _ | S(   N(   R3   R   RH   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_DelStatNodeG  s    c         C@  s   | j  r t j | j d t j | j j d | j j g d t } t j	 | j d t j
 | j d | j d t j	 | j d | g g | _ n  |  j |  | S(   NRH   RG   t   ignore_nonexistingR7   RK   t   finally_clause(   t   is_except_asR   t   DelStatNodeR6   R   Rs   t   targetRG   R2   R8   t   TryFinallyStatNodeRK   R3   (   R   R   t
   del_target(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ExceptClauseNodeL  s     							(   R#   R$   R%   R   RX   RZ   RD   R(   R{   R}   Rz   R   R   R   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRB      s   !					-			(		c         @  s   t     i        f d     x" |  D] } | d }   |  q. W sV d S  f d    x5  D]- } | j ro t t  | j   | _ qo qo Wx" |  D] }  | d  | d <q Wd S(   s   Replace rhs items by LetRefNodes if they appear more than once.
    Creates a sequence of LetRefNodes that set up the required temps
    and appends them to ref_node_sequence.  The input list is modified
    in-place.
    c         @  s   |  j  s |  j r d  S|   k rW |   k r t |   } |  |  < j |  q n7  j |   |  j r x |  j D] }   |  qw Wn  d  S(   N(   t
   is_literalt   is_nameR   R   t   addR   RH   (   R   t   ref_nodet   item(   t   find_duplicatest   ref_node_sequencet	   ref_nodest
   seen_nodes(    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   h  s    
	iNc         @  s?   |    k r   |  S|  j  r; t t  |  j   |  _ n  |  S(   N(   R   t   listt   mapRH   (   R   (   R   t   substitute_nodes(    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   ~  s
    	(   t   setR   R   R   RH   (   R   R   R   Rg   R   (    (   R   R   R   R   R   sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   `  s    	
	"c         @  s     f d       f d   } x t  |   D] \ } } | d } | } x> t | d d d  D]& } | | |  | d  r^ | } q^ q^ W| | k r+ x, t | | d  D] } |  | d |  | <q W| |  | <q+ q+ Wd S(   s  Sort items/subsequences so that all items and subsequences that
    an item contains appear before the item itself.  This is needed
    because each rhs item must only be evaluated once, so its value
    must be evaluated first and then reused when packing sequences
    that contain it.

    This implies a partial order, and the sort must be stable to
    preserve the original order as much as possible, so we use a
    simple insertion sort (which is very fast for short sequences, the
    normal case in practice).
    c         @  sD   x= |  D]5 } | | k r t  S| j r   | j |  r t  Sq Wt S(   N(   R2   R   RH   R.   (   R   t   xR   (   t   contains(    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    c         @  s   | j  o   | j |   S(   N(   R   RH   (   t   at   b(   R   (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt
   lower_than  s    i   ii    N(   t	   enumeratet   range(   t   itemsR   R6   R   t   keyt   new_post   i(    (   R   sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    
c         C@  sj   g  } |  j  } |  j } |  j } | j } x9 | D]1 } | |  } | j | | d | d |  q1 W| S(   NRF   t   constant_result(   R6   t	   __class__RF   R   (   t   literalt   charsR6   t   stypet   svalt	   sval_typet   chart   cval(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt#   unpack_string_to_character_literals  s    				#c         C@  s  |  d } | j  p" t | t j  sM t g  |  d  D] } | j  ^ q4  r^ | j |   d  Sg  } | j  ry | j } n | j r t |  } n  t	 |  } g  t
 |  D] } g  ^ q } g  }	 x|  d  D]} | j  s| j r t | j d  n  | j |  q n  t	 | j  }
 t g  | j D] } | j r'd ^ q' } | d k rzt | j d  | j | | g  q q |
 | | k rt | j d | | d k rd pd f  | j | | g  q q | rt | |	 | j |  q |
 | k  r-t | j d |
 | f  | j | | g  q q x- t | | j  D] \ } } | j |  q@Wq W| r| j |  | j |  n  x@ t | |  D]/ \ } } | r| j |  t | |  qqWx8 |	 D]0 } | d	 j  rt | |  q| j |  qWd  S(
   Nis4   starred assignment target must be in a list or tuplei   s,   more than 1 starred expression in assignments#   need more than %d value%s to unpackt   st    s/   too many values to unpack (expected %d, got %d)i    (   R   RQ   R   t   UnicodeNodeR~   R   RH   R?   R   R   R   t
   is_starredR   R6   t   map_starred_assignmentt   zipR   (   t   inputt   outputRg   Rf   t   complete_assignmentst   rhs_argst   rhs_sizeR   t   lhs_targetst   starred_assignmentst   lhs_sizeR>   t   starred_targetst   targetst   cascade(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     sf    
'				+ 	c         C@  s%  xi t  t |  |   D]F \ } \ } } | j rO | } t |  | d } Pn  | j |  q Wt d   xC t  t |  | | | d   D] \ } \ } } | j |  q W| | j }	 | | }
 | r |
 |  }
 n  |
 r |
 d j } n	 |	 j } | j |	 t j	 d | d |
  g  d  S(   Ni   s6   no starred arg found when splitting starred assignmenti    R6   RH   (
   R   R   R   R   R   R   R   R6   R   t   ListNode(   R   R   t   lhs_argsR   R   R   R>   t   starredt   lhs_remainingR   t   starred_rhsR6   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s&    	(	$
	t   PxdPostParsec           B@  s5   e  Z d  Z d Z d Z d   Z d   Z d   Z RS(   s  
    Basic interpretation/validity checking that should only be
    done on pxd trees.

    A lot of this checking currently happens in the parser; but
    what is listed below happens here.

    - "def" functions are let through only if they fill the
    getbuffer/releasebuffer slots

    - cdef functions are let through only if they are on the
    top level and are declared "inline"
    s>   function definition in pxd file must be declared 'cdef inline's5   inline function definition in pxd file cannot be '%s'c         C@  s   d |  _  t t |   j |  S(   Nt   pxd(   Rm   R   R   t   __call__(   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   4  s    	c         C@  s,   |  j  } d |  _  |  j |  | |  _  | S(   NRb   (   Rm   R3   (   R   R   t   old(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CClassDefNode8  s
    			c         C@  s   |  j  } t | t j  rB |  j d k rB | j d k rB d  } n  t | t j  r d | j k r |  j d	 k r t	 | _
 | j d k r |  j | j } q | j r |  j d } q d  } q |  j  } n  | r |  j j t | j |   d  S| Sd  S(
   NRb   t   __getbuffer__t   __releasebuffer__u   inlineR   t   privatet   api(   s   __getbuffer__s   __releasebuffer__(   s   pxds   cclass(   t   ERR_INLINE_ONLYRQ   R   RU   Rm   RG   R!   t   CFuncDefNodet	   modifiersR2   t   inline_in_pxdt
   visibilityt   ERR_NOGO_WITH_INLINER   R1   Rt   RA   R6   (   R   R   t   err(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_FuncDefNode?  s$    	!				(   R#   R$   R%   R   R   R   R   R   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   #  s   		t   InterpretCompilerDirectivesc           B@  s  e  Z d  Z i e j d 6e j d 6e j d 6e j e d  d 6e j e d  d 6e j e	 d  d 6e j e	 d  d	 6e j d
 6Z
 i e j d  d 6Z e d d d d d d d d d d d g  Z e j e
  e d d d g  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$ RS(.   sq  
    After parsing, directives can be stored in a number of places:
    - #cython-comments at the top of the file (stored in ModuleNode)
    - Command-line arguments overriding these
    - @cython.directivename decorators
    - with cython.directivename: statements

    This transform is responsible for interpreting these various sources
    and store the directive in two ways:
    - Set the directives attribute of the ModuleNode for global directives.
    - Use a CompilerDirectivesNode to override directives for a subtree.

    (The first one is primarily to not have to modify with the tree
    structure, so that ModuleNode stay on top.)

    The directives are stored in dictionaries from name to value in effect.
    Each such dictionary is always filled in for all possible directives,
    using default values where no value is given by the user.

    The available directives are controlled in Options.py.

    Note that we have to run this prior to analysis, and so some minor
    duplication of functionality has to occur: We manually track cimports
    and which names the "cython" module may have been imported to.
    t   typeofs   operator.addresss   operator.dereferences   ++s   operator.preincrements   --s   operator.predecrements   operator.postincrements   operator.postdecrementt   addresst   ,s   operator.commat   declaret   unionRd   t   typedeft   sizeoft   castt   pointert   compiledt   NULLt
   fused_typet   parallelt   pranget   threadidc         C@  s   t  t |   j |  t   |  _ i d d 6|  _ i  |  _ t j t	 j
    } x3 | j   D]% \ } } t j |  | t |  <q] W| |  _ d  S(   Nt   staticmethod(   R   R   R   R   t   cython_module_namest   directive_namest   parallel_directivesR   t   deepcopyR   t   get_directive_defaultsR   R   t
   directives(   R   R1   t   compilation_directive_defaultsR   R   RF   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    	c         C@  s|   t  j j | d   } | rN | | k rN |  j j t | d | | f   t S| t  j k rt t	 | d | f  n  t
 Sd  S(   Ns4   The %s compiler directive is not allowed in %s scopes   Invalid directive: '%s'.(   R   t   directive_scopesRo   R!   R1   Rt   RA   R.   t   directive_typesR   R2   (   R   R6   t	   directivet   scopet   legal_scopes(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   check_directive_scope  s    c         C@  s   xR t  | j  D]A } |  j | j | d  s |  j | j | d  | j | =q q W| j |  _ |  j j | j  |  j | _ |  j	 | _	 |  j
 |  |  j | _ | S(   NRe   (   t   sortedt   directive_commentsR  R6   t   wrong_scope_errorR  t   module_scopeR   t   updateR   R3   R   (   R   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ModuleNode  s    c         C@  s+   | t  j k p* | |  j k p* t j |  S(   N(   R   R   t   special_methodsR   t   parse_basic_type(   R   RG   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   is_cython_directive  s    c         C@  s   | d j  d  } | r | j d  } | d k rD d |  j d <nm | d k rx x^ |  j D] } d | |  j | <qZ Wn9 t |  d k s | d |  j k r t | d	 |  n  |  j j t j	 d
 d   n  | S(   s   
        Checks to see if fullname (e.g. cython.parallel.prange) is a valid
        parallel directive. If it is a star import it also updates the
        parallel_directives.
        t   .s   cython.parallel.u   cython.parallelu   parallelu   cython.parallel.*u   cython.parallel.%si   is   No such directive: %st   InitThreadss   ModuleSetupCode.c(
   t
   startswitht   splitR   t   valid_parallel_directivesR   R   R  t   use_utility_codeR   t   load_cached(   R   t	   full_nameR6   R   R   RG   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   is_parallel_directive  s    	c         C@  s   | j  d k r+ |  j j | j p$ d  n | j  j d  r| j  j d  ri t | j | j  d  n  | j  d k r | j r | j d k r | j  |  j | j <n  |  j j d  | j  |  j d <|  j j	 t
 j d d   n3 | j r| j  d |  j | j <n |  j j d  d  S| S(	   Nu   cythonu   cython.u   cython.parallel.s    is not a moduleu   cython.parallelR  s   ModuleSetupCode.ci   (   t   module_nameR   R   t   as_nameR  R   R6   R   R  R  R   R  R   R!   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CImportStatNode  s"    		c   
      C@  s!  | j  r| j d k s+ | j j d  r| j d d } g  } x | j D] \ } } } } | | } d | }	 |  j |	 | j  r |	 |  j | p | <qL |  j |  r | |  j | p | <| d  k	 r|  j
 j t | d   qqL | j | | | | f  qL W| sd  S| | _ n  | S(   Nu   cythonu   cython.u   .i   s0   Compiler directive imports must be plain imports(   t   relative_levelR  R  t   imported_namesR  R6   R   R  R   R!   R1   Rt   RA   R   (
   R   R   t	   submodulet   newimpR6   RG   R  t   kindR  t   qualified_name(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_FromCImportStatNode  s&    
!

c         C@  s   | j  j j d k s- | j  j j j d  r | j  j j d d } g  } x | j D]} \ } } | | } d | } |  j | | j  r | |  j | j <qT |  j	 |  r | |  j
 | j <qT | j | | f  qT W| s d  S| | _ n  | S(   Nu   cythonu   cython.u   .i   (   Re   R  RF   R  R   R  R6   R   RG   R  R   R   R!   (   R   R   R  R  RG   t	   name_nodeR  R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_FromImportStatNode  s     

c         C@  s   t  | j t j  r | j j j } | d j d  } | d k rN | rN | S| j j j } | j j } t	 j
 | j d | d | } |  j |  } n |  j |  | S(   Nu   .u   cython.parallel.u   cythonR  R  (   RQ   Rg   R   t
   ImportNodeR  RF   R  Rf   RG   R   t   CImportStatNodeR6   R  R3   (   R   R   R  t   is_parallelR  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR{     s    	c         C@  s:   | j  |  j k r t | _ n |  j j | j   | _ | S(   N(   RG   R   R2   t   is_cython_moduleR   Ro   t   cython_attribute(   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   2  s    c         C@  s  t  | t j  ra|  j | j  | j j   } | rt j j |  } | r^| j	   \ } } g  } g  } | d  k	 r2| t k	 r2xw | j D]l } | \ }	 }
 d | |	 j f } t j j |  r | j |  j | |
 g d  | j   q | j |  q W| sd  } n	 | | _ | r2| r2| r2| Sn  | j |  j | | | | j j   | Sqn t  | t j t j f  r|  j |  | j   } | rt j j |  } | t k r| t f g S| d  k r| d  f g St | j d |   qn  d  S(   Ns   %s.%ss5   The '%s' directive should be used as a function call.(   RQ   R   t   CallNodet   visitt   functiont   as_cython_attributeR   R   Ro   t   explicit_args_kwdsR!   t   dictt   key_value_pairsRF   R   t   try_to_parse_directiveR6   t   AttributeNodeRs   t   boolR2   RA   (   R   R   t   optnamet   directivetypeRH   t   kwdsR   R-  t   keyvalueR   RF   t   sub_optname(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   try_to_parse_directives9  sF    (		%
c   	      C@  sB  t  j j |  } t |  d k rN t | d t j  rN | t  j   | f S| t k r | d  k	 s t |  d k s t | d t j
  r t | d |   n  | | d j f S| t k r$| d  k	 s t |  d k s t | d t j  rt | d |   n  | t | d j  f S| t k r| d  k	 snt |  d k snt | d t j t j f  rt | d |   n  | t | d j  f S| t k r| d  k	 st |  d k rt | d |   n  | | d f S| t k rRt |  d k rt | d |   n  | t g  | j D] \ } } | j | f ^ q- f S| t k r| rt |  d k rt | d |   n  | g  | D] } t | j  ^ qf St |  r2| d  k	 st |  d k st | d t j t j f  rt | d |   n  | | | t | d j   f St s>t  d  S(	   Ni   i    s8   The %s directive takes one compile-time boolean arguments8   The %s directive takes one compile-time integer arguments7   The %s directive takes one compile-time string arguments(   The %s directive takes one type arguments1   The %s directive takes no prepositional argumentss+   The %s directive takes no keyword arguments(   R   R   Ro   R   RQ   R   t   NoneNodeR   R0  R!   t   BoolNodeRA   RF   t   intt   IntNodet   strt
   StringNodeR   t   typeR,  R-  R   t   callableR.   t   AssertionError(	   R   R1  RH   R3  R6   R2  R   RF   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR.  d  sR    (55!5&! c         C@  s   |  j  } t j |  } | j |  | |  _  t | t j  sL t |   |  j |  } t j d | j	 d | d |  } | |  _  | S(   NR6   RK   R   (
   R   R   R  RQ   R   R8   R?  R"   t   CompilerDirectivesNodeR6   (   R   RK   R   t   olddirectivest   newdirectivest   retbodyR   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_with_directives  s    				c         C@  sP   |  j  | d  } | s% |  j |  St j | j d | g } |  j | |  S(   NR)  R7   (   t   _extract_directivesR"   R   R8   R6   RD  (   R   R   R   RK   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s
    c         C@  s   |  j  | d  } | s | Sxa | j   D]S \ } } | d k rM | | _ q) | d k r) |  j j t | j d |   q) q) Wt j | j d | g } |  j	 | |  S(   NR)  t   localst   finalR   sX   Cdef functions can only take cython.locals(), staticmethod, or final decorators, got %s.R7   (   s   finals   staticmethod(
   RE  R   t   directive_localsR1   Rt   RA   R6   R   R8   RD  (   R   R   R   RG   RF   RK   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR(     s    c         C@  sP   |  j  | d  } | s% |  j |  St j | j d | g } |  j | |  S(   NRb   R7   (   RE  R"   R   R8   R6   RD  (   R   R   R   RK   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s
    c         C@  sP   |  j  | d  } | s% |  j |  St j | j d | g } |  j | |  S(   Nt   cppclassR7   (   RE  R"   R   R8   R6   RD  (   R   R   R   RK   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CppClassNode  s
    c         C@  sP   |  j  | d  } | s% |  j |  St j | j d | g } |  j | |  S(   Nt   classR7   (   RE  R"   R   R8   R6   RD  (   R   R   R   RK   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_PyClassDefNode  s
    c         C@  s  | j  s i  Sg  } g  } g  } x | j  D] } |  j | j  } | d  k	 r x | D] } |  j | j | d |  rT | \ }	 }
 |  j j |	 t    |
 k r | j	 |  n  | d d k r | j	 |  q qT qT Wq) | j	 |  q) W| r+t
 | t j t j t j f  r+t | d j d   n | | | _  i  } | j   x | D]} } | \ }	 }
 |	 | k r| |	 } t
 | t  r| j |
  qt
 | t  r| j |
  q|
 | |	 <qO|
 | |	 <qOW| S(   Ni    R   s8   Cdef functions/classes cannot take arbitrary decorators.(   t
   decoratorsR6  t	   decoratorR!   R  R6   R   Ro   t   objectR   RQ   R   R   Rn   t   CVarDefNodeRA   t   reverseR,  R  R   t   extend(   R   R   t
   scope_nameR   t   realdecst   botht   dect   new_directivesR   RG   RF   t   optdictt	   old_value(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRE    s@    	'

c         C@  s   i  } x |  j  | j  p g  D] } | d  k	 r | j d  k	 r_ |  j j t | j d   q | \ } } | d k r t j	 | j d | d | j
 } |  j |  S|  j | j | d  r | | | <q q q W| r |  j | j
 |  S|  j |  S(   Ns6   Compiler directive with statements cannot contain 'as't   nogilt   gilt   stateRK   s   with statement(   s   nogils   gil(   R6  t   managerR!   R   R1   Rt   RA   R6   R   t   GILStatNodeRK   R"   R  RD  (   R   R   t   directive_dictR   RG   RF   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_WithStatNode  s    	!(%   R#   R$   R%   R   t
   TypeofNodet   AmpersandNodet   DereferenceNodet   inc_dec_constructorR2   R.   t   unop_method_nodest   c_binop_constructort   binop_method_nodesR   R
  R  R  R   R  R	  R  R  R  R  R!  R{   R   R6  R.  RD  R   R(   R   RJ  RL  RE  R`  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   [  sP   


	
										+	,							+t   ParallelRangeTransformc           B@  s   e  Z d  Z d Z e Z e Z d Z i e	 j
 d 6e j d 6e	 j d 6Z d   Z d   Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z RS(   s  
    Transform cython.parallel stuff. The parallel_directives come from the
    module node, set there by InterpretCompilerDirectives.

        x = cython.parallel.threadavailable()   -> ParallelThreadAvailableNode
        with nogil, cython.parallel.parallel(): -> ParallelWithBlockNode
            print cython.parallel.threadid()    -> ParallelThreadIdNode
            for i in cython.parallel.prange(...):  -> ParallelRangeNode
                ...
    u   cython.parallel.parallelu   cython.parallel.threadidu   cython.parallel.prangec         C@  s   | j  |  j k p | j S(   N(   RG   R   R%  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   node_is_parallel_directive(  s    c         C@  s   |  j  r d j |  j  } nC |  j |  j d } d | d j |  j d  f } | j d  } |  j j |  } | d k r |  j  o |  j d d k r t | j	 d |  n  t
 |  _  d |  _ | S(   s   
        Figure out which parallel directive was used and return the associated
        Node class.

        E.g. for a cython.parallel.prange() call we return ParallelRangeNode
        R  i    s   %s.%si   R   s   Invalid directive: %sN(   t   namenode_is_cython_modulet   joint   parallel_directiveR   t   rstript   directive_to_nodeRo   R!   R   R6   R.   (   R   R   R   t   cls(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   get_directive_class_node+  s    			c         C@  s&   | j  r" | j  |  _  |  j |  S| S(   sd   
        If any parallel directives were imported, copy them over and visit
        the AST
        (   R   R"   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR	  D  s    	c         C@  s1   |  j  |  r- | j g |  _ | j |  _ n  | S(   N(   Ri  RG   Rl  R%  Rj  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   P  s    c         C@  s0   |  j  |  |  j r, |  j j | j  n  | S(   N(   R3   Rl  R   t	   attribute(   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_AttributeNodeV  s    	c         C@  s   |  j  | j  |  j s | St | t j  rG | j j } | j } n | j } i  } |  j	 |  } | r | | j
 d | d | } n  | S(   NRH   t   kwargs(   R(  R)  Rl  RQ   R   t   GeneralCallNodet   positional_argsRH   t   keyword_argsRp  R6   (   R   R   RH   Rs  t   parallel_directive_class(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CallNode\  s    		c         C@  s   |  j  | j  } t | t j  rz |  j d k rI t | j j d  n  d |  _ |  j  | j  } d |  _ | | _ | S|  j
 r |  j |  } | s d S| t j k r t | j d  d Sn  |  j  | j  | _ | S(   s.   Rewrite with cython.parallel.parallel() blockss   parallel withs*   Nested parallel with blocks are disalloweds%   The parallel directive must be calledN(   R(  R]  RQ   R   t   ParallelWithBlockNodeR\  R   R6   RK   R!   Rl  Rp  (   R   R   t   newnodeRK   Rw  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR`  s  s&    
				c         C@  s   |  j  | j  |  j  | j  t | j j t j  } |  j } | r | j j } | j | _ | j | _ | j	 | _	 | } t | j t
 j  s t | j j d  n  d |  _ n  |  j  | j  | |  _ |  j  | j	  | S(   s/   Rewrite 'for i in cython.parallel.prange(...):'s+   Can only iterate over an iteration variableR   (   R(  t   iteratorR   RQ   t   sequenceR   t   ParallelRangeNodeR\  RK   t   else_clauseR   Rs   R   R6   (   R   R   t	   in_pranget   previous_statet   parallel_range_node(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ForInStatNode  s&    	
	c         C@  s&   | d k	 r" t t |   j |  Sd S(   s   Visit a node that may be NoneN(   R!   R   Rh  R(  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR(    s    N(   R#   R$   R%   R!   Rl  R.   Rj  t   in_context_manager_sectionR\  R   Ry  R   t   ParallelThreadIdNodeR}  Rn  Ri  Rp  R	  R   Rr  Rx  R`  R  R(  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRh    s$   


								t   WithTransformc           B@  s   e  Z d    Z d   Z RS(   c   
      C@  s  |  j  | d  | j } | j } | j | j | j } } } t j | d t j | d t j	 |  d t
 | ru d n d  d t d g  d	 t | _ | r t j | d
 | j | _ n  | d  k	 r t j | d t j | d | d | | g } n  t j | d t d g  t d  D] } t j |  ^ q} t j | d t j | d t j | d t j | d t j | d | d t d | d | rt j | d
 d  n d  d t j |  g d d  d d  d d  d | }	 t j | d t j | d | d |	 g d d  d t j | d t j | d | d t d t j | d g  t d  D] } t j |  ^ qNd | rt j | d
 d  n d  d t | _ | S(   NRK   R)  t   objRq  t
   __aenter__t	   __enter__t   is_special_lookupRH   t   is_tempR   R7   Rf   t	   with_nodet   slowi   t
   if_clausest	   conditiont   operandt	   with_statt   test_if_runt   awaitR~  t   patternR   t   excinfo_targett   except_clausesR   R>   t   handle_error_case(    R3   R6   t   is_asyncRK   R   R]  R   t   SimpleCallNodeR/  t	   CloneNodeR
   R2   t
   enter_callt   AwaitExprNodeR!   R   R8   t   WithTargetAssignmentStatNodet	   TupleNodeR   t   ExcValueNodet   ExceptClauseNodet
   IfStatNodet   IfClauseNodet   NotNodet   WithExitCallNodeR.   t   ReraiseStatNodeR   t   TryExceptStatNodeRS   R7  (
   R   R   R6   R  RK   R   R]  R   R  t   except_clause(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR`    sd    			+'				1'c         C@  s   | S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR5     s    (   R#   R$   R`  R5   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s   	=t   DecoratorTransformc           B@  sz   e  Z d  Z d Z i d d 6d d 6d d 6j Z d   Z d   Z d	   Z	 e
 d
    Z e
 d    Z e
 d    Z RS(   s  
    Transforms method decorators in cdef classes into nested calls or properties.

    Python-style decorator properties are transformed into a PropertyNode
    with up to the three getter, setter and deleter DefNodes.
    The functional style isn't supported yet.
    t   __get__t   gettert   __set__t   settert   __del__t   deleterc         C@  sR   |  j  d  k r g  |  _  n  |  j  j i   t t |   j |  |  j  j   | S(   N(   t   _propertiesR!   R   R   R  R   t   pop(   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    c         C@  s@   t  | j d t  r d n d } t | j d | j |  | S(   Ni    i   s4   'property %s:' syntax is deprecated, use '@property'(   RQ   R6   R;  R   RG   (   R   R   t   level(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_PropertyNode  s    "c   
      C@  s  |  j  } |  j |  } | d k s. | j r2 | S|  j d } x| j d  d  d  D]} | j } | j r[| j d k r[t | j  d k r |  j | |  S| j } d | _ | j j	 |  | g } | | k r| | } | j
 | _
 | j | _ | | j _ g  St j | j
 d | } | j | _ t j | j
 d | | _ | | | <| g S| j rV | j j | k rV |  j | j  }	 |	 r| j j | j k st  t | j  d k r|  j | |  S|  j | | |	 |  SqV qV W|  j | | j | j  S(   NRb   it   propertyi   R  RG   R7   (   Rm   R   RM  R  RN  R   RG   R   t   _reject_decorated_propertyt   removeR6   RL   RK   R7   R   t   PropertyNodeR8   t   is_attributeR  t   _map_property_attributeRq  R?  t   _add_to_propertyt   chain_decorators(
   R   R   Rm   t
   propertiest   decorator_nodeRN  RG   t	   stat_listt   propt   handler_name(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_DefNode  sB    					

c         C@  s7   x0 |  j  D]% } | | k r
 t | j d  q
 q
 W|  S(   Ns=   Property methods with additional decorators are not supported(   RM  R   R6   (   R   R  t   deco(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  =  s    c         C@  s}   |  | j  } | | _  | j j |  | j j } xD t |  D]) \ } } | j  | k r? | | | <Pq? q? W| j |  g  S(   N(   RG   RM  R  RK   R7   R   R   (   R  R   RG   RN  R  R7   R   t   stat(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  E  s    	
c         C@  s   t  j |  j d | } x? | d d d  D]* } t  j | j d | j d | g } q, Wt  j |  j d | } t j |  j d | d | } t j | g  } | |  _ |  | g S(   sf  
        Decorators are applied directly in DefNode and PyClassDefNode to avoid
        reassignments to the function/class name - except for cdef class methods.
        For those, the reassignment is required as methods are originally
        defined in the PyMethodDef struct.

        The IndirectionNode allows DefNode to override the decorator.
        RG   NiR)  RH   Rf   Rg   (	   R   Rs   R6   R  RN  R   Rr   t   IndirectionNodet   decorator_indirection(   R   RM  RG   t   decorator_resultRN  R   t   reassignment(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  S  s    
					N(   R#   R$   R%   R!   R  Ro   R  R   R  R  R   R  R  R  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s   			't   CnameDirectivesTransformc           B@  s/   e  Z d  Z d   Z e Z e Z e Z e Z RS(   s   
    Only part of the CythonUtilityCode pipeline. Must be run before
    DecoratorTransform in case this is a decorator for a cdef class.
    It filters out @cname('my_cname') decorators and rewrites them to
    CnameDecoratorNodes.
    c         C@  sA  t  | d d   s |  j |  Sxt | j  D]\ } } | j } t | t j  r/ | j	 j
 r/ | j	 j d k r/ | j   \ } } | r t d   n  t |  d k r t d   n  | d j o | d j t j k s t d   n  | d j d   } | j | =t j d | j d	 | d |  } Pq/ q/ W|  j |  S(
   NRM  t   cnames/   cname decorator does not take keyword argumentsi   s*   cname decorator takes exactly one argumenti    s4   argument to cname decorator must be a string literalR6   R   (   t   getattrR!   R"   R   RM  RN  RQ   R   R'  R)  R   RG   R+  R?  R   R   R=  R   t   str_typet   compile_time_valueR   t   CnameDecoratorNodeR6   (   R   R   R   RN  RH   Rs  R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   handle_functionw  s0    	
	(   R#   R$   R%   R  R   R   R+   R,   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  o  s   	!t   ForwardDeclareTypesc           B@  s>   e  Z d    Z d   Z d   Z d   Z d   Z d   Z RS(   c         C@  s8   |  j  } | j } | j | _ |  j |  | | _ | S(   N(   R  R   R3   (   R   R   t   envR   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CompilerDirectivesNode  s    			c         C@  s,   | j  |  _ | j |  j _ |  j |  | S(   N(   R  R  R   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR	    s    c         C@  s5   |  j  j } d |  j  _ |  j |  | |  j  _ | S(   Ni   (   R  t   in_cincludeR3   (   R   R   t   old_cinclude_flag(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CDefExternNode  s
    c         C@  s   | j  |  j  | S(   N(   R   R  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR+     s    c         C@  s,   | j  |  j j k r( | j |  j  n  | S(   N(   RG   R  t   entriesR   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR,     s    c         C@  s,   | j  |  j j k r( | j |  j  n  | S(   N(   t
   class_nameR  R  R   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    (   R#   R$   R  R	  R  R+   R,   R   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s   					t   AnalyseDeclarationsTransformc           B@  s  e  Z e d  d d d e d$  g Z e d d d d e d$  g Z e d d d d e d$  g Z e d d e d$  g Z e d d e d$  g 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& RS(%   ur   
property NAME:
    def __get__(self):
        return ATTR
    def __set__(self, value):
        ATTR = value
    R  t   c_classt   pipelineu   
property NAME:
    def __get__(self):
        return ATTR
    def __set__(self, value):
        ATTR = value
    def __del__(self):
        ATTR = None
    u?   
property NAME:
    def __get__(self):
        return ATTR
    u  
cdef class NAME:
    cdef TYPE value
    def __init__(self, MEMBER=None):
        cdef int count
        count = 0
        INIT_ASSIGNMENTS
        if IS_UNION and count > 1:
            raise ValueError, "At most one union member should be specified."
    def __str__(self):
        return STR_FORMAT % MEMBER_TUPLE
    def __repr__(self):
        return REPR_FORMAT % MEMBER_TUPLE
    u;   
if VALUE is not None:
    ATTR = VALUE
    count += 1
    i    c         C@  s=   g  |  _  t   |  _ t t |   } | j |  _ | j |  S(   N(   t   seen_vars_stackR   t   fused_error_funcsR   R  R   t   _super_visit_FuncDefNodeR   (   R   t   roott   super_class(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s
    	c         C@  s   |  j  d j | j  | S(   Ni(   R  R   RG   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    c         C@  sD   |  j  j t    | j |  j    |  j |  |  j  j   | S(   N(   R  R   R   t   analyse_declarationst   current_envR3   R  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR	     s
    c         C@  sB   |  j  d 7_  | j |  j    |  j |  |  j  d 8_  | S(   Ni   (   t	   in_lambdaR  R  R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRX     s
    c         C@  s   |  j  |  } | j r | j j r | j r g  } xY | j j D]K } | j r@ |  j |  } | j | j  |  j |  | j	 |  q@ q@ W| r | j j
 | 7_
 q n  | S(   N(   t   visit_ClassDefNodeR  t   implementedRK   t   var_entriest   needs_propertyt   create_PropertyR  R(  R   R7   (   R   R   R7   t   entryR  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    	c         C@  s   g  } xR | D]J } | j  } | j sG | j d k sG | j | j  r | j |  q q W| r t |  j  } | j } | j | | | j  \ }	 }
 |
 j	 |  | |
 g } n  | S(   sd   
        Create function calls to the decorators and reassignments to
        the function.
        R   t   classmethod(   s   staticmethods   classmethod(
   RN  R   RG   t   lookup_hereR   R  R1   R   R  R  (   R   t   old_decoratorsR  R   RM  RN  t   funct	   transformRV   R   t   reassignments(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   _handle_fused_def_decorators  s    	
	c         C@  s   | j  j d | j  |  j | j  | _ | j |  t j j | j d t } t j	 | j
 |   } | | _ |  j | j t j |  |  | _ | r |  j | | |  } n  | S(   s#   Handle def or cpdef fused functionsi    t   binding(   R7   t   insertt   py_funcR(  t   update_fused_defnode_entryR   t   PyCFunctionNodet   from_defnodeR2   t	   ProxyNodet   coerce_to_tempt   resulting_fused_functiont   _create_assignmentR  t   fused_func_assignmentR  (   R   RM  R  R   t   pycfunc(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   _handle_def6  s    	c         C@  s0  d d l  m } |  j s" |  j r |  j |  j k rc |  j rP t | j d  qc t | j d  n  |  j j |  j  t j	 | j  | _
 x6 | j D]+ } | j j r | j j   d | _ q q W| St | d d  } | j | |  } | |  _ |  j |  d |  _ | j r,|  j | | |  } n  | S(   s:   Create a fused function for a DefNode with fused argumentsi   (   t	   FusedNodes   Fused lambdas not alloweds   Cannot nest fused functionsi    RM  N(   R   R  t   fused_functionR  R  R   R6   R   R   t   PassStatNodeRK   RH   R=  t   is_fusedt   get_fused_typesR  R!   t   FusedCFuncDefNodeR3   R  R  (   R   R  R   R  R   RM  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   _create_fused_functionH  s(    				c      	   C@  sd   | j  r` | j r` t j | j j d | j d t j | j j  d t j | j j  | _ n  d S(   s8   Handle cleanup for 'with gil' blocks in nogil functions.RK   R   t   finally_except_clauseN(   RZ  t   has_with_gil_blockR   t   NogilTryFinallyStatNodeRK   R6   t   EnsureGILNode(   R   t   lenvR   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   _handle_nogil_cleanupf  s    	c         C@  sb   | j  r[ | j r[ t | _ t | j d  t j | j d g  d t j | j  | _ n  | j S(   Ns   Fused generators not supportedR7   RK   (	   t   is_generatort   has_fused_argumentsR.   R   R6   R   R8   R  t   gbody(   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   _handle_fuseds  s    	c         C@  s  |  j    } |  j j t    | j } | j |  xm | j j   D]\ \ } } | j |  sE | j	 |  } | r | j
 | | | j  q t | j d  qE qE W|  j |  r |  j | |  } n- | j j |  |  j | |  |  j |  |  j j   | S(   s  
        Analyse a function and its body, as that hasn't happend yet.  Also
        analyse the directive_locals set by @cython.locals().

        Then, if we are a function with fused arguments, replace the function
        (after it has declared itself in the symbol table!) with a
        FusedCFuncDefNode, and analyse its children (which are in turn normal
        functions). If we're a normal function, just analyse the body of the
        function.
        s
   Not a type(   R  R  R   R   t   local_scopet   declare_argumentsRH  R   R  t   analyse_as_typet   declare_varR6   R   R
  R   RK   R  R  R  R  (   R   R   R  R  t   vart	   type_nodeR=  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   }  s"    	c         C@  sj   |  j  |  } |  j   } t | t j  sP | j sP | j sP | j |  rT | S| |  j | |  g S(   N(	   R   R  RQ   R   RU   t   fused_py_funct   is_generator_bodyt   needs_assignment_synthesist   _synthesize_assignment(   R   R   R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s    c         C@  s   |  j  |  S(   N(   R   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_GeneratorBodyDefNode  s    c      	   C@  s   | } x | j  s | j r' | j } q	 W| j rn t j | j d | d | j j d t j	 |  } | _
 n3 |  j j d  } t j j | |  } | j | _ | j  r t | _ n  | j | _ |  j | | |  S(   NRV   t   pymethdef_cnamet   code_objectR  (   t   is_py_class_scopet   is_c_class_scopet   outer_scopet   is_closure_scopeR   t   InnerFunctionNodeR6   R  R  t   CodeObjectNodet   py_cfunc_nodet   current_directivesRo   R  R  R  R2   R  t   is_cyfunctionR  (   R   R   R  t   genvRg   R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s    		c         C@  s   | j  rZ xB | j  d  d  d  D]* } t j | j d | j d | g } q  Wd  | _  n  t j | j d t j | j d | j	 d | } | j
 |  | S(   NiR)  RH   Rf   RG   Rg   (   RM  R   R  R6   RN  R!   R   Rr   Rs   RG   R  (   R   RV   Rg   R  RN  t   assmt(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s    					c         C@  s   |  j    } | j |  | j r |  j j t |  j d   |  j | | j  | j | j  |  j	 |  |  j
   |  j j   n | j |  |  j	 |  | S(   Ni(   R  R  t   has_local_scopeR  R   R   t   enter_scopet
   expr_scopet   analyse_scoped_declarationsR3   t
   exit_scopeR  (   R   R   R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ScopedExprNode  s    	
c         C@  s$   |  j  |  | j |  j    | S(   N(   R3   R  R  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_TempResultFromStatNode  s    c         C@  s$   | j  d k r d  S|  j |  Sd  S(   Nt   extern(   R   R!   R  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRJ    s    c      	   C@  s  t  r
 d  St j d | j d t j d | j d d  d t d   } | j j j	 j
 } g  } x9 | D]1 } | j t j d | j d | d | j   qe Wg  } xb t | |  D]Q \ } } | j |  j j i t j | j d | j d 6| d 6d | j  q Wd	 | j j j d
 t |  d  f } |  j j i t j | j d | d 6t j | j d | j j j d 6t j | j d | d 6t j | j d t |  d 6t j | j d t | j d d   d 6d | j j d }	 | j |	 _ t  |	 _ |	 j j }
 t |
 d j t j  s-t   | j |
 d j _ |
 d } t | t j!  rk| j d k sqt   | j" d } | j j j st  | _# n  | j" d =xK t | |  D]: \ } } t$ j% |  } | j | j& _ | j" j |  qWx t | |  D]r \ } } | j j' r%|  j( } n	 |  j) } | j i | d 6d | j j d } | j | _ |	 j j j |  qW|	 j* |  j+    |  j, |	  S(   NR6   R  RG   u   selfRq  u   valueu   VALUEu   ATTRu   %s(%s)s   %s, iR7   u   INIT_ASSIGNMENTSRF   u   IS_UNIONRH   u   MEMBER_TUPLEu
   STR_FORMATs   %ss   %ru   REPR_FORMATi    i   R   (-   R2   R!   R   R/  R6   Rs   R
   R  R=  R  R  R   RG   R   t   init_assignmentt
   substituteR   t   struct_or_union_wrapperR   R8   R8  t	   is_structR  R<  t   replaceR7   R  t   shadowRK   RQ   t	   base_typet   CSimpleBaseTypeNodeR?  RU   RH   t   kw_onlyR   R   t
   declaratort   is_pyobjectt   basic_pyobject_propertyt   basic_propertyR  R  R   (   R   R   t
   self_valueR  t
   attributesR  t   init_assignmentst   attrt
   str_formatt   wrapper_classt
   class_bodyt   init_methodt   arg_templateR   t   templateR  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR,     sh    		
'#.	
'
		
c         C@  s   |  j  |  | S(   N(   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR)   <  s    c         C@  s   | S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR'   A  s    c         C@  s   d  S(   N(   R!   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR*   D  s    c         C@  s   | j  d k r | Sd  Sd  S(   Nt   public(   R   R!   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR+   G  s    c         C@  s   | j  |  j d k rv |  j   j | j   } | d  k sV | j d k rv | j j rv t | j	 d | j  d  qv n  |  j
 |  | S(   NiR*  s,   cdef variable '%s' declared after it is usedi   (   RG   R  R  t   lookupR!   R   R  R  R   R6   R3   (   R   R   R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CNameDeclaratorNodeM  s     c         C@  s   |  j  |  d  S(   N(   R3   R!   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR(   V  s    c         C@  sW   |  j  | j  } | s d  St |  t k rJ | d | _ | g | d S| | _ | S(   Ni    i   (   R(  R   R!   R=  R   t
   child_node(   R   R   RE  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CnameDecoratorNode[  s    	c         C@  s   | j  d k r3 | j j r' |  j } qN |  j } n | j  d k rN |  j } n  | j i t j d | j	 d t j
 d | j	 d d  d | j  d 6d | j	 j d	 } | j | _ | j | _ | S(
   NRB  t   readonlyR6   R  RG   R   Rq  u   ATTRi    (   R   R=  R5  R6  R7  t   basic_property_roR,  R   R/  R6   Rs   RG   R7   RL   (   R   R  RA  R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  e  s    	N('   R#   R$   R	   R-   R!   R7  R6  RH  R-  R+  R  R  R   R   R	  RX   R   R  R  R   R  R
  R   R  R  R  R  R(  R)  RJ  R,   R)   R'   R*   R+   RD  R(   RF  R  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    sN   										
	$									N								
t    CalculateQualifiedNamesTransformc           B@  sb   e  Z d  Z d   Z d
 d  Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z RS(   s^   
    Calculate and store the '__qualname__' and the global
    module name on some nodes.
    c         C@  sS   |  j    j |  _ g  |  _ t t |   } | j |  _ | j |  _ |  j	 |  | S(   N(
   t   global_scopeR  R  R   RI  R   R  R  t   _super_visit_ClassDefNodeR3   (   R   R   t   _super(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR	  |  s    	c         C@  sQ   | r  |  j  } | j |  n	 |  j  } t d j |   | _ |  j | _ d  S(   NR  (   R  R   R
   Rk  t   qualnameR  (   R   R   RG   RM  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   _set_qualname  s    
	c         C@  s<   | j  r% | j r% | j g |  _ n |  j j | j  d  S(   N(   t   is_pyglobalt   is_pyclass_attrRG   R  R   (   R   R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   _append_entry  s    c         C@  s$   |  j  | | j  |  j |  | S(   N(   RN  RG   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ClassNode  s    c         C@  s   |  j  |  |  j |  | S(   N(   RN  R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_PyClassNamespaceNode  s    c         C@  s'   |  j  | | j j  |  j |  | S(   N(   RN  RV   RG   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_PyCFunctionNode  s    c         C@  s    |  j  | | j  |  j |  S(   N(   RN  RG   R   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s    c         C@  so   |  j  } t | d d   d k r5 |  j  j d  n |  j | j  |  j  j d  |  j |  | |  _  | S(   NRG   s   <lambda>s   <locals>(   R  R  R!   R   RQ  R  R  (   R   R   t   orig_qualified_name(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    
	c         C@  s[   |  j  } t | d d   p1 |  j   j | j  } |  j |  |  j |  | |  _  | S(   NR  (   R  R  R!   R  R  RG   RQ  RK  (   R   R   RU  R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s    
	N(   R#   R$   R%   R	  R!   RN  RQ  RR  RS  RT  R  R   R  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRI  w  s   									t   AnalyseExpressionsTransformc           B@  s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C@  s6   | j  j   | j j | j   | _ |  j |  | S(   N(   R  t   infer_typesRK   t   analyse_expressionsR3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR	    s    c         C@  s6   | j  j   | j j | j   | _ |  j |  | S(   N(   R  RW  RK   RX  R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    c         C@  s<   | j  r+ | j j   | j | j  } n  |  j |  | S(   N(   R#  R%  RW  t   analyse_scoped_expressionsR3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR(    s
    	c         C@  s3   |  j  |  | j r/ | j j r/ | j } n  | S(   s  
        Replace index nodes used to specialize cdef functions with fused
        argument types with the Attribute- or NameNode referring to the
        function. We then need to copy over the specialization properties to
        the attribute or name node.

        Because the indexing might be a Python indexing operation on a fused
        function, or (usually) a Cython indexing operation, we need to
        re-analyse the types.
        (   R"   t   is_fused_indexR=  t   is_errorRk   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_IndexNode  s    (   R#   R$   R	  R   R(  R\  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRV    s   			t   FindInvalidUseOfFusedTypesc           B@  s   e  Z d    Z d   Z RS(   c         C@  sF   | j  sB | j r2 | j j r2 t | j d  qB |  j |  n  | S(   Ns-   Return type is not specified as argument type(   R  R  t   return_typeR  R   R6   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s
    	c         C@  s9   | j  r( | j  j r( t | j d  n |  j |  | S(   Ns6   Invalid use of fused types, type cannot be specialized(   R=  R  R   R6   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR5     s    (   R#   R$   R   R5   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR]    s   	t   ExpandInplaceOperatorsc           B@  s   e  Z d    Z d   Z RS(   c   	   
   @  sH  | j  } | j } | j j r" | St | t j  r8 | S|  j   } t   f d    y   | d t	 \ } } Wn t
 k
 r | SX| j | j   } t j | j d | j d | d | d t	 } | j |  | j |  | j |  t j | j d | d | j | j |  } | j   x | D] } t | |  } q+W| S(	   Nc         @  s  |  j  r |  g  f S|  j j r? | r? t |   }  |  |  g f S|  j r   |  j  \ } } t |  j  } t j |  j	 d | d | | | g f S|  j
 r   |  j  \ } } t j |  j	 d | d |  j | f St |  t j  r t d   n t |   }  |  |  g f Sd  S(   NRk   t   indexR  Rq  s@   Don't allow things like attributes of buffer indexing operations(   R   R=  R5  R   t   is_subscriptRk   R`  R   t	   IndexNodeR6   R  R  R/  Rq  RQ   t   BufferIndexNodet
   ValueError(   R   t   settingRk   t   tempsR`  R  (   t   side_effect_free_reference(    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRg    s     	
	)	%Re  t   operatort   operand1t   operand2t   inplaceRf   Rg   (   Rf   Rg   R=  t   is_cpp_classRQ   R   Rc  R  R.   R2   Rd  R   t   __dict__t
   binop_nodeR6   Rh  t   analyse_target_typest   analyse_typest   analyse_operationR   Rr   t	   coerce_toRQ  R   (	   R   R   Rf   Rg   R  t   let_ref_nodest   dupt   binopt   t(    (   Rg  sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_InPlaceAssignmentNode  s:    					
c         C@  s   | S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR5   0  s    (   R#   R$   Rw  R5   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR_    s   	5t   AdjustDefByDirectivesc           B@  s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   s   
    Adjust function and class definitions by the decorator directives:

    @cython.cfunc
    @cython.cclass
    @cython.ccall
    @cython.inline
    c         C@  s&   | j  |  _  t |  _ |  j |  | S(   N(   R   R.   t   in_py_classR3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR	  ?  s    	c         C@  s/   |  j  } | j  |  _  |  j |  | |  _  | S(   N(   R   R3   (   R   R   t   old_directives(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  E  s
    		c         C@  s   g  } d |  j  k r% | j d  n  d |  j  k rk | j d t d |  j  j d  d |  } |  j |  Sd |  j  k r |  j r t | j d  q | j d t	 d |  j  j d  d |  } |  j |  Sn  d | k r t | j d  n  |  j
 |  | S(	   Nt   inlinet   ccallt   overridablet   returnsR   t   cfuncs#   cfunc directive is not allowed heres,   Python functions cannot be declared 'inline'(   R   R   t   as_cfunctionR2   Ro   R(  Ry  R   R6   R.   R3   (   R   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  L  s"    	!		!c         C@  sX   d |  j  k r( | j   } |  j |  S|  j } t |  _ |  j |  | |  _ | Sd  S(   NRb   (   R   t	   as_cclassR(  Ry  R2   R3   (   R   R   t   old_in_pyclass(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRL  `  s    			c         C@  s,   |  j  } t |  _  |  j |  | |  _  | S(   N(   Ry  R.   R3   (   R   R   R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   k  s
    			(   R#   R$   R%   R	  R  R  RL  R   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRx  5  s   				t   AlignFunctionDefinitionsc           B@  sG   e  Z d  Z d   Z d   Z d d  Z d   Z d   Z d   Z	 RS(   sq   
    This class takes the signatures from a .pxd file and applies them to
    the def methods in a .py file.
    c         C@  s5   | j  |  _  | j |  _ t   |  _ |  j |  | S(   N(   R  R   R   R  R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR	  y  s
    c         C@  s   |  j  j | j  } | r | j r: |  j | j   |  S| j  sQ | j  j r t | j d | j  | j r t | j d  n  d  Sn  | S(   Ns   '%s' redeclareds   previous declaration here(
   R  RC  RG   t	   is_cclassR   R  t   is_builtin_scopeR   R6   R!   (   R   R   t   pxd_def(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRL    s    		c         C@  su   | d  k r$ |  j j | j  } n  | rR | j s7 | S|  j } | j j |  _ n  |  j |  | rq | |  _ n  | S(   N(   R!   R  RC  R  t   defined_in_pxdR=  R3   (   R   R   R  R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    		c         C@  s   |  j  j | j  } | r | j  s2 | j  j r | j sr t | j d | j  | j rn t | j d  n  d  S| j |  } nO |  j  j	 r |  j
 d r | j |  j k r | j   r | j d |  j   } n  | S(   Ns   '%s' redeclareds   previous declaration heret
   auto_cpdefR  (   R  RC  RG   R  t   is_cfunctionR   R6   R!   R  t   is_module_scopeR   R  t   is_cdef_func_compatible(   R   R   R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s    		c         C@  s=   |  j  j r9 x* | j D] \ } } |  j j |  q Wn  | S(   N(   R  R  R   R  R   (   R   R   RG   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR!    s    c         C@  s   | S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR5     s    N(
   R#   R$   R%   R	  RL  R!   R   R  R!  R5   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  s  s   					t   RemoveUnreachableCodec           B@  s,   e  Z d    Z d   Z d   Z d   Z RS(   c         C@  s   |  j  d s | S|  j |  x t | j  D]~ \ } } | d 7} | j r. | t | j  k  r |  j  d r t | j | j d d  n  | j |  | _ n  t | _ Pq. q. W| S(   Nt   remove_unreachablei   s   warn.unreachables   Unreachable codei   (	   R  R3   R   R7   t   is_terminatorR   R   R6   R2   (   R   R   t   idxR  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR;     s    
		c         C@  s)   |  j  |  | j j r% t | _ n  | S(   N(   R3   RK   R  R2   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_IfClauseNode  s    c         C@  sS   |  j  |  | j rO | j j rO x* | j D] } | j s, Pq, q, Wt | _ n  | S(   N(   R3   R~  R  R  R2   (   R   R   t   clause(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_IfStatNode  s    	c         C@  sX   |  j  |  | j j rT | j rT |  j d rH t | j j d d  n  d  | _ n  | S(   Ns   warn.unreachables   Unreachable codei   (   R3   RK   R  R~  R  R   R6   R!   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_TryExceptStatNode  s    (   R#   R$   R;   R  R  R  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s   			
RM   c           B@  sb   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   c         C@  s;   t  t |   j   g  |  _ g  |  _ g  |  _ t |  _ d  S(   N(   R   RM   R   RO   RP   R~  R.   t   has_return_value(   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s
    			c         C@  s   |  j  |  d  S(   N(   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR"     s    c         C@  s!   |  j  j |  |  j |  d  S(   N(   RO   R   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_YieldExprNode  s    c         C@  s!   |  j  j |  |  j |  d  S(   N(   RP   R   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_AwaitExprNode  s    c         C@  s6   |  j  |  | j r" t |  _ n  |  j j |  d  S(   N(   R3   RF   R2   R  R~  R   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ReturnStatNode  s    	c         C@  s   d  S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s    c         C@  s   d  S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    c         C@  s   d  S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRX   	  s    c         C@  s   d  S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRZ   	  s    c         C@  s   d  S(   N(    (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CArgDeclNode	  s    (   R#   R$   R   R"   R  R  R  R  R   RX   RZ   R  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRM     s   									t   MarkClosureVisitorc           B@  s5   e  Z d    Z d   Z d   Z d   Z d   Z RS(   c         C@  s   t  |  _ |  j |  | S(   N(   R.   t   needs_closureR3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR	  	  s    	c   	      C@  s  t  |  _ |  j |  |  j | _ t |  _ t   } | j |  | j ry | j rm t | j d j d  n  | j	 } n< | j r | j	 r t | j d j d  n  | j } n | Sx& t
 | d  D] \ } } | | _ q Wx | j D] } t | _ q Wt j d | j d | j d | j  } | j r4t j n t j d | j d | j d | j d	 | j d
 | j d | j d | j d | d | j  	} | S(   Ni    s5   'yield' not allowed in async coroutines (use 'await')s/   'await' not allowed in generators (use 'yield')i   R6   RG   RK   RH   RI   RJ   RL   RM  R	  t   lambda_name(   R.   R  R3   R2   RM   t   is_async_defRO   R   R6   RP   R   t	   label_numR~  t   in_generatorR   t   GeneratorBodyDefNodeRG   RK   t   AsyncDefNodet   GeneratorDefNodeRH   RI   RJ   RL   RM  R  (	   R   R   RW   RO   R   t
   yield_exprt   retnodeR	  t	   coroutine(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   	  s6    								c         C@  sT   t  |  _ |  j |  |  j | _ t |  _ | j rP | j rP t | j d  n  | S(   Ns1   closures inside cpdef functions not yet supported(   R.   R  R3   R2   R}  R   R6   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CFuncDefNode7	  s    		c         C@  s/   t  |  _ |  j |  |  j | _ t |  _ | S(   N(   R.   R  R3   R2   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRX   @	  s
    		c         C@  s   |  j  |  t |  _ | S(   N(   R3   R2   R  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  G	  s    	(   R#   R$   R	  R   R  RX   R  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  	  s
   		"			t   CreateClosureClassesc           B@  sS   e  Z d    Z d   Z d   Z d d  Z d   Z d   Z d   Z	 d   Z
 RS(	   c         C@  s,   t  t |   j |  g  |  _ t |  _ d  S(   N(   R   R  R   t   pathR.   R  (   R   R1   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   Q	  s    	c         C@  s   | j  |  _ |  j |  | S(   N(   R  R  R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR	  V	  s    c         C@  sw   g  } g  } x^ | j  j j   D]J \ } } | j rJ | j | | f  q | j r | j | | f  q q W| | f S(   N(   R  R  R   t   from_closureR   t
   in_closure(   R   R   R  R  RG   R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   find_entries_used_in_closures[	  s    		c         C@  s  | j  r> x2 | j j j   D] } | j s t | _ q q Wn  |  j |  \ } } | j   t	 | _
 t	 | _ | j } | j j } x | j s | j r | j } q W| r |  j s | r | s | j s t d   n  | j } n  t	 | _ t	 | _ n  | j  rn: | r| rd  S| sAt | _ | j | _ t | _ d  Sd | j t j  | j j f }	 | j d |	 d | j d t d t  } t | j _ | | _ | j j }
 t |
 _ t  j! rt  j! |
 j" d <n  | r(| j# st$  |
 j% d | j d t j& d t j& d	 | j j d
 t  t | _ n  x_ | D]W \ } } |
 j% d | j d | j' d | j d	 | j d
 t  } | j( r/d | _( q/q/Wt | _
 | j) | j  d  S(   Ns%   DefNode does not have assignment nodes   %s_%sRG   R6   t   definingt   implementingt   freelistR  R=  t   is_cdefi   (*   R  R  R  t   valuesR  R2   R  R  t   sortR.   R  t   needs_outer_scopeR  R  R  R  R  R  R  R   t   needs_self_codet   is_passthrought   scope_classt   next_idR   t   closure_class_prefixR  t   declare_c_classR6   R=  t   is_final_typet   is_internalR   t   closure_freelist_sizeR   R  R?  R  t   outer_scope_cnameRG   t   is_declared_generict   check_c_class(   R   R   t   target_module_scopet
   inner_nodeR  R  R  t
   func_scopet   cscopeR  t   class_scopeRG   t   closure_entry(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   create_class_from_scopee	  st    		
																					c         C@  s^   t  | j t j  s | S|  j } t |  _ |  j | j |  j |  |  j |  | |  _ | S(   N(	   RQ   RV   R   RU   R  R2   R  R  R3   (   R   R   t   was_in_lambda(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRX   	  s    			c         C@  sp   |  j  r |  j |  | S| j s, |  j rl |  j | |  j  |  j j |  |  j |  |  j j   n  | S(   N(   R  R3   R  R  R  R  R   R  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   	  s    	c         C@  s   |  j  |  | S(   N(   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  	  s    c         C@  s+   | j  s |  j |  S|  j |  | Sd  S(   N(   R}  R   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  	  s    	N(   R#   R$   R   R	  R  R!   R  RX   R   R  R  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  M	  s   			
H			t   GilCheckc           B@  sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   s,  
    Call `node.gil_check(env)` on each node to make sure we hold the
    GIL when we need it.  Raise an error when on Python operations
    inside a `nogil` environment.

    Additionally, raise exceptions for closely nested with gil or with nogil
    statements. The latter would abort Python.
    c         C@  s7   | j  g |  _ t |  _ t |  _ t t |   j |  S(   N(   R  t	   env_stackR.   RZ  t   nogil_declarator_onlyR   R  R   (   R   R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   	  s    		c         C@  s   |  j  j | j  |  j } | j j |  _ |  j r@ t |  _ n  |  j re | j re | j | j  n  |  j |  t |  _ |  j  j	   | |  _ | S(   N(
   R  R   R  RZ  R2   R  t   nogil_checkR3   R.   R  (   R   R   t	   was_nogil(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   	  s    				c         C@  s   |  j  r | j r | j   n  |  j  } | j d k |  _  | |  j  k r |  j r | sl t | j d  q t | j d  n  t | j t j	  r | j j
 \ | _ n  |  j |  | |  _  | S(   NRZ  s3   Trying to acquire the GIL while it is already held.s;   Trying to release the GIL while it was previously released.(   RZ  R  R\  R  R   R6   RQ   R   R   R8   R7   R3   (   R   R   R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_GILStatNode	  s    		c         C@  s   | j  r= t | _  t j | j d d d | } |  j |  S|  j  sZ t | j d  d  S| j |  j	 d  |  j
 |  | S(   NR\  RZ  RK   s)   prange() can only be used without the GILi(   RZ  R.   R   R^  R6   R  R   R!   R  R  R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ParallelRangeNode
  s    			c         C@  sN   |  j  s t | j d  d  S| j r= | j |  j d  n  |  j |  | S(   Ns5   The parallel section may only be used without the GILi(   RZ  R   R6   R!   R  R  R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ParallelWithBlockNode
  s    		c         C@  sL   |  j  s t | t j  r) |  j |  Sd | _ t | _ |  j	 |  | S(   sM   
        Take care of try/finally statements in nogil code sections.
        N(
   RZ  RQ   R   R^  R"   R!   R  R2   t   is_try_finally_in_nogilR3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_TryFinallyStatNode,
  s    		c         C@  sO   |  j  r2 |  j r2 | j r2 | j |  j  d  n  |  j |  |  j | _ | S(   Ni(   R  RZ  R  R3   t   in_nogil_context(   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR"   8
  s
    (
   R#   R$   R%   R   R   R  R  R  R  R"   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  	  s   							t   TransformBuiltinMethodsc           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(   sQ   
    Replace Cython's own cython.* builtins by the corresponding tree nodes.
    c         C@  s"   | j  r d  S|  j |  | Sd  S(   N(   t   declaration_onlyR!   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR{   E
  s    	c         C@  s   |  j  |  |  j |  S(   N(   R3   t   visit_cython_attribute(   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyRr  L
  s    c         C@  s   |  j  |  S(   N(   R  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   P
  s    c         C@  s$  | j    } | r | d k r9 t j | j d t } q | d k rv d d l m } t j | j d t |  } q | d k r t j	 | j  } q | d k r t j
 | j d
 t |  d |  j   j   j |  } q t j |  r q |  j j j |  r	q t | j d |  n  | S(   Nu   compiledRF   u   __version__i   (   t   __version__u   NULLu   setu	   frozensetu   staticmethodRG   R  u>   '%s' not a valid cython attribute or is being used incorrectly(   u   setu	   frozensetu   staticmethod(   R*  R   R8  R6   R2   R   R  R<  R
   t   NullNodeRs   R  t   builtin_scopeR  R   R  R1   t   cython_scopet   lookup_qualified_nameR   (   R   R   Rq  t   version(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  S
  s$    !!c         C@  s   |  j    } |  j |  t | j  d k r | j j t j | j   | j s | j j t j	 | j |  j
   |   q n  | S(   Ni   (   R  R3   R   RH   R   R   t   GlobalsExprNodeR6   R  t   LocalsExprNodet   current_scope_node(   R   R   R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_ExecStatNodeh
  s    		c         C@  s  |  j    } | j |  } | r% | S| j } | d k r | d k r| t | j  d k r| t |  j d t | j   | S| d k r t | j  d k r t |  j d t | j   n  t | j  d k r | Sn  t j | |  j   |  St | j  d k r't |  j d t | j   n  t | j  d k r@| S| j	 sR| j
 r| j	 r||  j   } t j | j  } n t j |  } t j |  St d   | j j   D  } g  | D] }	 t j | d	 |	 ^ q}
 t j | d
 |
 Sd  S(   NRF  t   varsi    sG   Builtin 'locals()' called with wrong number of args, expected 0, got %di   sG   Builtin 'vars()' called with wrong number of args, expected 0-1, got %dsF   Builtin 'dir()' called with wrong number of args, expected 0-1, got %dc         s@  s!   |  ] } | j  r | j  Vq d  S(   N(   RG   (   t   .0R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pys	   <genexpr>
  s    RF   RH   (   s   localss   vars(   R  R  R6   R   RH   R   R   R  R  R  R  R  R,  R  t   SortedDictKeysNodeR  R  R  t   IdentifierStringNodeR   (   R   R   t	   func_nameR  R  R6   Rc   t   locals_dictt   local_namesR  R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   _inject_localss
  s@    	!	%c         C@  sn   |  j  |  | j d k rj t | j t j  rj | j j } t | t j  r[ | j } n  | | _ qj n  | S(   Nt   not_in(   R3   Rh  RQ   Rj  R   R  R   t   NoneCheckNode(   R   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_PrimaryCmpNode
  s    c         C@  s   |  j  |  S(   N(   R  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_CascadedCmpNode
  s    c         C@  s   |  j    } | j |  } | s6 t | j  d k r: | S| j j t j | j   | j s | j j t j	 | j |  j
   |   n  | S(   Ni   (   R  R  R   RH   R   R   R  R6   R  R  R  (   R   R   R  R  R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   _inject_eval
  s    		c         C@  s@  |  j    } | j |  } | s* | j r. | S|  j   } t | t j  sl | j sl t |  j  d k  rp | S|  j d \ } } | j	 r t
 | _ t
 | j _ t j | j d | j t j | j d | j d j g | _ nX | j r<t j | j d | j j d | j t j | j d | j d j g | _ n  | S(   Ni   iR  RG   i    R  (   R  R  RH   R  RQ   R   RU   R   R  R  R2   t   requires_classobjt
   class_cellt	   is_activeR   t   ClassCellNodeR6   R  Rs   RG   R  R  R  (   R   R   R  R  R  RV   t
   class_nodeR  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   _inject_super
  s*    		+		+c         C@  s2  | j  j   } | r| t j k r| t | j  d k rS t | j  j d |  qt j | | j  j d | j d } q| t j k r t | j  d k r t | j  j d |  qt j | | j  j d | j d d | j d } q| d	 k rt | j  d k r't | j  j d
  q| j d j	 |  j
    } | rzt j | j  j d | d | j d d t } qt | j d j d  q| d k r0t | j  d k rt | j  j d  q| j d j	 |  j
    } | rt j | j  j d | } qt j | j  j d | j d } q| d k rt | j  d k rgt | j  j d  qt j | j  j d | j d | j d  } t | _ q| d k rt | j  d k rt | j  j d  qt j | j  j d | j d | j d  } t | _ q| d k r>t j | j d t d  | _  q| d k rnt j | j d t d  | _  q|  j j j |  rqt | j  j d |  n  |  j |  t | t j  r.| j  j r.| j  j } | d" k r|  j | |  S| d  k r|  j | |  S| d! k r.|  j | |  Sn  | S(#   Ni   u   %s() takes exactly one argumentR  i    i   u    %s() takes exactly two argumentsRi  Rj  u   castuD   cast() takes exactly two arguments and an optional typecheck keywordR=  t	   typechecks
   Not a typeu   sizeofu#   sizeof() takes exactly one argumentt   arg_typet   cmodu"   cmod() takes exactly two argumentst   %t   cdivu"   cdiv() takes exactly two argumentst   /u   setRG   R   u   staticmethodR   u*   '%s' not a valid cython language constructt   dirRF  R  t   evalR   (   s   dirs   localss   vars(    R)  R*  R   Re  R   RH   R   R6   Rg  R  R  R   t   TypecastNodeR.   t   SizeofTypeNodet   SizeofVarNodeRn  R2   t	   cdivisionRs   R
   R1   R  R  R3   RQ   R  R   RG   R  R  R  (   R   R   R)  R=  R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_SimpleCallNode
  sp    

,
+%,,$$c         C@  s!  | j  j   } | r| j j } | j j d   } | d k rt |  d k s t |  d k s t |  d k r d | k r t | j  j	 d  q| d j
 |  j    } | r | j d t  } t j | j  j	 d | d | d d | } qt | d j	 d	  qn  |  j |  | S(
   Nu   casti   i   R  uD   cast() takes exactly two arguments and an optional typecheck keywordi    R=  R  s
   Not a type(   R)  R*  Ru  RH   Rv  R  R!   R   R   R6   R  R  Ro   R.   R   R  R3   (   R   R   R)  RH   Rs  R=  R  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   visit_GeneralCallNode  s"    $
((   R#   R$   R%   R{   Rr  R   R  R  R  R  R  R  R  R  R  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  @
  s   						'					Ft   ReplaceFusedTypeChecksc           B@  s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   s0  
    This is not a transform in the pipeline. It is invoked on the specific
    versions of a cdef function with fused argument types. It filters out any
    type branches that don't match. e.g.

        if fused_t is mytype:
            ...
        elif fused_t in other_fused_type:
            ...
    c         C@  sB   t  t |   j   | |  _ d d l m } | d t  |  _ d  S(   Ni   (   t   ConstantFoldingt
   reevaluate(   R   R  R   R  t   OptimizeR   R2   R  (   R   R  R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR   9  s    	c         C@  s   |  j  |  |  j |  S(   sc   
        Filters out any if clauses with false compile time type check
        expression.
        (   R3   R  (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  @  s    c         C@  s  | j  j |  j  } | j j |  j  } | r| rt j | j d t } t j | j d t } |  j	 | | j  j  } | j
 } | d
 k r |  j	 | | j j  } | j |  } | d k } | r | s | r| r| Sn | d k rt | t j  r| j } n  | j r0t | j  j d  q| j sOt | j j d	  qt j |  }	 x4 |	 D], }
 | j |
  re| d k r| S| SqeqeW| d k r| Sn  | S| S(   NRF   t   ist   is_nots   ==s   !=t   inR  s   Type is fuseds-   Can only use 'in' or 'not in' on a fused type(   s   iss   is_nots   ==s   !=(   s   iss   ==(   s   ins   not_in(   Ri  R  R  Rj  R   R8  R6   R.   R2   t   specialize_typeRh  t   same_asRQ   R   t   CTypedefTypet   typedef_base_typeR  R   t   get_specialized_types(   R   R   t   type1t   type2t
   false_nodet	   true_nodet   opt   is_samet   eqt   typest   specialized_type(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  H  s>    			
c         C@  s=   y | j  |  j j  SWn t k
 r8 t | d  | SXd  S(   Ns   Type is not specific(   t
   specializeR  t   fused_to_specifict   KeyErrorR   (   R   R=  R6   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  y  s
    c         C@  s   |  j  |  | S(   N(   R3   (   R   R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR"     s    (   R#   R$   R%   R   R  R  R  R"   (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR  .  s   
			1	t   DebugTransformc           B@  sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   s9   
    Write debug information for this Cython module.
    c         C@  sS   t  t |   j |  t   |  _ |  j j |  _ | j |  _	 g  |  _
 t |  _ d  S(   N(   R   R  R   R   t   visitedR1   t   gdb_debug_outputwritert   tbt   c_filet   c_output_filet   nested_funcdefsR.   t   register_stepinto(   R   R1   t   optionsR   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    	c         C@  s`  | j  |  j _ t d | j  d | j d j d |  j  } |  j j d |  |  j j d  |  j |  x |  j	 D] } |  j
 |  qt Wt |  _ |  j |  t |  _ |  j j d  |  j j d  i  } xl | j j j   D]X \ } } | j |  j k r | j j d  r | j j r | j j r | | | <q q W|  j |  |  j j d  | S(	   NR  t   filenamei    t
   c_filenamet   Modulet	   Functionst   Globalst   __pyx_(   t   full_module_nameR  R  R,  R6   R   R  t   startR3   R  R   R2   R  t    serialize_modulenode_as_functionR.   t   endR  R  R   R  R  RG   R  R=  R  t   is_extension_typet   serialize_local_variables(   R   R   t   attrst   nested_funcdefR  t   kt   v(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR	    s2    			c         C@  s  |  j  j | j j  t | d t  r, | S|  j rI |  j j |  | S| j	 d  k ra d } n | j	 j j } t d | j j p t | d d  d | j j d | d | j j d t | j d	   } |  j j d
 d | |  j j d  |  j | j j  |  j j d  |  j j d  x: | j j D], } |  j j | j  |  j j | j  q.W|  j j d  |  j j d  t |  _ |  j |  t |  _ |  j j d  |  j j d
  | S(   Nt
   is_wrapperR   RG   s	   <unknown>R  t   pf_cnameR  t   linenoi   t   FunctionR,  t   Localst	   Argumentst   StepIntoFunctions(   R  R   R  R  R  R.   R  R  R   R  R!   R  t
   func_cnameR,  RG   R;  R6   R  R'  R+  R  R)  t   arg_entriesR2   R3   (   R   R   R1  R,  R   (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s>    				c         C@  s   |  j  r | j d  k	 r | j j r t | d t  r | j j d  k	 r t d | j j  } |  j	 j
 d d | |  j	 j d  n  |  j |  | S(   Nt	   is_calledRG   t   StepIntoFunctionR,  (   R  R=  R!   R  R  R.   R  R7  R,  R  R'  R)  R3   (   R   R   R,  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR     s    	c         C@  s   | j  j d  d } d | } d | } t d | d | d d d	 d d
 d d d  } t | d | } |  j | |  |  j | |  d S(   s   
        Serialize the module-level code as a function so the debugger will know
        it's a "relevant frame" and it will know where to set the breakpoint
        for 'break modulename'.
        R  it   initt   PyInit_RG   R  R1  R   R  R2  t   1t   is_initmodule_functionR2   N(   R&  t
   rpartitionR,  t!   _serialize_modulenode_as_function(   R   R   RG   t	   cname_py2t	   cname_py3t	   py2_attrst	   py3_attrs(    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR(     s    

	c         C@  s   |  j  j d d | |  j  j d  |  j | j j  |  j  j d  |  j  j d  |  j  j d  |  j  j d  t |  _ |  j |  t	 |  _ |  j  j d  |  j  j d  d  S(   NR3  R,  R4  R5  R6  (
   R  R'  R+  R  R  R)  R2   R  R3   R.   (   R   R   R,  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR@    s    		c         C@  s>  x7| j    D])} | j s" q n  | j j r7 d } n d } | j r d t j | j j f } d | j j	 j
 | j j | j f } n= | j r d t j | j f } | j
 } n | j } | j
 } | j s d } n t | j d  } t d | j d | d	 | d
 | d |  } |  j j d |  |  j j d  q Wd  S(   Nt   PythonObjectt   CObjects   %s->%ss   %s.%s.%st   0i   RG   R  R  R=  R2  t   LocalVar(   R  R  R=  R5  R  R   t   cur_scope_cnamet   outer_entryR  R  R  RG   R  R6   R;  R,  R  R'  R)  (   R   R  R  t   vartypeR  t   qnameR2  R,  (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR+  -  s:    													(
   R#   R$   R%   R   R	  R   R   R(  R@  R+  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyR    s   		(	,			(D   t
   __future__R    t   cythonR   RO  R   R   R   R   R   R   R   R   t   VisitorR   R   R   R   R   R   R   R   R	   t   StringEncodingR
   R   t   ErrorsR   R   R   R   t   CodeR   R   R&   R-   RA   Rq   R]   Rp   RB   R   R   R   R   R   R   R   Rh  R  R  R  R  R  RI  RV  R]  R_  Rx  R  R  RM   R  R  R  R  R  R  (    (    (    sF   /bar/jli/Chip-seq/script/cython/Cython/Compiler/ParseTreeTransforms.pyt   <module>   sp   !"L	.	!		E	$8 Cw/& F&<>F),?pW