
    Ng/	                        d dl mZ d dlZ ej        di 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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ed ed!ed"ed#ed$ed%ed&ej         d dlZd dlZd dlZd dl	Z
d dlZd'd(lmZmZmZmZmZmZmZmZ d'd)lmZmZ d'd*lmZ d'd+lmZ d'd,lmZ d'd-lmZmZmZ d'd.lmZ d'd/lm Z m!Z!m"Z"m#Z# d'd0lm$Z$ d'd1l%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z3m4Z4 d'd2lm%Z% d'd3lm5Z5 d4d5lm6Z6 d'd6l7m8Z8 d'd7lm9Z9 d4d8l:m;Z; d'd9l<m=Z=m>Z> d'd:l?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZN d'd;lmOZO 	 d d<lPmQZQ eReSfZTn# eU$ r	 eVZQeReVfZTY nw xY wejW        d          d=k    rd>ZXeYZZnd?ZXeYe[fZZ G d@ dAe          Z\ e\            Z] e            Z^i e+e,fdBe+e-fdCe+ej_        fdDe+ej`        fdDe+eja        fdDe+ejb        fdDe-e+fdEe-e,fdFe-e/fdGe-ejc        fdHe-ejd        fdHe/e-fdIe,e+fdJe,e-fdKe,ej_        fdLe,ej`        fdLe,eja        fdLe,ejb        fdLe,ejc        fdMe,ejd        fdMej_        e+fdNej`        e+fdNeja        e+fdNejb        e+fdNiZedO ZfdP ZgdQ ZhddRZidS ZjdT ZkdU ZldV ZmdW ZndX Zo G dY dZe          Zp G d[ d\ep          Zq G d] d^eq          Zr G d_ d`er          Zs G da dber          Zt G dc ddeq          Zu G de dfeu          Zv G dg dheu          Zw G di djeu          Zx G dk dleu          Zy G dm dneu          Zzdo Z{ G dp dqeu          Z| G dr dseu          Z} G dt duer          Z~ G dv dwe~          Z G dx dyeq          Z G dz d{eq          Z G d| d}eq          Z G d~ dep          Z G d dep          Z G d dep          Z G d de          Z G d dep          Z G d deq          Z G d de          Z G d deq          Z G d dep          Z G d deq          Z G d dep          Z G d de          Z G d dep          Z G d dep          Z G d dep          Z G d deq          Z G d deq          Z G d dep          Z G d de          Z G d de          Z G d de          Z G d de          Z G d dep          Z G d de          Z G d de          Z G d dep          Z G d dep          Z G d de          Z G d dep          Z G d de          Z G d dep          Z G d de          Z G d de          Z G d dep          Z G d de          Z G dĄ de          Z G dƄ de          Z G dȄ dep          Z G dʄ dep          Z G d̄ dep          Z G d΄ dep          Z G dЄ dep          Z G d҄ de          Z G dԄ de          Z G dք de          Z G d؄ de          Z G dڄ de          Z G d܄ dep          Z G dބ dep          Z G d dep          Z G d dep          Z G d dep          Z G d dep          Z G d de          Z G d depe          Z G d dep          Z G d dep          Z G d depe          Z G d dep          Z G d dep          Z G d depe          Z G d de          Z G d dep          Z G d dep          Z G d dep          Z G d  de          Z G d de          Z G d de          Z G d deƦ          Z G d d	ep          Z G d
 deȦ          Z G d deɦ          Z G d deɦ          Z G d de˦          Z G d deq          Z G d de          Z G d de          Z G d deq          ZАd Zej        ej        ej        ej        dZ G d dep          Z G d deצ          Z G d  d!eצ          Z G d" d#eצ          Z G d$ d%eצ          Z G d& d'eצ          Z G d( d)eܦ          Z G d* d+eܦ          Zސd, Z G d- d.eܦ          Zeeeېd/Zd0 Z G d1 d2ep          Zd3Zd4Zd5Zd6Zd7Z G d8 d9ep          Z G d: d;ep          Z G d< d=e          Z G d> d?e          Z G d@ dAep          Z G dB dCep          Z	 ej        Zn# e$ r dD ZY nw xY wi dEej        dFej        dGej        dHej        dIej        dJej        dKej        dLej        dMej        dNej        dOej        dPej        dQej        dRej        dSej         dTej        dUej        ej        ej        ej        edV dW dXZdY Z G dZ d[ep          Z G d\ d]e          Z	d^ Z
 G d_ d`e          Z G da dbe          Z G dc dde          Z G de dfe          Z G dg dhe          Z G di dje          Z G dk dle          Z ej        dm          j        Z eh dn          Z G do dpe          Z G dq dre          Z G ds dtep          Z G du dvep          Z G dw dxep          Zdydzd{d|d|d}d~d{d|d	Z G d de          Z G d depe          Z G d dee          ZeeeeeeeeeeeeeeedZ ddZ! G d dep          Z" G d de"          Z# G d de"          Z$ G d de"          Z% G d de"          Z& G d de"          Z' G d de'          Z( G d de"          Z) G d de"          Z* G d de"          Z+d Z, G d de"          Z- G d de"          Z. G d de"          Z/ G d de"          Z0 G d de/          Z1 G d dep          Z2 G d dep          Z3 G d dep          Z4 G d dep          Z5dS (      )absolute_importNerrorwarning	warn_onceInternalErrorCompileErrorUtilityCodeTempitaUtilityCodeStringEncodingoperatorlocal_errorsreport_errorNamingNodes
PyrexTypespy_object_type	list_type
tuple_typeset_type	dict_typeunicode_typestr_type
bytes_type	type_typeBuiltinSymtabUtilsfind_coercion_errordebug_disposal_codedebug_temp_allocdebug_coercionbytearray_type
slice_typememoryview_typebuiltin_sequence_types_py_int_types
IS_PYTHON3   )r   r   r   r   r   r   CannotSpecializeperformance_hint)r	   r
   )r   )r   )r   )Nodeutility_code_for_importsSingleAssignmentNode)r   )r   typecast
error_typeunspecified_type)	TypeSlots)r   r   r   r   r   r   r   r   r"   basestring_typer#   	long_typesequence_typesr$   )r   )r      )r   )AnnotationItem)Future)print_call_chain)r   r!   )
to_pythranis_pythran_supported_type#is_pythran_supported_operation_typeis_pythran_exprpythran_func_typepythran_binop_typepythran_unaryop_typehas_np_pythranpythran_indexing_codepythran_indexing_type!is_pythran_supported_node_or_nonepythran_typepythran_is_numpy_func_supportedpythran_get_func_include_filepythran_functor)PythranExpr)
basestring   TFc                   (     e Zd ZdZ fdZd Z xZS )NotConstantNc                     t           j        2t          t           |                               |           t           _        t           j        S N)rL   _objsuper__new__)cls	__class__s    U/var/www/html/ai-engine/env/lib/python3.11/site-packages/Cython/Compiler/ExprNodes.pyrQ   zNotConstant.__new__O   s5    #$[#66>>sCCK    c                     dS )Nz<NOT CONSTANT> selfs    rT   __repr__zNotConstant.__repr__U   s    rU   )__name__
__module____qualname__rO   rQ   rZ   __classcell__rS   s   @rT   rL   rL   L   sL        D                      rU   rL   zgCannot convert Unicode string to 'str' implicitly. This is not portable and requires explicit encoding.zGCannot convert Unicode string to 'bytes' implicitly, encoding required.z5Unicode objects only support coercion to Py_UNICODE*.zFCannot convert 'bytes' object to unicode implicitly, decoding requiredzMCannot convert 'bytes' object to str implicitly. This is not portable to Py3.zTCannot convert 'bytes' object to basestring implicitly. This is not portable to Py3.z<Cannot convert 'bytes' object to Py_UNICODE*, use 'unicode'.zMCannot convert 'basestring' object to bytes implicitly. This is not portable.zZstr objects do not support coercion to unicode, use a unicode string literal instead (u'')zACannot convert 'str' to 'bytes' implicitly. This is not portable.z@'str' objects do not support coercion to C types (use 'bytes'?).zB'str' objects do not support coercion to C types (use 'unicode'?).z?Cannot convert 'char*' to unicode implicitly, decoding requiredc                 L    t                                          }||S |j        d         rwt           fdt          j        t          j        t          j        t          j        fD                       r0 d         j	        r|S |j        d         dv r|S d d         j
        z  S |S )Nc_string_encodingc              3       K   | ]}|v V  	d S rN   rW   ).0t
type_tuples     rT   	<genexpr>z&find_coercion_error.<locals>.<genexpr>   s?       r ra!z/ r r r r r rrU   r(   )asciidefaultz_'%s' objects do not support coercion to C types with non-ascii or non-default c_string_encodingr   )coercion_error_dictget
directivesanyr   c_char_ptr_typec_uchar_ptr_typec_const_char_ptr_typec_const_uchar_ptr_typeis_pyobjectname)re   rh   enverrs   `   rT   r   r      s    

!
!*
-
-C
{
.,
- 
 r r r rJ,F
Hc,6,LjNo,q r r r r r
 a=$ 	JN^/04HHHNt  xB  CD  xE  xJ  J  J
rU   c                 t    t           t          t          t          d                    | j        d                   S )N)bytes	bytearraystrunicodec_string_type)r   r"   r   r   rj   rk   )rs   s    rT   default_str_typer{      s3    #	 
 
c#.
)**+rU   c                      | D ][}|4t          |j        t                    st          |j        t                    s9|j        dk     rt	          |j        dd           \dS )z
    Raise a warning on nodes that are known to have negative numeric values.
    Used to find (potential) bugs inside of "wraparound=False" sections.
    Nr   zfthe result of using negative indices inside of code sections marked as 'wraparound=False' is undefinedr(   level)
isinstanceconstant_resultr&   floatr   pos)nodesnodes     rT   check_negative_indicesr      s    
  	* 	*<t3]CC t3U;;  !##DH '(* * * *	* 	*rU   c                     |j         sc||                               }|t          u rC|j        r<t	          |j                  dk    r$	 |j        d         j        }n# t          $ r Y nw xY w||j         r|Y|                                rE	 |j        |j	                 }|                               S # t          t          t          f$ r Y nw xY w fd|j        D             }t	          |          dk    r|                                S d S )Nr(   r   c                 :    h | ]}|                               S rW   
infer_typerc   itemrs   s     rT   	<setcomp>z+infer_sequence_item_type.<locals>.<setcomp>   s%    EEEtdooc**EEErU   )is_sequence_constructorr   r   cf_statelenrhsAttributeErrorhas_constant_resultargsr   
ValueError	TypeError
IndexErrorpop)rs   seq_node
index_nodeseq_typer   
item_typess   `     rT   infer_sequence_item_typer      sC   + 	**3//Hz!!  S):%;%;q%@%@'037HH%   D @!j&D&D&F&F!,}Z%?@ s+++ 	:6   
 FEEEx}EEE
z??a>>###4s$   	A 
A)(A)B3 3CCc                 H    d |D             }d|v rdS | t          |          fS )a  
    Recursively generate a deduplication key from a sequence of values.
    Includes Cython node types to work around the fact that (1, 2.0) == (1.0, 2), for example.

    @param outer_type: The type of the outer container.
    @param item_nodes: A sequence of constant nodes that will be traversed recursively.
    @return: A tuple that can be used as a dict key for deduplication.
    c                    g | ]}|t           d t          d           fn|j        r,t          |j        |j        r|j        nd g|j        z             n|j        r't          |j        |j        |j	        |j
        f          np|                                r1|j        |j        |j        t           u rt          |j                  nd fn+t          |t                    r|j        |j        |j        dfnd S )NIdentifierStringNode)r   typer   make_dedup_key
is_literalmult_factorr   is_slicestartstopstepr   r   r   r   valueunicode_value)rc   r   s     rT   
<listcomp>z"make_dedup_key.<locals>.<listcomp>   s        /3ltDzz**gk  hD 
^DIDO(U(8(8QU'VY]Yb'bcccNRm 	^DI
DIty'IJJJ W[VnVnVpVpdi-,0I,G,Gd4'(((TS S U__ceyTzTz diT%79OPP  rU   N)tuple)
outer_type
item_nodes	item_keyss      rT   r   r      sG        I  ytuY''''rU   c                     | dS | j         t          j        k    r| j        dk    rdS | j         j        rd| j        j        d| j        j        ddfS d| j        j        z  dfS )	N)__Pyx_CppExn2PyErr();F*)r   TzAtry { throw; } catch(const std::exception& exn) {PyErr_SetString(z+, exn.what());} catch(...) { PyErr_SetNone(z); }Fzc%s(); if (!PyErr_Occurred())PyErr_SetString(PyExc_RuntimeError, "Error converting c++ exception.");)r   r   c_char_typer   rq   entrycname)exception_values    rT   get_exception_handlerr      s    --

*"8
8
8#s**,,			)  
  %+++%+++	-
  	2  %+-  	rU   c                    |r|rX| j                             t          j        dd                     |                     |                     d|                     d S |                     |                     d|                     d S d S )NErrOccurredWithGILExceptions.c__Pyx_ErrOccurredWithGIL()PyErr_Occurred())globalstateuse_utility_coder	   load_cachedputlnerror_goto_if)codecheck_py_exceptionr   nogils       rT   maybe_check_py_errorr      s     D 	D--'(<nMMO O OJJt))*FLLMMMMMJJt))*<cBBCCCCCD DrU   c                 (   t          |          \  }}|                     d           |                     d|z             |r)|                     |                     ||                     t          | |||           |                     d           |r|                     d           |                     |           |r|                                  |                     |                     |                     |                     d           d S )Ntry {z%s} catch(...) {Tdeclare_gilstate})r   r   error_goto_if_nullr   put_ensure_gilput_release_ensured_gil
error_goto)r   r   inside	py_resultr   r   raise_py_exceptionr   s           rT   translate_cpp_exceptionr     s   -B?-S-S**JJwJJtf} <

4**9c::;;;13>>>JJ    3T222JJ!""" '$$&&&JJts##$$$JJsOOOOOrU   c                     | j         dk    sJ | j        dS | j        j        rdS t          | j        t                    r| j        j        dk    rdS dS )N+TFr   )exception_checkr   is_namer   CharNoder   )r   s    rT   needs_cpp_exception_conversionr     si    3&&&&#t # u$&11 d6J6PTW6W6Wt5rU   c                    t          |          \  }}	t          |          \  }
}|                     d           |                     |                    d|z                       t          | |	||           |                     d           |                     d|z             t          | |||           |                     d           |r|                     d           |                     |
           |r|                                  |                     |                     |                     |                     d           |                     d           |r|                     d           |                     |           |r|                                  |                     |                     |                     |                     d           d S )Nr   z__pyx_local_lvalue = %s;r   Tr   r   )r   r   declaration_coder   r   r   r   )r   r   lhs_typelhs_coderhs_codelhs_exc_valassign_exc_valr   handle_lhs_exclhc_check_py_exchandle_assignment_excassignment_check_py_excs               rT   translate_double_cpp_exceptionr   &  s   '<['I'I$N$5J>5Z5Z22JJwJJx(()Ch)NOOPPP/e<<<JJwJJ)H45556UCCCJJ    3T222JJ$%%% '$$&&&JJts##$$$JJsOOOJJ    3T222JJ~ '$$&&&JJts##$$$JJsOOOOOrU   c                      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dZdZdZdZdZdZdZdZdZdZdZdZdZeZ e eedd          dd          dk    r e  e!j"        d                    Z#ne d	             Z#d
 Z$d Z%d Z&d Z'd Z(d Z)d Z*d_dZ+d Z,d Z-d`dZ.d Z/d`dZ0d Z1d Z2d Z3d Z4d Z5d Z6d Z7d Z8d Z9d  Z:d! Z;d" Z<d# Z=d$ Z>d% Z?d& Z@d' ZAdad)ZBd* ZCd+ ZDd, ZEd- ZFd. ZGd/ ZHd0 ZId1 ZJd2 ZKd3 ZLd4 ZMd5 ZNd6 ZOd7 ZPd8 ZQd9 ZRd: ZSd; ZTd< ZUd= ZVd> ZWd? ZXd@ ZYdA ZZdB Z[	 	 dbdCZ\d_dDZ]dE Z^dF Z_dG Z`dH ZadI Zb	 	 dcdJZcdK ZddL ZedM ZfdN ZgdO ZhdP ZidddQZjdR ZkdS ZldT ZmdU ZndV ZodW ZpdX ZqdY Zrded\Zsetd]             Zud^ ZvdS )fExprNodeNTFimplementationrr   cpythonsubexprs)fgetc                     | j         S rN   )r   rX   s    rT   child_attrszExprNode.child_attrs  s
    = rU   c                     d S rN   rW   rY   rs   s     rT   analyse_annotationszExprNode.analyse_annotations      rU   c                 `    t          |d           t          | j        j        d|d          )Nznot implemented.z not implemented)r8   r   rS   r[   )rY   method_names     rT   not_implementedzExprNode.not_implemented  s?    &7888'+~'>'>'>LN N 	NrU   c                     dS Nr   rW   rX   s    rT   	is_lvaluezExprNode.is_lvalue      qrU   c                 D    |                                  o| j        j         S rN   )r   r   is_memoryviewslicerX   s    rT   is_addressablezExprNode.is_addressable  s    ~~D	(D$DDrU   c                 (    | j         j        o| j        S rN   )r   rq   is_temprX   s    rT   is_ephemeralzExprNode.is_ephemeral  s     y$55rU   c                     g }| j         D ]U}t          | |          }|At          |          t          u r|                    |           @|                    |           V|S rN   )r   getattrr   listextendappend)rY   r   rr   r   s       rT   subexpr_nodeszExprNode.subexpr_nodes  sm     M 	' 	'D4&&D::%%LL&&&&LL&&&rU   c                 F    | j         r| j        S |                                 S rN   )r   	temp_codecalculate_result_coderX   s    rT   resultzExprNode.result  s(    < 	0
 >!--///rU   c                     |r!| j         r| j        j        r| j        j        r|S d| _        d                    |rdnd|          S )NTz{}({})__PYX_STD_MOVE_IF_SUPPORTEDz	std::move)r   r   is_cpp_classis_referencehas_temp_movedformat)rY   r  optionals      rT   _make_move_result_rhszExprNode._make_move_result_rhs  sX     	T\ 	di.D 	TYMc 	M"Y<<k[abbbrU   c                 T    |                      |                                 d          S )NTr  )r  r  rX   s    rT   move_result_rhszExprNode.move_result_rhs  s#    ))$++--$)GGGrU   c                     |                      |          }|j        s-|j        s&|j        o| j        }|                     ||           }|S )Nr  )	result_asr  needs_refcountingis_rvalue_referencer   r  )rY   r   r  requires_moves       rT   move_result_rhs_aszExprNode.move_result_rhs_as!  sY    %%! 	TT%; 	T 4EM//]AR/SSFrU   c                 f    t          |           rt          |           S |J t          | |          S rN   )rC   r9   )rY   type_s     rT   pythran_resultzExprNode.pythran_result(  s<    ,T22 	$d###   $&&&rU   c                     dS )zZ
        Subtypes may return False here if result temp allocation can be skipped.
        TrW   rX   s    rT   is_c_result_requiredzExprNode.is_c_result_required/  s	     trU   c                     | j         r?| j        j        r3|t          k    r(t	          |t          |                                           S t	          ||                                 |                                           S rN   )r   r   rq   r   r.   r  ctyperY   r   s     rT   r  zExprNode.result_as5  sc    L 	ATY2 	A&& D.$++--@@@djjllDKKMM:::rU   c                 6    |                      t                    S rN   )r  r   rX   s    rT   r   zExprNode.py_result>  s    ~~n---rU   c                     | j         p| j        S rN   )result_ctyper   rX   s    rT   r   zExprNode.ctypeB  s      -DI-rU   c                     d S rN   rW   rX   s    rT   get_constant_c_result_codez#ExprNode.get_constant_c_result_codeG  s	     trU   c                     d S rN   rW   rX   s    rT   calculate_constant_resultz"ExprNode.calculate_constant_resultR  s	     	rU   c                 :    | j         t          uo| j         t          uS rN   r   constant_value_not_setnot_a_constantrX   s    rT   r   zExprNode.has_constant_result^  #    #+AA :#>9	:rU   c                 0    t          | j        d           d S )NzInvalid compile-time expressionr   r   rY   denvs     rT   compile_time_valuezExprNode.compile_time_valueb  s    dh9:::::rU   c                 P    t          | j        d|j        j        d|           d S )Nz"Error in compile-time expression: : )r   r   rS   r[   )rY   es     rT   compile_time_value_errorz!ExprNode.compile_time_value_errorf  s;    dhhK   !!% 	& 	& 	& 	& 	&rU   c                 0    t          | j        d           d S )NzCannot assign to or delete thisr/  r   s     rT   analyse_target_declarationz#ExprNode.analyse_target_declarationl  s    dh9:::::rU   c                 0    t          | j        d           d S )Nz=Cannot use anything except a name in an assignment expressionr/  r   s     rT   0analyse_assignment_expression_target_declarationz9ExprNode.analyse_assignment_expression_target_declarationo  s    dhWXXXXXrU   c                 X    |                      |          }|                                 |S rN   )analyse_typescheck_constrY   rs   r   s      rT   analyse_const_expressionz!ExprNode.analyse_const_expressiont  s.    
 !!#&&rU   c                 ,    |                      |          S rN   r<  r   s     rT   analyse_expressionszExprNode.analyse_expressions}  s     !!#&&&rU   c                 ,    |                      |          S rN   )analyse_target_types)rY   rs   r   s      rT   analyse_target_expressionz"ExprNode.analyse_target_expression  s     ((---rU   c                 Z    |                      |          }|                    |          }|S rN   )r<  coerce_to_boolean)rY   rs   r   bools       rT   analyse_boolean_expressionz#ExprNode.analyse_boolean_expression  s-    !!#&&%%c**rU   c                 |    |                      |          }|                    |                              |          S rN   )r<  rG  coerce_to_simpler>  s      rT   analyse_temp_boolean_expressionz(ExprNode.analyse_temp_boolean_expression  s9     !!#&&%%c**;;C@@@rU   c                     t          | dd           dS t          fd|                                 D             d          S )Nr   rW   c                 :    g | ]}|                               S rW   )type_dependencies)rc   r   rs   s     rT   r   z.ExprNode.type_dependencies.<locals>.<listcomp>  s'    QQQDD**3//QQQrU   )r   sumr  r   s    `rT   rO  zExprNode.type_dependencies  sN     4&&22QQQQD<N<N<P<PQQQSUVVVrU   c                     t          | dd           }||S t          | dd           }||j        S |                     d           d S )Nr   r   r   )r   r   r   rY   rs   r   r   s       rT   r   zExprNode.infer_type  sY    
 tVT**Kgt,,:\*****rU   c                 N    | j         p| j        p| j        j        p| j        j        S rN   )r   r   r   is_arrayis_cfunctionrX   s    rT   nonlocally_immutablezExprNode.nonlocally_immutable  s'     ^$,^$)2D^	H^^rU   r   c           
          t          | j        | t          | j        t          |          |t          j                            S )z
        Return a node that represents the (type) result of an indexing operation,
        e.g. for tuple unpacking or iteration.
        r   r   r   baseindex)	IndexNoder   IntNoderx   r   c_py_ssize_t_typerY   r[  s     rT   inferable_item_nodezExprNode.inferable_item_node  sM    
 GHCJJJD`5b 5b 5b c c c 	crU   c                     d S rN   rW   r   s     rT   analyse_as_modulezExprNode.analyse_as_module  	     trU   c                     d S rN   rW   r   s     rT   analyse_as_typezExprNode.analyse_as_type  rc  rU   c                     |                      |          }|r9|j        r2|j        r+	 |                    |j                  S # t          $ r Y nw xY w|r|j        rt          | j        d           |S )NzType is not specific)re  is_fusedfused_to_specific
specializeKeyErrorr   r   )rY   rs   r   s      rT   analyse_as_specialized_typez$ExprNode.analyse_as_specialized_type  s    ##C(( 	DM 	c&; 	s'<===    	4DM 	4$(2333s   A 
AAc                     d S rN   rW   r   s     rT   analyse_as_extension_typez"ExprNode.analyse_as_extension_type  rc  rU   c                 0    |                      d           d S )Nr<  r   r   s     rT   r<  zExprNode.analyse_types  s    _-----rU   c                 ,    |                      |          S rN   rA  r   s     rT   rD  zExprNode.analyse_target_types  s    !!#&&&rU   c                 \    | j         r"| j         j        r|                                  d S d S d S rN   )r   rq   	gil_errorr   s     rT   nogil_checkzExprNode.nogil_check  sD     9 	. 	NN	 	 	 	rU   c                 ^    |j         r#| j        j        rt          | j        d           d S d S d S )Nz3Assignment of Python object not allowed without gil)r   r   rq   r   r   r   s     rT   gil_assignment_checkzExprNode.gil_assignment_check  sK    9 	S. 	S$(QRRRRR	S 	S 	S 	SrU   c                 .    |                                   dS NF)	not_constrX   s    rT   r=  zExprNode.check_const  s    urU   c                 0    t          | j        d           d S )Nz$Not allowed in a constant expressionr/  rX   s    rT   rx  zExprNode.not_const  s    dh>?????rU   c                 .    |                                   dS rw  )addr_not_constrX   s    rT   check_const_addrzExprNode.check_const_addr  s    urU   c                 0    t          | j        d           d S )NzAddress is not constantr/  rX   s    rT   r{  zExprNode.addr_not_const  s    dh122222rU   c                     | j         S rN   r   rX   s    rT   result_in_tempzExprNode.result_in_temp  s    
 |rU   c                 *    |                                  S rN   r  rX   s    rT   target_codezExprNode.target_code  s    ))+++rU   c                 0    |                      d           d S )Nr  ro  rX   s    rT   r  zExprNode.calculate_result_code  s    455555rU   c                 T   | j         r$t          d| j        j        d| j                  | j        }|j        sg|j        rt          j	        }n+| j
        s$|j        s|                                 s	d | _         d S |j                            || j                  | _         d S d | _         d S )Nz!Temp allocated multiple times in r4  
manage_ref)r  RuntimeErrorrS   r[   r   r   is_voidrq   r   r   result_is_usedr   r  	funcstateallocate_tempuse_managed_ref)rY   r   r   s      rT   allocate_temp_resultzExprNode.allocate_temp_result  s    > 	p,DNLcLcLceiememnoooy| 		" !0) T-D HaHaHcHc !%!^99!5 : 7 7DNNN "DNNNrU   c                    | j         s| j        sd S | j        rMt          j                            | j        d                                                   f| j        dd          z   nd}| j        r't          d| j        d| j	        j
        d|          t          d| j	        j
        d|          |j                            | j                    | j         | _        d | _         d S )Nr   r(   z(?)ztemp z released multiple times in z at z"no temp, but release requested in )r  r  r   ospathbasenameget_descriptionold_tempr  rS   r[   r  release_temp)rY   r   r   s      rT   release_temp_resultzExprNode.release_temp_result  s    ~ 
	3& W[W_j27##DHQK$?$?$A$ABBDtxPQPRPR|SSejC} 3"lMMM4>#:#:#:CC$A B B B #lN+++SS$2 3 3 3##DN333rU   c                     |                                  s<|                    |                                 |                                            dS dS )z|
        Make sure we own a reference to result.
        If the result is in a temp, it is already a new reference.
        N)r  
put_increfr  r   rY   r   s     rT   make_owned_referencezExprNode.make_owned_reference/  sL    
 ""$$ 	9OODKKMM4::<<88888	9 	9rU   c                     |                                  s7|                    |                                 | j        | j                    dS dS )zJ
        Make sure we own the reference to this memoryview slice.
        have_gilN)r  put_incref_memoryviewslicer  r   in_nogil_contextr  s     rT   make_owned_memoryviewslicez#ExprNode.make_owned_memoryviewslice7  sh    
 ""$$ 	P++DKKMM499=9N5N , P P P P P	P 	PrU   c                 d   |                      |           |                    | j                   | j        r|                     |           |                     |           | j        rD| j        j        s:| j        j        s0| 	                    |           | 
                    |           d S d S d S d S rN   ) generate_subexpr_evaluation_codemark_posr   r   r  generate_result_coder   	is_stringis_pyunicode_ptrgenerate_subexpr_disposal_codefree_subexpr_tempsr  s     rT   generate_evaluation_codez!ExprNode.generate_evaluation_code@  s     	--d333dh< 	,%%d+++!!$'''< 	*!4 	*	8R 	* //555##D)))))		* 	* 	* 	* 	* 	*rU   c                 ^    |                                  D ]}|                    |           d S rN   )r  r  rY   r   r   s      rT   r  z)ExprNode.generate_subexpr_evaluation_codeQ  s>    &&(( 	0 	0D))$////	0 	0rU   c                 0    |                      d           d S )Nr  ro  r  s     rT   r  zExprNode.generate_result_codeU  s    344444rU   c                    | j         r-|j                            t          j        dd                     | j        r| j        j        s| j        j        r*| 	                    |           | 
                    |           |                                 rD|                    |                                 |                                 | j                    d S d S | 	                    |           d S )NMoveIfSupportedCppSupport.cppr  )r  r   r   r	   r   r   r   r  r  r  r  r  put_decref_clearr   r  r  s     rT   generate_disposal_codezExprNode.generate_disposal_codeX  s    	R--+,=?OPPR R R< 
	6y" .di&@ .33D999''---{{}} L%%dkkmmTZZ\\595J1J & L L L L LL L
 //55555rU   c                 ^    |                                  D ]}|                    |           d S rN   )r  r  r  s      rT   r  z'ExprNode.generate_subexpr_disposal_codeh  s@     &&(( 	. 	.D''----	. 	.rU   c                 d   | j         r| j        j        s| j        j        r+|                     |           |                     |           n| j        j        r+|                    d|                                 z             n`| j        j	        rT|                    d|                                 z             |                    d|                                 z             | j
        r/|j                            t          j        dd                     d S d S |                     |           d S )N%s = 0;z%s.memview = NULL;z%s.data = NULL;r  r  )r   r   r  r  r  r  rq   r   r  r   r  r   r   r	   r   r  s     rT   generate_post_assignment_codez&ExprNode.generate_post_assignment_coden  s<   < 	6y" >di&@ >33D999''----& >

9t{{}}45555- >

/$++--?@@@

,t{{}}<===" R 11+,=?OPPR R R R RR R //55555rU   c                     d S rN   rW   )rY   r   r   overloaded_assignmentr   r   s         rT   generate_assignment_codez!ExprNode.generate_assignment_code  s	    
 	rU   c                     d S rN   rW   rY   r   ignore_nonexistings      rT   generate_deletion_codezExprNode.generate_deletion_code  s	     	rU   c                     | j         r%| j        j        s|                     |           d S d S |                     |           d S rN   )r   r   r  r  r  r  s     rT   
free_tempszExprNode.free_temps  sY    < 	*9$ /((...../ / ##D)))))rU   c                 ^    |                                  D ]}|                    |           d S rN   )r  r  )rY   r   subs      rT   r  zExprNode.free_subexpr_temps  s<    %%'' 	! 	!CNN4    	! 	!rU   c                     d S rN   rW   rY   rs   r   s      rT   generate_function_definitionsz&ExprNode.generate_function_definitions  r   rU   c                 |    |                     |                                 |                                 |           d S rN   )put_decref_setr  r   rY   r   r   s      rT   generate_decref_setzExprNode.generate_decref_set  s0    DKKMM4::<<=====rU   c                 |    |                     |                                 |                                 |           d S rN   )put_xdecref_setr  r   r  s      rT   generate_xdecref_setzExprNode.generate_xdecref_set  s0    T[[]]DJJLL#>>>>>rU   c                     |r| j         s^|r | j        r|r|                     |           d S |                    |                                 |                                            d S d S rN   )
cf_is_nullcf_maybe_nullgenerate_xgotref
put_gotrefr  r   )rY   r   handle_nullmaybe_null_extra_checks       rT   generate_gotrefzExprNode.generate_gotref  s{     	= 	= = 2 =.=%%d+++++tzz||<<<<<	= 	=rU   c                 z    |                     |                                 |                                            d S rN   )put_xgotrefr  r   r  s     rT   r  zExprNode.generate_xgotref  .    

55555rU   c                 z    |                     |                                 |                                            d S rN   )put_giverefr  r   r  s     rT   generate_giverefzExprNode.generate_giveref  r  rU   c                 z    |                     |                                 |                                            d S rN   )put_xgiverefr  r   r  s     rT   generate_xgiverefzExprNode.generate_xgiveref  s.    $++--66666rU   c                 ^    |                                  D ]}|                    |           d S rN   )r  annotater  s      rT   r  zExprNode.annotate  s<    &&(( 	  	 DMM$	  	 rU   c                 J	   | }| j         }|                     ||          r| S |j        }|r|j        s|j        }|j        r|j        }|j        s|j        r|j        ru|j        sn|j        rg|j	        j        r[|j	        }|
                                D ]?}|                    |          r(||_         |j         j        |_        d|j        _        | c S @|j        rt          | j        d           n%|j        r	|j        r| S t          | j        d           t"          | _         | S | j        2t'          | j        d| j                  }|                    ||           |j        r)ddlm} |j         j        s~|j         j        rt3          |||          }n|j         j        r1t6                              ||                              ||          }n|j        st          | j        d|d	           n|j         j        rd|_        |j                             || j         | j!        
          s]|j         j"                            |j"                  rd}	|j         |f}
nd}	|j         j"        |j"        f}
t          | j        |	|
z             n|j        r|j#        rn|j$        *tK          |j                                      ||          }n|j         j        s8|tL          u r|j         j'        rtQ          ||          }ntS          |||          }|j         *                    |          stW          |||          }nftY          |          rt[          |j                   r|S tY          |j                   r%t[          |          r|S tS          |||          }n|j         j        r3|r|j.        rt_          | j        d|z             ta          |||          }n|j1        r-||k    r'|2                    |          rtg          |||          }n|th          j5        u r-||k    r'|2                    |          stm          |||          }nZ|j         |k    sOto          |j                   to          |          k    s*|2                    |          s| 8                    |           |S )NTzType is not specializedz/Cannot coerce to a type that is not specialized )rr   r   r(   
MemoryViewzCannot convert 'z' to memoryviewslice)	broadcastcopyingz3Memoryview '%s' not conformable to memoryview '%s'.z-Different base types for memoryviews (%s, %s)r   zTCannot pass Python object as C++ data structure reference (%s &), will pass by copy.)9r   check_for_coercion_errorr  ref_base_typeis_cv_qualifiedcv_base_typerg  rU  is_ptr	base_type"get_all_specialized_function_typessame_asr   usedr   r   is_null_ptrr/   coercion_typeNameNode	coerce_tor   r  r  rq   CoerceToMemViewSliceNoderT  CythonArrayNodefrom_carrayis_errorwritable_neededconforms_tois_memview_broadcastis_memview_copy_assignmentdtypeis_noner   NoneNoder   is_intCoerceIntToBytesNodeCoerceToPyTypeNode
subtype_ofPyTypeTestNoder<   r:   r  r   CoerceFromPyTypeNode
is_complexassignable_fromCoerceToComplexNoder   soft_complex_typecoerce_from_soft_complexrx   fail_assignment)rY   dst_typers   srcsrc_typeused_as_reference	signaturer   r  msgtups              rT   r  zExprNode.coerce_to  s<     9((377 	K$1 	.X%: 	.-H# 	-,H 	 1 	 % 
$h.? 
$O
$(0(:(G
$ $-!)!L!L!N!N $ $I ((22 $#,$'HN	)-	#	$   Sdh 9::::% S(/ Sdh QRRR"DIK)DH2D4FGGGDNN8S)))& I	/$$$$$$8. /8' R23#FFCCX& R)55c3??II(TWXXCC!* R$((FNhhPR R R 8+ 4/3H,x++H@Y484S , U U 	/x~--hn== =S!h0M!hnhn<$(C#I...! 1	/{ =$,sw''11(C@@x+ J:--#(/-23<<0cIII
 x**844 =(h<<CX&& 	/+DSX+N+N 	/JSX&& 	/(22  
$S#H===CCX! 	/  wX%: wHjmuuw w w 'xc::CC! 	/h&&**844 '%c8S99CC*666h&&..x88 '*3#>>CC H((CMMS]],J,JhNfNfgoNpNp,J$$X...
rU   c                    t          | d          r| j        j        nd }| j        j        r,d                    | j                                                  nd}|j        r'd                    |                                          nd}|                    | j        |          }|rd|z   }t          | j	        d| j        d|d|d||	           d S )Nr   z (alias of '{0}')r  z. zCannot assign type ''z to ')
hasattrr   rr   r   
is_typedefr  resolveassignment_failure_extra_infor   r   )rY   r	  src_namesrc_resolveddst_resolvedextra_diagnosticss         rT   r  zExprNode.fail_assignmentE  s    &-dG&<&<F4:??$JN)J^f*11$)2C2C2E2EFFFdfIQI\d*11(2B2B2D2DEEEbd$BB49hWW 	9 $'8 8dhh			<<<,,!!# 	$ 	$ 	$ 	$ 	$rU   c                     |r|sd}t          | j        |f||          }|"t          | j        || j        |dz             dS |r|                     |           dS dS )Nz)Cannot assign type '%(FROM)s' to '%(TO)s')FROMTOTF)r   r   r   r   r  )rY   r	  rs   failrh   messages         rT   r  z!ExprNode.check_for_coercion_errorQ  s     	B 	BAG%ty(&;WcJJ$(Gty&I&IIJJJ4 	  ***4urU   c                 B    |                      t          j        |          S rN   )r  r   r   r   s     rT   coerce_to_pyobjectzExprNode.coerce_to_pyobject]  s    ~~j7===rU   c           
         |                                  r+t          | j                  }t          | j        ||          S | j        }|j        s|j        r| S |t          j	        u r| S |j
        s|j        s|j        s|j        rt          | |          S |j        rr|j        rk|j                            d          rQt%          | j        t'          | j        | t)          j        d                    g                               |          S |j        r/t1          |j                  dk    }t          | j        ||          S t5          | j        d|z             | S )Nr   r   zoperator bool)obj	attributefunctionr   r   z%Type '%s' not acceptable as a boolean)r   rH  r   BoolNoder   r   is_enumr  r   c_bint_typerq   r  r  is_floatCoerceToBooleanNoder  scopelookupSimpleCallNodeAttributeNoder   EncodedStringr<  	is_ctupler   
componentsr   )rY   rs   
bool_valuer   s       rT   rG  zExprNode.coerce_to_boolean`  s   
 ##%% 	8d233JDHJ,68 8 8 8 y< 	4= 	KZ+++K 	 	 	t} 	&tS111 	4: 	$*2C2CO2T2T 	!&H$.2N2_2_a a a	   's++	,
 ^ 	T_--2JDHJ,68 8 8 8 $(CdJKKKKrU   c                 ^    | j         j        r| S |                     t          j        |          S rN   )r   r  r  r   c_long_typer   s     rT   coerce_to_integerzExprNode.coerce_to_integer  s+    9 	?K>>*"8#>>>rU   c                 N    |                                  r| S t          | |          S rN   )r  CoerceToTempNoder   s     rT   coerce_to_tempzExprNode.coerce_to_temp  s+       	/K#D#...rU   c                 X    |                                  r| S |                     |          S rN   )	is_simpler9  r   s     rT   rK  zExprNode.coerce_to_simple  s-    >> 	,K&&s+++rU   c                 *    |                                  S rN   )r  rX   s    rT   r;  zExprNode.is_simple  s    
 ""$$$rU   c                     | j         r| j         j        s| j         j        sdS |                                 r	| j        d uS dS NFT)r   rq   r   r   r   rX   s    rT   may_be_nonezExprNode.may_be_none  sQ    9 	di3 	"i:	5##%% 	4't33trU   c                     d S rN   rW   rX   s    rT   as_cython_attributezExprNode.as_cython_attribute      trU   PyExc_TypeErrorrW   c                 R    |                                  rt          | |||          S | S rN   )r?  NoneCheckNode)rY   r  r   format_argss       rT   as_none_safe_nodezExprNode.as_none_safe_node  s1      	 ug{CCCKrU   c                     d                                 }|D ]-}||v r	 t          ||          }|||<   # t          $ r Y *w xY w | |j        fi |S )zInstantiate this node class from another node, properly
        copying over all attributes that one would forget otherwise.
        z1cf_state cf_maybe_null cf_is_null constant_result)splitr   r   r   )rR   r   kwargs
attributes	attr_namer   s         rT   	from_nodezExprNode.from_node  s    
 INNPP
# 	* 	*IF""*i00 %*y!! "    s48&&v&&&s   5
AAc                     dS )z
        Gets the module.path that this node was imported from.

        Many nodes do not have one, or it is ambiguous, in which case
        this function returns a false value.
        NrW   rX   s    rT   !get_known_standard_library_importz*ExprNode.get_known_standard_library_import  s	     trU   FrN   r   FNN)FTFN)rC  rW   )wr[   r\   r]   r$  r   
annotationr  r  r  r  is_numpy_attributegenerator_arg_tagr   is_dict_literalis_set_literalis_string_literalis_attributeis_subscriptr   is_buffer_accessis_memview_indexis_memview_slicer  r  r   r  	is_target
is_starredr+  r   r   syspropertyr   
attrgetterr   r   r   r   r   r   r  r  r  r  r  r  r  r  r   r   r&  r(  r   r2  r6  r8  r:  r?  rB  rE  rI  rL  rO  r   rV  r`  rb  re  rk  rm  r<  rD  rs  ru  r=  rx  r|  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   rG  r6  r9  rK  r;  r?  rA  rG  classmethodrM  rO  rW   rU   rT   r   r   C  sJ       " LDJIHONf $ONLLH !&GNIJ,Owwws,d33VYGG9TTh$7H$7
$C$CDDD		! 	! 
	!  N N N
  E E E6 6 6  0 0 0c c c cH H H  ' ' ' '  ; ; ; ;. . .. . .
	 	 	
 
 
: : :; ; ;& & &; ; ;Y Y Y
  ' ' '. . .  	A 	A 	AW W W+ + +_ _ _
c c c c  
  
    
. . .' ' '  S S S  @ @ @  3 3 3
  , , ,6 6 6" " "  $9 9 9P P P* * *"0 0 05 5 56 6 6 . . .6 6 6$ INGK      * * *! ! !  
> > >? ? ? 16/3= = = =6 6 66 6 67 7 7
     F F FP
$ 
$ 
$
 
 
 
> > >  >? ? ?/ / /, , ,% % %        ' ' ['     rU   r   c                       e Zd Zg Zd Zd ZdS )AtomicExprNodec                     d S rN   rW   r  s     rT   r  z/AtomicExprNode.generate_subexpr_evaluation_code  r   rU   c                     d S rN   rW   r  s     rT   r  z-AtomicExprNode.generate_subexpr_disposal_code  r   rU   N)r[   r\   r]   r   r  r  rW   rU   rT   rf  rf    s9         H      rU   rf  c                   8    e Zd ZdZeZdZd Zd Zd Z	d Z
d ZdS )PyConstNoder(   Nc                     dS Nr(   rW   rX   s    rT   r;  zPyConstNode.is_simple  r   rU   c                     dS rw  rW   rX   s    rT   r?  zPyConstNode.may_be_none      urU   c                     | S rN   rW   r   s     rT   r<  zPyConstNode.analyse_types      rU   c                     | j         S rN   r   rX   s    rT   r  z!PyConstNode.calculate_result_code  
    zrU   c                     d S rN   rW   r  s     rT   r  z PyConstNode.generate_result_code  r   rU   )r[   r\   r]   r   r   r   rs  r;  r?  r<  r  r  rW   rU   rT   rj  rj    sp         JDK            rU   rj  c                   6     e Zd ZdZdZdZd Zd Z fdZ xZ	S )r  r(   Py_NoneNc                     d S rN   rW   r0  s     rT   r2  zNoneNode.compile_time_value  rB  rU   c                     dS NTrW   rX   s    rT   r?  zNoneNode.may_be_none  rB  rU   c                     |j         s&|j        s|j        st          | j        d|z             t          t          |                               ||          S )NzCannot assign None to %s)rq   r   r  r   r   rP   r  r  rY   r	  rs   rS   s      rT   r  zNoneNode.coerce_to  s]    $ 	C(C 	CxGX 	C$(6ABBBXt$$..x===rU   )
r[   r\   r]   r  r   r   r2  r?  r  r^   r_   s   @rT   r  r    sg         GEO    > > > > > > > > >rU   r  c                       e Zd ZdZeZd ZdS )EllipsisNodePy_Ellipsisc                     t           S rN   )Ellipsisr0  s     rT   r2  zEllipsisNode.compile_time_value  s    rU   N)r[   r\   r]   r   r  r   r2  rW   rU   rT   r}  r}    s/         EO    rU   r}  c                   F    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S )	ConstNoder(   Nc                     dS rl  rW   rX   s    rT   r;  zConstNode.is_simple  r   rU   c                     dS rl  rW   rX   s    rT   rV  zConstNode.nonlocally_immutable  r   rU   c                     dS rw  rW   rX   s    rT   r?  zConstNode.may_be_none  rn  rU   c                     | S rN   rW   r   s     rT   r<  zConstNode.analyse_types  rp  rU   c                     dS ry  rW   rX   s    rT   r=  zConstNode.check_const   rB  rU   c                 *    |                                  S rN   r  rX   s    rT   r&  z$ConstNode.get_constant_c_result_code#  s    ))+++rU   c                 *    t          | j                  S rN   )rx   r   rX   s    rT   r  zConstNode.calculate_result_code&      4:rU   c                     d S rN   rW   r  s     rT   r  zConstNode.generate_result_code)  r   rU   )r[   r\   r]   r   rs  r;  rV  r?  r<  r=  r&  r  r  rW   rU   rT   r  r    s        
 JK          , , ,      rU   r  c                   4    e Zd Zej        Zd Zd Zd Zd Z	dS )r'  c                     | j         | _        d S rN   r"  rX   s    rT   r(  z"BoolNode.calculate_constant_result1      #zrU   c                     | j         S rN   rr  r0  s     rT   r2  zBoolNode.compile_time_value4  rs  rU   c                 r    | j         j        r| j        rdndS t          t	          | j                            S )NPy_TruePy_False)r   rq   r   rx   intrX   s    rT   r  zBoolNode.calculate_result_code7  s6    9  	( $
:99
:s4:'''rU   c                    || j         k    r| S |t          u r| j         t          j        u r| S |j        r8| j         j        r,t          | j        | j        | j	        t          j                  S |j        r8| j         j        r,t          | j        | j        | j	        t          j                  S t                              | ||          S NrX  )r   r   r   	bool_typerq   r  r'  r   r   r   r   r)  r  r  rY   r	  rs   s      rT   r  zBoolNode.coerce_to=  s    ty  K~%%$)w7H*H*HK 	(DI$4 	(
 $ 4&( ( ( ( ? 	-ty4 	-
 $ 4+- - - - ""43777rU   N)
r[   r\   r]   r   r)  r   r(  r2  r  r  rW   rU   rT   r'  r'  -  sX        !D* * *  ( ( (8 8 8 8 8rU   r'  c                   *    e Zd Zej        ZdZdZd ZdS )NullNodeNULLr   c                     | j         S rN   rr  rX   s    rT   r&  z#NullNode.get_constant_c_result_codeT  rs  rU   N)	r[   r\   r]   r   c_null_ptr_typer   r   r   r&  rW   rU   rT   r  r  O  s5        %DEO    rU   r  c                   .    e Zd Zej        Zd Zd Zd ZdS )r   c                 8    t          | j                  | _        d S rN   )ordr   r   rX   s    rT   r(  z"CharNode.calculate_constant_result[  s    "4:rU   c                 *    t          | j                  S rN   )r  r   r0  s     rT   r2  zCharNode.compile_time_value^  r  rU   c                 :    dt          j        | j                  z  S )Nz'%s')r   escape_charr   rX   s    rT   r  zCharNode.calculate_result_codea  s    24:>>>>rU   N)	r[   r\   r]   r   r   r   r(  r2  r  rW   rU   rT   r   r   X  sI        !D/ / /  ? ? ? ? ?rU   r   c                       e Zd ZdZdZdZed             Zed             Zd Z	d Z
d Zd Zd	 Zd
 Zd Zd Zd Zd ZdS )r]  r  Nc                 r    t          j        t          t          j        | j                                      S rN   )r   strip_py2_long_suffixhexstr_to_numberr   rX   s    rT   	hex_valuezIntNode.hex_valueq  s(    *3u/B4:/N/N+O+OPPPrU   c                 N    t          t          j        | j                            S rN   )rx   r   r  r   rX   s    rT   base_10_valuezIntNode.base_10_valueu  s    5&tz22333rU   c                 j    t          j        | |fi | d|vr|                                 | _        d S d S )Nr   )r   __init__find_suitable_type_for_valuer   )rY   r   kwdss      rT   r  zIntNode.__init__y  sG    $,,t,,,99;;DIII rU   c                    | j         t          u r&	 |                                  n# t          $ r Y nw xY w| j        s&|                                 r| j        s| j        dk    rL| j        dk    rdpd}t          j	        | j         |df         }| j
        rt          j        || j
                  }nId| j         cxk    rdk     r+n n(| j
        r| j
        j        r| j
        }nt          j        }nt          j        }|S )NLLr5   r(   r  i   l        )r   r+  r(  r   is_c_literalr   unsignedlongnessr   modifiers_and_name_to_typer   widest_numeric_typer  r5  r   )rY   ranksuitable_types      rT   r  z$IntNode.find_suitable_type_for_value~  s2   #999..0000     	:++--	:}	: $ 5 5MT)0q5AD&AdmBSUY[`B`aMy Y * >}di X X -5555555559 ;!1 ;$(IMM$.$:MM * 9s   % 
22c           	         | j         |u r| S |j        ru|                                 r?t          | j        dt          | j                  z  |t          | j                            S t          | j        | j        |t                    S |j
        r8|j        s1t          | j        | j        | j        |d| j        | j                  }|S |j        r:t          | j        | j        | j        t           j        d| j        | j                  }n-t          | j        | j        | j        | j        | j                  }t$                              |||          S )Nz%d.0)r   r   r   T)r   r   r   r  r  r  F)r   r   r  r  )r   r*  r   	FloatNoder   r  r   r   r   r,  
is_numericr  r]  r  r  rq   r   r   r  r  rY   r	  rs   r   s       rT   r  zIntNode.coerce_to  s}   9  K 	A'')) A #d>R:S:S1SZb16t7K1L1LN N N N !(1?A A A A 	Kx': 	K484:tG[ (t$(MDMK K KD K! 	K484:tG[ * 9$(MDMK K KDD 484:tG[$(MDMK K KD
 ""43777rU   c                 r    t          | j        | j        | j        t          j        | j        | j                  S )N)r   r   r   r  r  )r]  r   r   r   r   r)  r  r  r   s     rT   rG  zIntNode.coerce_to_boolean  s7    HDJ 0']T]	< < < 	<rU   c                 ,   | j         j        rnt          j        | j                  }|dk    rt
          nt          } ||          }t          j        |          }|                    || j	                  | _
        d S |                                 | _
        d S )Nl     a$)r   rq   r   r  r   r  rx   r  
get_py_intr  result_coder&  )rY   r   r   	formatterplain_integer_strings        rT   r  z IntNode.generate_evaluation_code  s    9  	A
 '
33E$//SI#,9U#3#3 #(#>?S#T#T #/CT]SSD#>>@@DrU   c                 ,   | j         | j        }}|                                 }|si|sg| j        j        r[|d         dk    rO|d         dk    rC| j        j        t          j        j        k    rd}n!| j        j        t          j        j        k    rd}||z   |z   S )Nr   -r(   0r  L)	r  r  value_as_c_integer_stringr   r  r  r   c_longlong_typer5  )rY   r  r  literals       rT   r&  z"IntNode.get_constant_c_result_code  s    !]DM(0022 	H 	$)*: 	wqzS?P?PU\]^U_cfUfUfy~!;!@@@:#9#>>>!H,,rU   c                    | j         }t          |          dk    r|S d}|d         dk    rd}|dd          }|d         dk    r|d         }|rB|dv r>|dd                                          r"t          t	          j        |                    }nr|dv rd|dd          z   }n`|d	v r%t          t          |dd          d                    }n6|                                r"| j        s| j        s|sd
t          |          z  }||z   S )Nr5   r  r   r  r(   r  oOxX0123456789oObBz0x%X)	r   r   isdigitrx   r   r  r  r  r  )rY   r   neg_signliteral_types       rT   r  z!IntNode.value_as_c_integer_string  s1   
u::??L8s??H!""IE8s?? 8L  /L,<<<qrrARARATAT< E/6677%%eABBi%%Cabb	1--..]]__ 	,T] 	,4= 	, , U+%rU   c                     | j         S rN   r  rX   s    rT   r  zIntNode.calculate_result_code      rU   c                 B    t          j        | j                  | _        d S rN   )r   r  r   r   rX   s    rT   r(  z!IntNode.calculate_constant_result  s    $24:>>rU   c                 4    t          j        | j                  S rN   )r   r  r   r0  s     rT   r2  zIntNode.compile_time_value  s    "4:...rU   )r[   r\   r]   r  r  r  rb  r  r  r  r  r  rG  r  r&  r  r  r(  r2  rW   rU   rT   r]  r]  e  s         HHL Q Q XQ 4 4 X4< < <
  68 8 8:< < <A A A	- 	- 	-     8     ? ? ?/ / / / /rU   r]  c                   @    e Zd Zej        Zd Zd Zd Zd Z	d Z
d ZdS )r  c                 8    t          | j                  | _        d S rN   )r   r   r   rX   s    rT   r(  z#FloatNode.calculate_constant_result  s    $TZ00rU   c                    t          | j                  }d|z                      d          }t          j        | j                  }||t          |                              d          fvrt          | j        d|z             |S )Nz%.330fr  zEUsing this floating point value with DEF may lose precision, using %r)	r   r   stripr   normalise_float_reprreprlstripr   r   )rY   r1  float_valuestr_float_value	str_values        rT   r2  zFloatNode.compile_time_value  s    DJ''#k188==.tz::	_d;.?.?.F.Fs.K.KLLLDHehsstttrU   c                 "   |j         r8| j        j        r,t          | j        | j        | j        t          j                  S |j        r.| j        j         r"t          | j        | j        | j        |          S t          
                    | ||          S r  )rq   r   r*  r  r   r   r   r   
float_typer  r  r  s      rT   r  zFloatNode.coerce_to	  s     	)DI$6 	)
 $ 4') ) ) )  	!6 	
 $ 4    ""43777rU   c                     | j         S rN   r  rX   s    rT   r  zFloatNode.calculate_result_code  r  rU   c                     | j         }t          |t                    sJ t          t	          |                    }|dk    rdS |dk    rdS |dk    rdS |S )Nnanz(Py_HUGE_VAL * 0)infPy_HUGE_VALz-infz(-Py_HUGE_VAL))r   r   rI   r  r   )rY   strvalcmpvals      rT   r&  z$FloatNode.get_constant_c_result_code  se    &*-----eFmm$$U??&&u__ =v##MrU   c                     |                                  }| j        j        r"|                    | j        |          | _        d S || _        d S rN   )r&  r   rq   get_py_floatr   r  )rY   r   c_values      rT   r  z"FloatNode.generate_evaluation_code&  sN    11339  	'#00WEED&DrU   N)r[   r\   r]   r   c_double_typer   r(  r2  r  r  r&  r  rW   rU   rT   r  r    sv        #D1 1 1  8 8 8       ' ' ' ' 'rU   r  c                 $   t          j        |           }|	|j        r|S |                                }|                    |           }|rP|j        rI|j        }|j        s%|t          j        u r|j	        j
        dk    rt          }|r|j        s|j        r|S |p|}ddlm} t          d          5  |d         |d         |d         dz
  f}	  |d| z  |d         j        |	          }|j        j        d         j        }	t'          |	t(                    rS|	                    |          }	t'          |	t(                    r)|	j        }|r|j        s|j        r|cd d d            S |p|}n# t.          $ r Y nw xY wd d d            n# 1 swxY w Y   |S )
Nr5   r(   )TreeFragmentTignorer      
sizeof(%s))rr   initial_pos)r   parse_basic_typein_c_type_contextglobal_scoper-  is_typer   r   int_typecontextlanguage_levelr   rq   r  r   filenamerootstatsexprr   SizeofTypeNoder<  arg_typer   )
rr   r   rs   r   r  global_entryr   r  declarationsizeof_nodes
             rT   _analyse_name_as_typer  .  sK   '--ES2##%%L&&t,,L ,  % 	"G,,, (71<< "D 	T% 	)> 	K +*****	T	"	"	" * *1vs1vs1vax(	*&,}t';#a&/_bcccK &*038K+~66 *)77<<k>:: *&/D $!1 $S5J $#* * * * * * * * "MTE  	 	 	D		* * * * * * * * * * * * * * * Ls=   1FE))A.F$F)
E63F5E66FF	F	c                   T    e Zd ZdZeZd ZddZd Zd Z	d Z
d Zd	 Zd
 Zd Zd ZdS )	BytesNodeTc                     | j         | _        d S rN   r"  rX   s    rT   r(  z#BytesNode.calculate_constant_result_  r  rU   Nc                     t          j        | j        |||         | j        j                  }t	          | j        ||          S Nr"  )r   bytes_literalr   encodingr  r   )rY   r   r   r   r   s        rT   as_sliced_nodezBytesNode.as_sliced_nodeb  s=    ,TZd4-H$*J]^^FFFFrU   c                 4    | j                                         S rN   )r   
byteencoder0  s     rT   r2  zBytesNode.compile_time_valuef  s    z$$&&&rU   c                 ^    t          | j                            d          | j        |          S Nz	ISO8859-1)r  r   decoder   r   s     rT   re  zBytesNode.analyse_as_typei  s&    $TZ%6%6{%C%CTXsSSSrU   c                 2    t          | j                  dk    S rl  r   r   rX   s    rT   can_coerce_to_char_literalz$BytesNode.can_coerce_to_char_literall      4:!##rU   c                 X    t          | j                  }t          | j        ||          S r  rH  r   r'  r   rY   rs   r3  s      rT   rG  zBytesNode.coerce_to_booleano  s*     $*%%

JOOOOrU   c                    | j         |k    r| S |j        rw|                                 st          | j        d           | S |j        rt          | j        d           | S t          | j        | j        t          | j                            S t          | j        | j        | j
                  }|j        rA|t          t          j        fv rt          j        |_         n|                     ||d           |S |t           j        t           j        fv r	||_         |S |t           j        t           j        t           j        fv r=|t           j        k    rt           j        nt           j        |_         t-          ||          S |                    t           j                  r|j        r|j        r	||_         |S t4                              |||          S )Nz?Only single-character string literals can be coerced into ints.zRBytes literals cannot coerce to Py_UNICODE/Py_UCS4, use a unicode literal instead.r"  Tr  )r   r  r  r   r   is_unicode_charr   r   r  r  r   rq   r   r   r   r  r   rm   ro   rn   rp   c_void_ptr_typeCastNoder  r  is_constr  r  r  s       rT   r  zBytesNode.coerce_tou  s   9  K? 	=2244 dh abbb' dh tuuuDHDJ,/
OO= = = = TEYZZZ 	NG,>???#.		--h$-GGGK*4j6VWWW DIK*5z7XZdZtuuu=EIj=j=j99(8 ID(+++%%j&@AA 	( H,= $	
 ""43777rU   c                 "   | j         j        r|                    | j                  }n`| j         j        r|                    | j                  }n9| j                                        }t          | j         t          j	        |          }|| _
        d S rN   )r   rq   get_py_string_constr   r  get_string_constas_c_string_literalr.   r   r  r  )rY   r   r  r  s       rT   r  z"BytesNode.generate_evaluation_code  s    9  	N--dj99FFY 	N**4:66FF j4466Gdi)CWMMF!rU   c                     d S rN   rW   rX   s    rT   r&  z$BytesNode.get_constant_c_result_code  rB  rU   c                     | j         S rN   r  rX   s    rT   r  zBytesNode.calculate_result_code  r  rU   rN   )r[   r\   r]   rY  r   r   r(  r  r2  re  r  rG  r  r  r&  r  rW   rU   rT   r  r  V  s        
 D* * *G G G G' ' 'T T T$ $ $P P P$8 $8 $8L
" 
" 
"           rU   r  c                   X    e Zd ZdZdZeZd Zd ZddZ	d Z
d Zd Zd	 Zd
 Zd Zd ZdS )UnicodeNodeTNc                     | j         | _        d S rN   r"  rX   s    rT   r(  z%UnicodeNode.calculate_constant_result  r  rU   c                 8    t          | j        | j        |          S rN   )r  r   r   r   s     rT   re  zUnicodeNode.analyse_as_type  s    $TZ3???rU   c                 L   t          j        | j        d |                   rd S t          j        | j        |||                   }| j        j        |_        | j        .t          j        | j        |||         | j        j                  }nd }t          | j        |||          S )N)r   bytes_valuer   )	r   string_contains_surrogatesr   r0  r
  r)  r	  r%  r   )rY   r   r   r   r   r)  s         rT   r  zUnicodeNode.as_sliced_node  s    4TZ5FGG 	 4,TZd4-HII,'(6 tD143C3LN NKK KHE{!# # # 	#rU   c                 F   || j         u rn|j        rd|                                 st          | j        d           | S t          | j                  }t          | j        |t          |          |          S |j	        sv|j
        r6| j        /t          | j        | j                                      ||          S |j        rt          | j        | j        |          S t          | j        d           n-|t           t"          j        fvr|                     ||d           | S )NzhOnly single-character Unicode string literals or surrogate pairs can be coerced into Py_UCS4/Py_UNICODE.r   r   r   rr  r   r   zUnicode literals do not support coercion to C types other than Py_UNICODE/Py_UCS4 (for characters) or Py_UNICODE* (for strings).Tr  )r   r  r  r   r   r  r   r]  rx   rq   r  r)  r  r  r  r%  r   r   r2   r  )rY   r	  rs   	int_values       rT   r  zUnicodeNode.coerce_to  sR   ty  % 	D2244 dhPQ Q Q DJI48(#i..+46 6 6 6% 	D! \d&6&B !1ABBBLLXWZ[[[( N"484:HMMMM$(#$ $ $ $ ng.EFFF))(Cd)CCCrU   c                 2    t          | j                  dk    S rl  r  rX   s    rT   r  z&UnicodeNode.can_coerce_to_char_literal  r  rU   c                 X    t          | j                  }t          | j        ||          S r  r  r  s      rT   rG  zUnicodeNode.coerce_to_boolean  s(    $*%%

JOOOOrU   c                 4    t          j        | j                  S rN   )r   r*  r   rX   s    rT   contains_surrogateszUnicodeNode.contains_surrogates  s    8DDDrU   c                    | j         j        r9t          j        | j                  r|                    t          d          | _        |                    t          j	        | j        
                    d                              }|                    | j                  }|d S |                    | j                   |                    | j        d|d|d|                    | j        | j                             |                    | j        d| j        z             d S |                    | j                  | _        d S |                    | j                  | _        d S )Nustringunicode_escapez! = PyUnicode_DecodeUnicodeEscape(	, sizeof(z) - 1, NULL); z__Pyx_PyUnicode_READY(%s))r   rq   r   string_contains_lone_surrogatesr   get_py_constr   r  r   BytesLiteralencodeget_cached_constants_writerr  r   r   r   put_error_if_negr  get_pyunicode_ptr_const)rY   r   
data_cname
const_codes       rT   r  z$UnicodeNode.generate_evaluation_code  s|   9  	H =djII H $(#4#4^Y#O#O !22"/
0A0ABR0S0STTV V
!==d>NOO
%F##DH---  ((("

"

"55d6FQQQ	ST T T ++H9D<LLN N N N N $(#;#;DJ#G#G   #;;DJGGDrU   c                     | j         S rN   r  rX   s    rT   r  z!UnicodeNode.calculate_result_code  r  rU   c                     | j         S rN   rr  r   s     rT   r2  zUnicodeNode.compile_time_value  rs  rU   rN   )r[   r\   r]   rY  r)  r   r   r(  re  r  r  r  rG  r2  r  r  r2  rW   rU   rT   r%  r%    s         KD* * *@ @ @# # # #   6$ $ $P P PE E EH H H<         rU   r%  c                   V    e Zd ZeZdZdZdZd Zd Z	ddZ
d Zd Zd Zd	 Zd
 Zd ZdS )
StringNodeTNc                 0    | j         | j         | _        d S d S rN   )r   r   rX   s    rT   r(  z$StringNode.calculate_constant_result)  s$    )#'#5D    *)rU   c                 l    t          | j        p| j                            d          | j        |          S r  )r  r   r   r  r   r   s     rT   re  zStringNode.analyse_as_type.  s1    $T%7%Y4:;L;L[;Y;Y[_[cehiiirU   c                 T    t          | j                  | j        |||                   }| j        j        |_        | j        Ft	          j        | j        d |                   rd S t	          j        | j        |||                   }nd }t          | j        |||| j	                  S )N)r   r   r   is_identifier)
r   r   r
  r   r   r*  r0  rC  r   rG  )rY   r   r   r   r   r   s         rT   r  zStringNode.as_sliced_node1  s     TZ  E$tO!<==,)89KETE9RSS t*8"5d?35 5MM !MHE!1CE E E 	ErU   c                     |t           urpt          j        |          s\|j        s/t	          | j        | j                                      ||          S |t          j	        ur| 
                    ||d           | S )Nrr  Tr  )r   r   r   rq   r  r   r   r  r   r2   r  r  s      rT   r  zStringNode.coerce_to@  s    >))(2Eh2O2O) ' V <<<FFxQTUUUw666--h$-GGGrU   c                 B    | j          ot          | j                  dk    S rl  )rG  r   r   rX   s    rT   r  z%StringNode.can_coerce_to_char_literalK  s     %%>#dj//Q*>>rU   c                 `    |                     | j        | j        d| j                  | _        d S )NT
identifieris_strr   )r  r   rG  r   r  r  s     rT   r  z#StringNode.generate_evaluation_codeN  s7    33J4#5d, 4 . .rU   c                     d S rN   rW   rX   s    rT   r&  z%StringNode.get_constant_c_result_codeS  rB  rU   c                     | j         S rN   r  rX   s    rT   r  z StringNode.calculate_result_codeV  r  rU   c                     | j         j        r| j         S t          s| j                                         S | j        | j        S | j                             d          S )N	iso8859-1)r   
is_unicoder'   r  r   r  r   s     rT   r2  zStringNode.compile_time_valueY  s[    :  	: 	+:((***)%%z  ---rU   rN   )r[   r\   r]   r   r   rY  rG  r   r(  re  r  r  r  r  r&  r  r2  rW   rU   rT   rC  rC    s         DMM6 6 6
j j jE E E E	 	 	? ? ?. . .
       	. 	. 	. 	. 	.rU   rC  c                       e Zd ZdZdS )r   TN)r[   r\   r]   rG  rW   rU   rT   r   r   e  s         MMMrU   r   c                   J    e Zd Zej        Zd Zd Zd Zd Z	d Z
dZd Zd Zd	S )
ImagNodec                 T    t          dt          | j                            | _        d S Ng        )complexr   r   r   rX   s    rT   r(  z"ImagNode.calculate_constant_resultr  s$    &sE$*,=,=>>rU   c                 F    t          dt          | j                            S rW  )rX  r   r   r0  s     rT   r2  zImagNode.compile_time_valueu  s    sE$*--...rU   c                 :    | j                             |           | S rN   )r   create_declaration_utility_coder   s     rT   r<  zImagNode.analyse_typesx  s    	11#666rU   c                     dS rw  rW   rX   s    rT   r?  zImagNode.may_be_none|  rn  rU   c                     | j         |u r| S t          | j        | j                  }|j        rd|_        t          j        |_         t          	                    |||          S )Nrr  r(   )
r   rU  r   r   rq   r   r   complex_typerf  r  r  s       rT   r  zImagNode.coerce_to  s`    9  K
333 	-DL,DI ''h<<<rU   zConstructing complex numberc                     | j         j        r|                                 S | j         j        dt	          | j                  dS )Nz(0, ))r   rq   r  
from_partsr   r   rX   s    rT   r  zImagNode.calculate_result_code  sD    9  	K;;== "&)"6"6"6dj8I8I8I8IJJrU   c           
      $   | j         j        r|                    |                                 dt	          | j                  d|                    |                                 | j                             |                     |           d S d S )Nz = PyComplex_FromDoubles(0.0, ); )	r   rq   r   r  r   r   r   r   r  r  s     rT   r  zImagNode.generate_result_code  s    9  	'JJKKMMMM$*%%%%++DKKMM48DDDFG G G
   &&&&&	' 	'rU   N)r[   r\   r]   r   c_double_complex_typer   r(  r2  r<  r?  r  gil_messager  r  rW   rU   rT   rU  rU  k  s        
 +D? ? ?/ / /    
= 
= 
= 0KK K K' ' ' ' 'rU   rU  c                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )NewExprNodeNc                 .   | j                             |          }||j        s#t          | j        d           t
          | _        d S |                     |           |                    | j                  }|| _	        || _
        |j        | _        | j        S )Nz/new operator can only be applied to a C++ class)cppclassre  r  r   r   r/   r   	cpp_checkget_constructor
class_typer   )rY   rs   r   constructors       rT   r   zNewExprNode.infer_type  s    },,S11<t0<$(MNNN"DIFs**4844 
$	yrU   c                 >    | j         |                     |           | S rN   )r   r   r   s     rT   r<  zNewExprNode.analyse_types  s!    9OOC   rU   c                     dS rw  rW   rX   s    rT   r?  zNewExprNode.may_be_none  rn  rU   c                     d S rN   rW   r  s     rT   r  z NewExprNode.generate_result_code  r   rU   c                 :    d| j                                         z   S )Nznew )rl  empty_declaration_coderX   s    rT   r  z!NewExprNode.calculate_result_code  s    >>@@@@rU   )	r[   r\   r]   r   r   r<  r?  r  r  rW   rU   rT   rg  rg    sk         D    
    A A A A ArU   rg  c                   :    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d Zd Zd Zd Zd	 Z fd
Zd+dZd Zd Zd Zd Zd Zd Zd Zd Zd Zd ZdZ d+dZ!d Z"d Z#d Z$ fdZ%d Z&d Z'd Z(d Z)d  Z*d! Z+d" Z,d# Z-d$ Z.	 	 d,d%Z/d& Z0d' Z1d+d(Z2d) Z3d* Z4 xZ5S )-r  TFNr   c                     | j         S rN   )cython_attributerX   s    rT   rA  zNameNode.as_cython_attribute  s    $$rU   c                     | j         |                    | j                  | _         | j         | j         j        j        r| fS dS NrW   )r   r-  rr   r   is_unspecifiedr   s     rT   rO  zNameNode.type_dependencies  s?    :DI..DJ:!djo&D!7N2rU   c                 F   | j         |                    | j                  | _         | j         | j         j        t          u r| j        | j        S t          S | j         j        j        s| j         j        j        r!| j        | j         j        j        k    rt          S | j         j        j
        r6| j         j        j        rt          S t          j        | j         j                  S | j         j        j        r&| j        r| j        j        r| j         j        s| j        S | j         j        S rN   )r   r-  rr   r   r0   inferred_typer   is_extension_typeis_builtin_typer   rU  r,  is_builtin_scoper   CPtrTyperq   r  might_overflowr   s     rT   r   zNameNode.infer_type  s   :DI..DJ:4D!D!D!-))!!jo/ 	#4:?3R 	#	TZ_111 Z_) 	#z0 <%% "*4:?;;; z* .t/A .*1 .dj6O .--:?"rU   c                     	 |                     | j                  S # t          $ r! t          | j        d| j        z             Y d S w xY w)Nz"Compile-time name '%s' not defined)r-  rr   rj  r   r   r0  s     rT   r2  zNameNode.compile_time_value   s^    	N;;ty))) 	N 	N 	N$(@49LMMMMMM	Ns    'AAc                 N    | j         r| j         j        j        rd S | j         j        S rN   )r   r   rq   r   rX   s    rT   r&  z#NameNode.get_constant_c_result_code  s*    z 	TZ_8 	4zrU   c                 h   |t           u r| j        }|rw|j        rp|j        }|rg|j        r'|j        r |                    |j        | j                  }t          | j        | j                  }||_        |
                    |           |S t          t          |                               ||          S )Nrr   )r   r   rU  as_variable
is_builtinr  declare_builtinrr   r   r  analyse_rvalue_entryrP   r  )rY   r	  rs   r   	var_entryr   rS   s         rT   r  zNameNode.coerce_to  s    
 ~%%JE  +  !-	   + R	0B R$'$7$7	$Q$Q	#DHTY???D!*DJ--c222KXt$$..x===rU   c                 L   | j         }| j        }| j        p|                    |          }|sb|j        rdS d}|j        j        s|j        d         sd}n'|j        rt          }n|
                    |          \  }}|"|r|j        d         dk    rt          nt          }n^|j        rW|j        rP	 |                    |j                  }n4# t          $ r' t!          | j        d| j         z             t$          }Y nw xY wd}|j        r-|j        dk    }	|j        s|                    |          r|	rd	nd
}|r2|j        r+|j        s$|j        st          }t1          |j        dd           |                    ||| j        | ||          x}| _        |r|j        s||_        dS dS dS )as  Implements PEP 526 annotation typing in a fairly relaxed way.

        Annotations are ignored for global variables.
        All other annotations are stored on the entry in the symbol table.
        String literals are allowed and not evaluated.
        The ambiguous Python types 'int' and 'long' are not evaluated - the 'cython.int' form must be used instead.
        NrW   annotation_typinginfer_typesFzR'%s' cannot be specialized since its type is not a fused argument to this functionprivatefrozenreadonlypubliczxAnnotation ignored since class-level attributes must be Python objects. Were you trying to set up an instance attribute?r5   )is_cdef
visibilitypytyping_modifiers)rr   rT  r   lookup_hereis_module_scoper  rY  rk   is_py_class_scoper   analyse_type_annotationr0   rg  rh  ri  r)   r   r   r/   is_c_dataclass_scoperq   can_coerce_to_pyobjectis_c_class_scoper  r   declare_var)
rY   rs   	as_targetrr   rT  r   	modifiersatyper  	is_frozens
             rT   declare_from_annotationz NameNode.declare_from_annotation  sS    y_

3cood33 /	." I 1K ~&9:	K & K&#-#E#Ec#J#J 	5},5t#.:W[`:`:`((ft 'C$9 ''!,,S-BCCEE' ' ' '$(n)$% % % 'EEE	' #J' G  4@	$ G(D(DS(I(I G/8!FhJ  OS1 O5;L OPUP^ O&
 )KLMO O O "%eTX9}#, "1 ". ". .EDJ
  	*e. 	*)E	* 	* 	* 	*s   /C
 
.C;:C;c                     | j         }|s|                    | j                  }|r|j        r|j        S |r+|j        r$t          j        |j                  }|r	|j        r|S d S rN   )r   r-  rr   	as_moduleknown_standard_library_importr   'get_known_standard_library_module_scoper  )rY   rs   r   r,  s       rT   rb  zNameNode.analyse_as_module^  s     
 	*JJty))E 	#U_ 	#?" 	U8 	CEDghhE . trU   c                    d }| j         rt          j        | j                   }n |j        rt          j        | j                  }|r|S | j        }|s|                    | j                  }|r'|j        s |j        rt          j
        |j                  }|r|j        r|j        }|j        s+|t          j        u rt          | j        d           t          }nM|j        r|j        r|j        }n7|t          j        u r)|                                j        j        dk    rt          }|S | j        dk    rt          S |j        s?t          j        | j                  r&t          | j        d| j        d| j        d           d S )NzWFound Python 2.x type 'long' in a Python annotation. Did you mean to use 'cython.long'?r5   objectzFound C type 'z6' in a Python annotation. Did you mean to use 'cython.z'?)ru  r   r  r  rr   r   r-  r  r  r    get_known_standard_library_entryr   r3   r   r   r   rq   equivalent_typer  r  r  r  rR  s       rT   re  zNameNode.analyse_as_typel  s     	:.t/DEEDD" 	:.ty99D 	K
 	*JJty))E 	b 	b5+N 	b<U=`aaE 	U] 	:D( 
&TW5F-F-F"{|||%! &d&: &+)))c.>.>.@.@.H.W[\.\.\ &K9  !! $ 	E)DTY)O)O 	EDHHnrnwnwnwy}  zC  zC  zC  D  E  E  EtrU   c                     | j         }|s|                    | j                  }|r&|j        r|j        j        s|j        j        r|j        S d S rN   )r   r-  rr   r  r   r{  r|  rY   rs   r   s      rT   rm  z"NameNode.analyse_as_extension_type  s]     
 	*JJty))E 	"U] 	"z+ "uz/I "z!trU   c                 0    |                      |d          S )NFis_assignment_expression_analyse_target_declarationr   s     rT   r8  z#NameNode.analyse_target_declaration  s    //e/TTTrU   c                 0    |                      |d          S )NTr  r  r   s     rT   r:  z9NameNode.analyse_assignment_expression_target_declaration  s    //d/SSSrU   c                 8   d| _         | j        sA|r |                    | j                  | _        n|                    | j                  | _        | j        rd| j        _        | j        s'| j         |j        }|                     ||            n6| j        r/| j        j	        r#| j        r|j        rt          | j        d           | j        s|j        d         rt          | j        d| j        z  d           |j        d         d	k    rt          }nt          }|r'|                    | j        || j                  | _        n&|                    | j        || j                  | _        | j        j        rt          | _        | j        j        rd| j        _        d S d S )
NTr  )r  z7Cannot redeclare inherited fields in Cython dataclasseszwarn.undeclaredzimplicit declaration of '%s'r(   r  F)r_  r   #lookup_assignment_expression_targetrr   r  r  rT  r  r  is_inheritedr   r   rk   r   r0   r   $declare_assignment_expression_targetr  is_declared_genericr$  r  is_variable)rY   rs   r  is_dataclassr   s        rT   r  z$NameNode._analyse_target_declaration  s   z 	8' 8 DDTYOO

 __TY77
: 	:79DJ4z 	Wdo93L ((L8H(IIIIj 	WTZ4 	W	W$'$<	W$(UVVVz 
	H~/0 Q"@49"LaPPP~m,55'%' H EEdiQUW[W_``

 __TYdhGG
:) 	/ .D: 	'%&DJ"""	' 	'rU   c                    |j         d         | _        | j        }|o|                    | j                  }|s7|                    | j        | j                  }|r|j        r|j        rd| _	        |st          j        | _        | S || _        d|_        |j        j        rddlm} |                    |           |                     |           | S )NinitializedcheckTr(   Buffer)rk   initialized_checkr   r-  rr   r  r   r  r  r   r   r/   r   r  	is_bufferr  r  used_buffer_aux_varsr  rY   rs   r   r  s       rT   r<  zNameNode.analyse_types  s    !$0B!C
=JJty))E +++DItx@@ +U- +%. +&*DO &1	DJ
: 	/      ''...!!#&&&rU   c                     |                      |d           | j        }|j        rO|j        rH|j        s'|j        j        s|                                 s!|j        r|j        x}| _        |j        | _        | j        j        rt          | j
        d| j        z             |                                 s.t          | j
        d| j        z             t          j        | _        d|_        |j        j        rddlm} |                    |           | S )NTr_  zAssignment to const '%s'zAssignment to non-lvalue '%s'r(   r  )analyse_entryr   rU  r  is_overridabler   r   fused_cfunctionr  r   r   rr   r   r/   r  r  r  r  r  r  s       rT   rD  zNameNode.analyse_target_types  s   3$///
 	'%"3 	'$ '
(A '$..JZJZ '_d_t '%*%66
!J	9 	D$(6BCCC~~ 	.$(;diGHHH"-DI
: 	/      ''...rU   c                    |                      |           | j        }|j        rt          | _        |j        s|j        r%|j        r|j        rd| _        nd| _        d| _	        n!|j
        j        rd| _        d| _	        d| _        | S )Nr   r(   FT)r  r   r  r   r$  is_pyglobalr  r  r   is_used_as_rvaluer   r   r  r  s      rT   r  zNameNode.analyse_rvalue_entry  s     	3
$ 	/ .D 
	( 0 
	( !EN !  %&D""Z* 	( DL%)D"#'D rU   c                     d| _         | j        rJ| j        }|j        r|j        s|                                  d S d S |j        r|                                  d S d S d S ry  )r   r  r   r  r  rr  r  r  s      rT   rs  zNameNode.nogil_check	  s    
! 	!JE !~ %NN$$$$$% %" !     	! 	!
! !rU   z"Accessing Python global or builtinc                     |                                   | j        }|j        }|s!|j        r| j        r| j        j        r| j        }|| _        d S rN   )check_identifier_kindr   r   rq   rz  r|  )rY   rs   r_  r   r   s        rT   r  zNameNode.analyse_entry	  sa    ""$$$
z 	&d. 	&43E 	&"2	& %D			rU   c                    | j         }|j        r|j        j        r|| _        |j        rY|j        j        s|j        j        rAt          j        | j	        d t                    }d|_        | j         j        |_        || _         d S |j        sa|j        s\|j        sW|j        sR|j        sM| j         j        r| j         j        | _         d S | j        s)t)          | j        d| j	        z             d S d S d S d S d S d S d S )NTz7'%s' is not a constant, variable or function identifier)r   r  r   r{  
type_entryr(  is_cpp_enumr   Entryrr   r   r  r,  r  r  r  rU  r  r  is_cython_moduler   r   )rY   r   py_entrys      rT   r  zNameNode.check_identifier_kind	  sQ    
= 	$UZ9 	$#DO= 	gej0 	gEJ4J 	g|DIt^DDH#'H !Z-HN!DJJJ. 	gE$5 	g"	g&+&8	g$	g z% g!Z3


* gdh Y\`\e efffff	g 	g 	g 	g 	g 	g 	g 	g 	g 	g
g grU   c                     | j         s| j        rdS | j        p|                    | j                  }|j        o|j         S rw  )r  ru  r   r-  rr   r  r  r  s      rT   "is_cimported_module_without_shadowz+NameNode.is_cimported_module_without_shadow2	  sI      	D$9 	5
3cjj338u'8#88rU   c                     dS rl  rW   rX   s    rT   r;  zNameNode.is_simple8	  s    qrU   c                 ,   | j         rf| j        r_| j        j        s| j        j        rGt	          | dd          rdS d| _        d}| j         D ]}|j                                        rd} n | `|S t          t          |                                           S )N_none_checkingFT)
r   r   rq   r   r   r  r   r?  rP   r  )rY   r?  
assignmentrS   s      rT   r?  zNameNode.may_be_none<	  s    = 	TY 	DI,A 	,0I,H	 t-u55  u"&D  K"m  
>--// "&KE #Xt$$00222rU   c                     t                               |           rdS | j        }|r|j        rdS |j        p|j        p|j        p|j        S NTF)r   rV  r   
in_closureis_localis_argr  is_readonlyrY   r   s     rT   rV  zNameNode.nonlocally_immutableQ	  sZ    ((.. 	4
 	( 	5~VV1AVUEVVrU   c                     d S rN   rW   r   s     rT   calculate_target_resultsz!NameNode.calculate_target_resultsY	  r   rU   c                     | j         }|7|j        s0|j        s)|j        s"|j        j        s|                                  dS dS r>  )r   r  rU  r  r   rx  r  s     rT   r=  zNameNode.check_const\	  s\    
 "     
#	 
 NN5trU   c                 j    | j         }|j        s$|j        s|j        s|                                  dS dS r>  )r   
is_cglobalrU  r  r{  r  s     rT   r|  zNameNode.check_const_addrg	  sD    
  	E$6 	%:J 	!!!5trU   c                 d    | j         j        o| j         j         p| j         j        o| j         j        S rN   )r   r  r  rU  r  rX   s    rT   r   zNameNode.is_lvaluen	  s;    J" '
&&
 J# &J%	
rU   c                 4    | j         j        o| j        j         S rN   )r   r  r   r   rX   s    rT   r   zNameNode.is_addressablew	  s    z%Jdi.J*JJrU   c                     dS r   rW   rX   s    rT   r   zNameNode.is_ephemeralz	  s	     qrU   c                 `    | j         }|sdS | j         j        r| j        s
d|j        z  S |j        S )N<error>(*%s))r   is_cpp_optionalr_  r   r  s     rT   r  zNameNode.calculate_result_code	  sA    
 	9:% 	)dn 	)U[(({rU   c                    | j         }|d S |j        r|j                            |j                   |j        r	|j        rd S |j        r|j        j        s
J d            |	                    | j         j
                  }|j        rt          j        }n|j        j        }| j        so|                    |                                 d|d|d           |                    d|                                 z             |                    d           |j                            t%          j        dd                     |                    d	|                                 d|d           | j        s|                    d
           |                    |                    |                                 | j                             |                     |           d S |j        r|j        j        s|j        j        s
J d            |	                    | j         j
                  }|j                            t%          j        dd                     |                    |                                 d|d|                    |                                 | j                             |                     |           d S |j        s|j        r|j        j        rv|j        j        s
J d            |	                    | j         j
                  }|j        j        r|j                            t%          j        dd                     |                    d	|                                 d|d|                    |                                 | j                             n|j                            t%          j        dd                     |                    d|                                 d|j        j        d|d|                    |                                 | j                             |                     |           d S |j        s|j        s|j        s|j        j        r| j        s| j        o| j         }|j        j        o| j        }|j         o| j        }|r |j        !                    |j"                  }n|j        #                    |j"                  }|r7|r7|j        j        s|s|r)|$                    | j        || j%        |           d S d S d S d S |j&        rL|j         rG| j        rB|j        !                    |j"                  }|$                    | j        ||           d S d S d S d S )N,Python global or builtin not a Python objectz = PyObject_GetItem(, );if (unlikely(!%s)) {PyErr_Clear();GetModuleGlobalNameObjectHandling.cz__Pyx_GetModuleGlobalName(r   GetBuiltinNamez = __Pyx_GetBuiltinName(rc  GetNameInClassz__Pyx_GetNameInClass(unbound_check_code)'r   utility_coder   r   r  r  is_pyclass_attrr   rq   intern_identifierrr   r   builtins_cnamer,  namespace_cnamer  r   r  r	   r   r   r   r  r  r  r  r  from_closurer   r  
allow_nullr  r   cpp_optional_check_for_null_coder   check_for_null_codeput_error_if_unboundr  r  )	rY   r   r   interned_cname	namespaceraise_unboundmemslice_checkoptional_cpp_checkr  s	            rT   r  zNameNode.generate_result_code	  s,   
=F 	B--e.@AAA S	^ S	^F" Q	^:)YY+YYYY!33DJODDN 8"1		!K7	? -

!		&() ) )
 

1DKKMMABBB

+,,,--'(=?QRRT T TJJJKKMMMM"NN$% % % ?  

3JJt..t{{}}dhGGHHH  &&&&& 7	^ek&A 7	^:)YY+YYYY!33DJODDN--'(8:LMMO O OJJ''tx@@@BC C C
   &&&&& *	^5#3 *	^8S *	^:)YY+YYYY!33DJODDN{* K 11+,ACUVVX X X


&//txHHHJK K K K  11+,<>PQQS S S


333&//txHHH	JK K K   &&&&&^ 	^u/ 	^53E 	^If 	^ #6tO<O  #Z:Ut?UN!&!6!Q4;Q! Q%*Z%P%PQVQ\%]%]""%*Z%C%CEK%P%P"! ym y9O ySa yew y))$(E4;Pew)xxxxxy y y y y y  	^%"7 	^D<R 	^!&!L!LU[!Y!Y%%dhJ\%]]]]]	^ 	^ 	^ 	^ 	^ 	^rU   c                 
   | j         }|d S | j         j        j        r8t          |t                    r#| j        s|j        st          | j        d           |j	        r|j        j
        s
J d            |                    | j         j                  }| j         j        j        }|j        rd}	n{|j        j        rd}	t"          j        }n`|j        rB| j        dk    rdnd}
|j                            t-          j        |
d                     d	|
z   }	nJ t1          |                      |                    | j        |	d|d|d|                                d           t6          r!t9          d           t9          d|z             |                    |           |                    |           |j        r)|                    d|j        j         j!        z             d S d S | j        j"        r| #                    ||           n"| j        j$        r| %                    ||           d
}| j        j
        r9| j&        r1|'                    |           |j(        p| j         j)        p| j         j*        }|r| +                    |d           d}|j(        r<| ,                    ||-                    | .                                                     n| j/        s| j0        r<| 1                    ||-                    | .                                                     n>| ,                    ||-                    | .                                                     nd
}|r|2                    |           | j        j"        s|se|r|3                                }|dk    rWti          || j        | 5                                d|d| j        j
        r| 5                                nd || j6                   n|                    | 5                                d|d           n|7                    | .                                          }tq          | j                  rD|                    d| 5                                d| 5                                d|d           nE|| 5                                k    r-|                    | 5                                d|d           t6          r!t9          d           t9          d|z             |9                    |           n)|:                                r|9                    |           |                    |           d S )Nz?Literal list must be assigned to pointer at time of declarationr  __Pyx_SetItemOnTypeDictPyDict_SetItemrQ   SetNewInClassSetNameInClassr  __Pyx_F(r  r`  z"NameNode.generate_assignment_code:z"...generating disposal code for %szPyType_Modified(%s);T)r  r    = ;new (&) decltype(){};z)...generating post-assignment code for %s);r   r   r  r   ListNodelhs_of_first_assignmentin_module_scoper   r   r  rq   r  rr   r,  r  	is_memberr  r   moddict_cnamer  r   r   r	   r   r  r<  r   r   printr  r  r   parent_typetypeptr_cnamer    generate_acquire_memoryviewslicer  generate_acquire_bufferr  r  r  r  r  r  r  r  r   r  r  r  r  r  r   r  r  r  r<   r  r  )rY   r   r   r  r   r   r   r  r   setternassignedis_external_refr  s                 rT   r  z!NameNode.generate_assignment_code	  s    
=FJO" 	_z#x'@'@ 	_4	_=@=P	_$(]^^^  a	!:)YY+YYYY!33DJODDN
(8I * 3, 	*)"0		& *'+yI'='=OOCS 11+2I!M_2`2`aaa!A)d5kk)))!!FFII"NNMMOOOO	%& & & # B:;;;:S@AAA&&t,,,NN4    B

1 ;2@A B B B B BB B
 y+ 855c4@@@@$ 8 ,,S$777Hy$ 3
 ' 3,,T222&+&6&j$*:O&jSWS]SjO& E,,Tt,DDD#H' 	-00s}}TZZ\\7R7RSSSS# -#1 \ $ 9 9$djjll@[@[ \ \ \ \ $ 8 8s}}TZZ\\?Z?Z [ [ [ [',H& 3,,T2229/ 8 M, M!$!4!4!6!6*c113 $dh.2kkmmmmVVV D151F PD /1F	H H H H !JJT[[]]]]FFF'KLLLL!$!7!7

!E!E*4955 M JJJW[WbWbWdWdWdWdflflfl'mnnnn#t{{}}44 JJT[[]]]]FFF'KLLL& M>???EKLLL11$7777##%% 811$777NN4     rU   c           	          ddl m} |                    |                                 | j        | j        ||| j         | j                   dS )z
        Slices, coercions from objects, return values etc are new references.
        We have a borrowed reference in case of dst = src
        r(   r  )	lhs_cnamer   lhs_posr   r   r  first_assignmentN)r  r  put_acquire_memoryviewslicer  r   r   r  r  )rY   r   r   r  s       rT   r  z)NameNode.generate_acquire_memoryviewsliceR
  sf    
 	!     ..kkmmYH..!_ 	/ 	. 	. 	. 	. 	.rU   c                 P   t          |t                    p|j        }|r(|                    |                                           }nf|j                            | j        j        d          }|	                    |d|                    |                                           d           ddl
m} |                    |                                 || j        | j         | j        |           |s4|	                    d|z             |j                            |           d S d S )	NFr  r  r  r(   r  )is_initializedr   r   r  )r   r  r   r  r   r  r  r   r   r   r  r  put_assign_to_bufferr  r  r   r  )rY   r   r   
pretty_rhsrhstmpr  s         rT   r  z NameNode.generate_acquire_bufferb
  s'     X..=#+
 	K]]4::<<00FF^11$*/e1TTFJJVVVS]]4::<<-H-H-H-HIJJJ##DKKMM64:7;7S3S(,t 	$ 	= 	= 	=  	0JJy6)***N''/////	0 	0rU   c                    | j         d S | j         j        r| j         j        j        }|                    | j         j                  }|rd}nd| j         j        z  }|                    d|d|d|d|                    | j                  d	           d S | j         j	        r|j
                            t          j        dd	                     |                    | j         j                  }d
t          j        d|d}|r6|                    d|d|                    | j                  d           d S |                    | j        |           d S | j         j        j        s| j         j        j        r| j        s| j        r"|s |                    | j        | j                    | j         j        r|                     |d|           |rK| j        rD|                    |                                 |                                 | j                    d S |                    |                                 |                                 | j                    d S d S t=          | j        d           d S )NzPyErr_Clear(); elsezT{ PyErr_Clear(); PyErr_Format(PyExc_NameError, "name '%%s' is not defined", "%s"); }zif (unlikely(PyObject_DelItem(r  z>) < 0)) { if (likely(PyErr_ExceptionMatches(PyExc_KeyError)))   }PyObjectSetAttrStrr  __Pyx_PyObject_DelAttrStr(r`  if (unlikely(zW < 0)) { if (likely(PyErr_ExceptionMatches(PyExc_AttributeError))) PyErr_Clear(); else T)r  r  r  z!Deletion of C names not supported)r   r  r,  r  r  rr   r   r   r   r  r   r   r	   r   r   module_cnamer<  r   rq   r   r  r  r  r  r  put_xdecref_clearr  r   r   r  r   )rY   r   r  r   r  key_error_codedel_codes          rT   r  zNameNode.generate_deletion_codev
  s   :FZ' -	A
(8I!33DJODDN! %!6 mJO$  JJJ !yy...%~~tx000023 3 3 3 3 Z# 	A--'(<>PQQS S S!33DJODDNN###^^^5H! :


 $88T__TX%>%>%>%>@A A A A A
 %%dh99999Z_( 	ADJO,N 	A? C% D.@ D--dh
CCC:( l((4Xj(kkk% C$*< C**4;;==$**,,59Z + A A A A A ))$++--7;z> * C C C C CC C $(?@@@@@rU   c           
      V   t          | dd          r| j        d         | j        d         | j        d         t          | j                  z
  dz
  f}| j        j        rd\  }}nd\  }}|                    |t          ||| j        z  t          | j                                       d S d S )	N	is_calledFr   r(   r5   )py_callzpython function (%s))c_callzc function (%s)size)r   r   r   rr   r   rq   r  r6   )rY   r   r   styletexts        rT   r  zNameNode.annotate
  s    4e,, 	]8A;TXa[3ty>>-IA-MNCy$ :?tt9tMM#~eTDI5ECPTPYNN[[[\\\\\	] 	]rU   c                 ,    | j         r| j         j        S d S rN   )r   r  rX   s    rT   rO  z*NameNode.get_known_standard_library_import
  s    : 	<:;;trU   rP  rR  )6r[   r\   r]   r   r  ru  r  r  r   r  r  r  r  r   rz  rA  rO  r   r2  r&  r  r  rb  re  rm  r8  r:  r  r<  rD  r  rs  re  r  r  r  r;  r?  rV  r  r=  r|  r   r   r   r  r  r  r  r  r  r  rO  r^   r_   s   @rT   r  r    s        G#EJMJJEM% % %  # # #8N N N     
> > > > >&>* >* >* >*@  % % %N	 	 	U U UT T T!' !' !'F  (  ,  ,! ! ! 7K	 	 	 	g g g(9 9 9  3 3 3 3 3*W W W  	 	 	  
 
 
K K K  
  Y^ Y^ Y^v INGKn! n! n! n!`. . . 0 0 0(0A 0A 0A 0Ad] ] ]      rU   r  c                   .    e Zd ZeZdgZd ZdZd Zd Z	dS )BackquoteNodeargc                     | j                             |          | _         | j                             |          | _         d| _        | S rl  )r>  r<  r   r   r   s     rT   r<  zBackquoteNode.analyse_types
  s<    8))#..8..s33rU   zBackquote expressionc                 B    t          | j        j                  | _        d S rN   )r  r>  r   rX   s    rT   r(  z'BackquoteNode.calculate_constant_result
  s    #DH$<==rU   c           
         |                     |                                 d| j                                        d|                    |                                 | j                             |                     |           d S )Nz = PyObject_Repr(rc  )r   r  r>  r   r   r   r  r  s     rT   r  z"BackquoteNode.generate_result_code
  s    

""$$$$''tx@@@B	C 	C 	C
 	T"""""rU   N)
r[   r\   r]   r   r   r   r<  re  r(  r  rW   rU   rT   r=  r=  
  sV        
 DwH   )K> > ># # # # #rU   r=  c                   <    e Zd ZeZdZdZdZg dZd Z	dZ
d Zd ZdS )	
ImportNodeNFT)module_name	name_listmodule_namesc           
           j         _|                                j        r?|j        d         s*t          j        |                                j        j        vrd _         nd _          j        	                    |          }|
                    |           _         j        j        sJ  j        r5 j        	                    |          }|
                    |           _        nd j        j        v rtt           j        j         fdt!          t"          j         j        j                            d                    D                       	                    |           _         S )N
py2_importr   r   c                 H    g | ]}t          j        j        ||           S )r"  )r   rD  r   )rc   partrY   s     rT   r   z,ImportNode.analyse_types.<locals>.<listcomp>
  sE     F F F %T%5%9W[\\\F F FrU   r   )r~   r  parent_modulerk   r7   r   r  future_directivesrD  r<  r   rY  rE  r   	TupleNoder   mapr   r0  rI  rF  )rY   rs   rD  rE  s   `   rT   r<  zImportNode.analyse_types
  sm   :!!/ N<0*#2B2B2D2D2L2^^^


&44S99&99#>>1111> 	"44S99I&99#>>DNND$*** )$*:*> F F F F <d>N>T>Z>Z[^>_>_``F F F ! ! ! }S!!  rU   zPython importc           
      8   | j         j        sJ | j         j        }| j        dk    r| j        s| j        s| j        r| j        j        sJ | j        dk    rt          j	        dd          }d}nt          j	        dd          }d}|j
                            |           |d| j                                         d| j        r| j                                        nd	d
}nq|j
                            t          j	        dd                     d| j                                         | j        r| j                                        nd| j        fz  }| j        dk    rO|t          v rFt          |         \  }}}|j
                            t          j	        ||                     |d|d
}|                    |                                 d|d|                    |                                 | j                             |                     |           d S )Nr   ImportDottedModulezImportExport.c__Pyx_ImportDottedModuleImportDottedModuleRelFirst __Pyx_ImportDottedModuleRelFirstr
  r  r  r`  Importz__Pyx_Import(%s, %s, %d)r  r  ; )rD  rY  r   r~   rE  get_top_level_modulerF  r   r	   r   r   r   r   r,   r   r  r   r   r  )rY   r   rD  r  helper_funcimport_code	code_name	code_files           rT   r  zImportNode.generate_result_code  s.   1111&,:??4>?$:S?  4(3333zQ*67KM]^^8*67SUeff@--l;;; **,,,,151BN!++---NNKK --k.EhP`.a.abbb4 **,,.2nE((***#
8 K
 :??{.FFF0H0U-KI--k.EiQZ.[.[\\\&1kk;;;?K

KKMMMMKK##DKKMM48<<<> 	? 	? 	? 	T"""""rU   c                     | j         j        S rN   )rD  r   rX   s    rT   rO  z,ImportNode.get_known_standard_library_import*  s    %%rU   )r[   r\   r]   r   r   rF  rX  r   r   r<  re  r  rO  rW   rU   rT   rC  rC  
  sk        & DL G;;;H  , "K## ## ##J& & & & &rU   rC  c                   P     e Zd Zg ZdZdZd
dZd Zd Zd Z	d Z
 fdZd	 Z xZS )ScopedExprNodeNTc                     |	|| _         d S | j        rt          j        |          | _         d S | j         s	d | _         d S d S rN   )
expr_scopehas_local_scoper   ComprehensionScope)rY   outer_scopera  s      rT   
init_scopezScopedExprNode.init_scope=  sS    !(DOOO! 	#$7DDDOOO 	#"DOOO	# 	#rU   c                 0    |                      |           d S rN   )re  r   s     rT   analyse_declarationsz#ScopedExprNode.analyse_declarationsE  s    rU   c                     d S rN   rW   r   s     rT   analyse_scoped_declarationsz*ScopedExprNode.analyse_scoped_declarationsH      rU   c                     | S rN   rW   r   s     rT   r<  zScopedExprNode.analyse_typesL      rU   c                     | S rN   rW   r   s     rT   analyse_scoped_expressionsz)ScopedExprNode.analyse_scoped_expressionsP  rl  rU   c                 b   t          t          |           j        }| j        r| j        j        s ||           d S |                    d           g }t          d | j        j        	                                D                       D ]4\  }}|j
        s(|j        j        r|j        r|                    |           5|s" ||           |                    d           d S |                                }|                                } ||           |                     ||           |                    d          }|                    |           |j        |fgt+          t-          |                                |                    z   D ]Z\  }	}
|                    |	          r@|                    |	           |                     ||           |                    |
           [|                    |           |                    d           |                    |           ||_        d S )Nz{ /* enter inner scope */c              3   *   K   | ]}|d          
|V  dS )r   NrW   rc   r   s     rT   rf   z:ScopedExprNode.generate_evaluation_code.<locals>.<genexpr>^  s.      [[SWXYSZ[t[[[[[[rU   z} /* exit inner scope */
exit_scope)rP   r_  r  rb  ra  var_entriesr   sortedentriesitemsr  r   rq   r  r  new_loop_labelsnew_error_label_generate_vars_cleanup	new_labelput_gotoerror_labelr  zipget_loop_labels
label_used	put_labelset_loop_labels)rY   r   generate_inner_evaluation_code
py_entries_r   old_loop_labelsold_error_labelrr  label	old_labelrS   s              rT   r  z'ScopedExprNode.generate_evaluation_codeT  sK   ).~t)D)D)]&# 	4?+F 	**4000F

.///
[[0G0M0M0O0O[[[[[ 	- 	-HAu# -:) -ej -%%e,,, 	**4000JJ1222F ..00..00&&t,,, 	##D*555 ^^L11
j!!!#'#3_"E!F!%c$*>*>*@*@/&R&R!S!S"T 	) 	)E9u%% )u%%%++D*===i(((z"""

-..._---*rU   c                     |D ]J}|j         r,|                    |           |                    |d           5|                    |           Kd S )Nrv  )r  put_var_gotrefput_var_decref_setput_var_xdecref_clear)rY   r   r  r   s       rT   ry  z%ScopedExprNode._generate_vars_cleanup  sj     	2 	2E 2##E***''y9999**51111	2 	2rU   rN   )r[   r\   r]   r   ra  rb  re  rg  ri  r<  rn  r  ry  r^   r_   s   @rT   r_  r_  .  s         HJ O# # # #        *+ *+ *+ *+ *+X2 2 2 2 2 2 2rU   r_  c            
           e Zd ZeZdZdZdZdZdZ	dgZ
d ZdZ ej         ej        ej         ej        dej        d          g                    Zd Zd Zd	 Zd
 Zd Zd Zd ZdS )IteratorNodeNFsequencec                    | j         r| j         }| j                            |          | _        | j        j        j        s| j        j        j        r#| j        j        j        s| j        j        | _        n| j        j        j        r.t          | j	        | j                                      |          S | 
                                rF| j        j        j        d         j        }t          | j	        |d                              |          S | j                            |          | _        | j        j        t          t           fv r| j                            d          | _        d| _        | S )N)r  r   T)r  reversed!'NoneType' object is not iterabler(   )ra  r  r<  r   rT  r  r  r  CppIteratorNoder   is_reversed_cpp_iteration	arg_tupler   r>  r   r   r   rG  r   )rY   rs   r  s      rT   r<  zIteratorNode.analyse_types  sC   ? 	"/C33C88M' 	e4=+=+D 	eM&0	e *DII], 	e"48dmDDDRRSVWWW++-- 	e}.3A6:H"48hNNN\\]`aaa M<<SAADM}!i%<<< $ ? ?@c d drU   zIterating over Python objectitc                    t          | j        t                    r.| j        j        r"t	          | j        j        j                  dk    sdS | j        j        }|j        ri|j        dk    r^|j	        j
        sdS | j        j        j        d         }t          |t                    r$|j        j        r|j        j	        }|j        j        S dS )z
        Returns True if the 'reversed' function is applied to a C++ iterable.

        This supports C++ classes with reverse_iterator implemented.
        r(   Fr  r   )r   r  r.  r  r   r   r&  r   rr   r   r  CoercionNoder>  r   r  )rY   funcr>  s      rT   r  z&IteratorNode.is_reversed_cpp_iteration  s     4=.99 	'	,/0G0L,M,MQR,R,R5}%< 	-DI33:( u-).q1C#|,, - -gmx,,urU   c                 D    | j                             | j        p|          S rN   )r  rO  ra  r   s     rT   rO  zIteratorNode.type_dependencies  s    }..t/E#FFFrU   c                     | j                             |          }|j        s|j        r|S |j        r)|j                            d          }||j        j        S n	|j	        r|S t          S )Nbegin)r  r   rT  r  r  r,  r-  r   return_typerq   r   )rY   rs   sequence_typer  s       rT   r   zIteratorNode.infer_type  s    0055! 	!]%9 	!  ' 	!!'..w77E z-- !& 	!  rU   c           
      F   | j         j        }|j        r
J d            |j        s|j        rt          d          |t          t          fv }|s| j        r
J d            |j	         | _
        | j
        rJ|                    d| j                                         d| j                                         d           |s| j
        rf|                    |                                 d| j                                         d	|                                 d
           |j                            t           j        d          | _        | j        r|t          u rd}nd}|                    | j        d|d|                                 d
           |                    d           |                    |                    | j        | j                             |                    d           |                    d| j        z             n|                    d| j        z             |sT|j                            | j        d          | _        | j
        rO|                    d| j        z             |                    d           |                    d| j        z             |                    |                                 d| j                                         d|                    |                                 | j                             |                     |           |                    | j        d|                                 d|                    | j        | j                             | j
        r|                    d           d S d S )NFz+Should have been changed to CppIteratorNodez#for in carray slice not transformedzBinternal error: reversed() only implemented for list/tuple objectszif (likely(PyList_CheckExact(z)) || PyTuple_CheckExact(z)) {r  z; __Pyx_INCREF(r  r  __Pyx_PyList_GET_SIZE__Pyx_PyTuple_GET_SIZEr
  #if !CYTHON_ASSUME_SAFE_MACROS#endifz--%s;r  
%s = NULL;} else {z	%s = -1;  = PyObject_GetIter(rc  " = __Pyx_PyObject_GetIterNextFunc(r   )r  r   r  rT  r  r   r   r   r  r|  may_be_a_sequencer   r   r  r  r  r   r^  counter_cnameerror_goto_if_negr   _func_iternext_typeiter_func_ptrputr   r  )rY   r   r  is_builtin_sequencelen_funcs        rT   r  z!IteratorNode.generate_result_code  s   *% 	HGGGGG! 	G]%9 	G EFFF+	:/FF" 	k}jj&jjjj%2%B!B! 	0JJJM++----M++----/0 0 0
  	;$"8 	;JJ''))))   
 "&!=!=, "> "@ "@D} ; I--6HH7H

T-?-?-?4;;====YZZZ

;<<<

411$2DdhOOPPP

8$$$

7T%778888

9t'99:::" 	H!%!=!=d>Vch!=!i!iD% ;

<$*<<===

:&&&t'99:::JJ''))))''tx@@@B C C C   &&&
 JJ"""DNN$4$4$4$4''(:DHEEEG H H H ! 	JJsOOOOO	 	rU   c                    | j         s
J d            |dv sJ d|d|                                 d}d}| j        j        rdt	          | j        j                  }| j        j        |}d}n:t          | j        j        j        t                    r|| j        j        j        z  }d}|r"|
                    d| j         d	|d
           n|
                    d           |
                    dt          j        d|d           |
                    d           |
                    |                    t          j        | j                             |
                    d           |
                    d| j         d	t          j        d
           |
                    d           | j        rd}nd}|
                    d           |
                    |d|d|                                 d| j         d|d| j         |d|                    d| j                             |
                    d           |
                    |d|                                 d| j         d| j         |d|                    || j                  
           |                    |t$                     |
                    d           d S )Nz/internal error: counter_cname temp not prepared)ListTuple__Pyx_Pyz
_GET_SIZE(r`  FTif (z >= z) break;{zPy_ssize_t r  r  r  r  r   z--++<#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFSz = Pyz
_GET_ITEM(r  z); __Pyx_INCREF(rc  rW  r  #elsez = __Pyx_PySequence_ITEM()r  r   r  r   r   r   r   r   r   r&   r   r   quick_temp_cnamer  r   r  r   r  r   )rY   	test_nameresult_namer   
final_sizesize_is_safe
item_countinc_decs           rT   generate_next_sequence_itemz(IteratorNode.generate_next_sequence_item  s   !TT#TTTT------2;))T^^=M=M=M=MN
=0 	$T]/00J}(0'
#DM5E}UU $'$-*C*SS
# 		JJJ1C1C1CZZZPQQQQJJsOOOJJJ0G0G0GTUUUJJ7888JJt--f.EtxPPQQQJJx   JJJ1C1C1CVE\E\E\]^^^JJsOOO= 	GGG

QRRR

		    """""&&sDH555
	 	 	 	

7

    """""''TX>>>@	A 	A 	A 	^444

8rU   c                    | j         j        }| j        r|                    d| j        z             |t
          u r|                     d||           d S |t          u r|                     d||           d S | j        r|                    d| j	        z             |                    d| 
                                z             |                     d||           |                    d           |                     d||           |                    d           |                    d           |                    d	           |                    |d
| j	        d| 
                                d           |                    d|z             |                    d           |                    d           |                    d           |                    d|                    | j                  z             |                    d           |                    d           |                    d           |                    |t                     |                    d           d S )Nzif (%s < 0) break;r  r  zif (likely(!%s)) {z$if (likely(PyList_CheckExact(%s))) {r  r   z} else r  r  r
  r  r  z&PyObject* exc_type = PyErr_Occurred();if (exc_type) {z\if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();else %sbreak;)r  r   r  r   r  r   r  r   r  r  r   r  r   r   r  r   )rY   r  r   r  s       rT   generate_iter_next_result_codez+IteratorNode.generate_iter_next_result_codeJ  sL   *= 	BJJ+d.@@AAAI%%,,V[$GGGFj((,,Wk4HHHF! 	 JJ+d.@@AAAJJ=@P@PPQQQ,,V[$GGGJJz""",,Wk4HHHJJsOOOHHY

3

"""    "	# 	# 	#
 	

)K7888

;<<<

$%%%

qrrr

9ttx888999

3

8

3^444

3rU   c                     | j         r|j                            | j                    | j        r&|j                            | j                   d | _        t                              | |           d S rN   )r  r  r  r  r   r  r  s     rT   r  zIteratorNode.free_tempso  sn     	<N''(:;;; 	&N''(:;;;!%DD$'''''rU   )r[   r\   r]   r   r   r  r  r  is_asyncrb  r   r<  re  r   r~  	CFuncTypeCFuncTypeArgr  r  rO  r   r  r  r  r  rW   rU   rT   r  r    s	        DMMHHO|H  ( 1K-*-.Bj.B!#J#D**CTJJ$/ /  
  &G G G
 
 
; ; ;z5 5 5n# # #J( ( ( ( (rU   r  c                   X    e Zd ZdZdZdZdZdZdgZd Z	d Z
d	 Zd
 Zd Zd Zd Zd ZdS )r  Nr   r  TFr  c                     | j         sdndS )N)r  end)rbeginrend)r  rX   s    rT   get_iterator_func_namesz'CppIteratorNode.get_iterator_func_names  s    '+}L:LLrU   c                 6   | j         j        }|j        r|j        }|                                 \  }}|j                            |          }|j                            |          }||j        j        r|j        j        r3t          | j
        d|d| j         j                   t          | _        | S ||j        j        r|j        j        r3t          | j
        d|d| j         j                   t          | _        | S |j        j        }|j        r|j        d         rd| _        |                    | j
        d||j        j        g          	 3t          | j
        d|d| j         j                   t          | _        | S |                    | j
        d|g          3t          | j
        d|d| j         j                   t          | _        | S |                    | j
        d|g          3t          | j
        d	|d| j         j                   t          | _        | S || _        nm|j        r4||j        j        k    st          | j
        d
|d|d           || _        n2t          | j
        d|d| j         j        d           t          | _        | S )Nzmissing z() on 
cpp_localsr   !=z missing operator!= on result of r  z missing operator++ on result of zmissing operator* on result of zincompatible types for z() and z()zresult type of z must be a C++ class or pointer)r  r   r  r  r  r,  r-  rU  r   r   r   r/   r  r  rk   extra_dereferencelookup_operator_for_types)rY   rs   r  
begin_nameend_namer  r  	iter_types           rT   r<  zCppIteratorNode.analyse_types  s   * 	4)3M#;;==
H#**:66!((22Mz. :?  $((JJJ@R@RSTTT"DIKKx, 8=  $((HHHdm>P>PQRRR"DIKJ*	! 	#~l+ -),&,,H 457 7 ;?? dhhPZPZPZ\`\i\n\n oppp&	,,TXti[IIQdhhPZPZPZ\`\i\n\n oppp&	,,TXsYKHHPdhhzzz[_[h[m[m nooo&	!DII 	#!555dhh***V^V^V^ _```!DII$((ZdZdZdfjfsfxfxfxyzzz"DIrU   c                    | j         j        }|                                 \  }}| j                                         rO|                    |                                 d| j                                         | j        |d           d S |}|j        rt          j	        |j
                  }|j        s|j        j        d         rd| _        |j                            |d          | _        |                    | j        d|j        rdnd| j                                         d	           |                    |                                 d| j        | j        |d           d S )
Nr  z();r  ->Fr  &r  r  )r  r   r  r;  r   r  cpp_attribute_opr  r   r~  r  r  r   rk   r  r  cpp_sequence_cnamer  )rY   r   r  r  r  	temp_types         rT   r  z$CppIteratorNode.generate_result_code  s   *4466
A=""$$ 	! JJ$$&&&%%

	      *	) Q !+ 3M4O P PI# 1t'7'B<'P 1,0D) +/.*F*Fy]b*F*c*c'

4+B+B+B2;2B+J33+J+/=+H+H+J+J+J+JL M M M 

KKMMMM++))JJ	  ! ! ! ! !rU   c           
         |                                  \  }}|                    d| j        |                                 d| j        p| j                                        | j        |d           |                    |d| j        |                                 d           |                    d| j        |                                 d           d S )Nif (!(z != z())) break;z = *r  r  )r  r   r  r  r  r  r  )rY   r  r   r  r  s        rT   r  z.CppIteratorNode.generate_iter_next_result_code  s     22448


../I4=3G3G3I3II-- " 	# 	# 	# 	

#..' 	( 	( 	( 	


 6 6FGGGGGrU   c                 N    | j         sd S t                              | |           d S rN   )r  r   r  r  s     rT   r  z.CppIteratorNode.generate_subexpr_disposal_code  s0    & 	 F//d;;;;;rU   c                 N    | j         sd S t                              | |           d S rN   )r  r   r  r  s     rT   r  z"CppIteratorNode.free_subexpr_temps  s0    & 	 F##D$/////rU   c                     | j         s6t                              | |           t                              | |           t                              | |           d S rN   )r  r   r  r  r  r  s     rT   r  z&CppIteratorNode.generate_disposal_code  sW    & 	4 33D$???''d333''d33333rU   c                     | j         r|j                            | j                    t                              | |           d S rN   )r  r  r  r   r  r  s     rT   r  zCppIteratorNode.free_temps   sC    " 	AN''(?@@@D$'''''rU   )r[   r\   r]   r  r  r  r   r  r   r  r<  r  r  r  r  r  r  rW   rU   rT   r  r  x  s         GH|HM M M. . .`"! "! "!HH H H < < <0 0 04 4 4( ( ( ( (rU   r  c                   4    e Zd Zd Zd Zd ZddZd Zd ZdS )	NextNodec                 T    t                               | |j                   || _        d S rN   rf  r  r   iteratorrY   r  s     rT   r  zNextNode.__init__  %    hl333 rU   c                     d S rN   rW   r   s     rT   rs  zNextNode.nogil_check  rj  rU   c                 6    | j                             |          S rN   )r  rO  r   s     rT   rO  zNextNode.type_dependencies  s    }..s333rU   Nc           	         || j                             |          }|j        s|j        r|j        S |j        r?|                    | j        d|g          j        j	        }t          j        |d          }|S t          | j        | j         j        t          | j        dt          j                            }|                    |          S )Nr   T)remove_fakerefPY_SSIZE_T_MAXr-  rY  )r  r   r  rT  r  r  r  r   r   r  r   remove_cv_refr\  r  r]  r^  )rY   rs   iterator_type	item_typefake_index_nodes        rT   r   zNextNode.infer_type  s      M44S99M 	3=#9 	3 **' 	355dhm_UUZfI"04PPPI (]+dh.>#-#?A A AB B BO
 #--c222rU   c                 ^    |                      || j        j                  | _        d| _        | S rl  )r   r  r   r   r   s     rT   r<  zNextNode.analyse_types,  s(    OOC);<<	rU   c                 `    | j                             |                                 |           d S rN   )r  r  r  r  s     rT   r  zNextNode.generate_result_code1  s(    44T[[]]DIIIIIrU   rN   )	r[   r\   r]   r  rs  rO  r   r<  r  rW   rU   rT   r  r    sx        ! ! !  4 4 43 3 3 3$  
J J J J JrU   r  c                   6    e Zd ZdgZdZeZdZdZd Z	d Z
d ZdS )	AsyncIteratorNoder  Tr(   Fc                     t           S rN   r   r   s     rT   r   zAsyncIteratorNode.infer_typeC      rU   c                     | j         r| j         }| j                            |          | _        | j        j        j        s4t          | j        d           | j                            |          | _        | S )Nz*async for loops not allowed on C/C++ types)ra  r  r<  r   rq   r   r   r   r   s     rT   r<  zAsyncIteratorNode.analyse_typesF  sj    ? 	"/C33C88}!- 	B$(HIII M<<SAADMrU   c           
      l   |j                             t          j        dd                     |                    |                                 d| j                                        d|                    |                                 | j	                             | 
                    |           d S )N	AsyncIterCoroutine.cz  = __Pyx_Coroutine_GetAsyncIter(rc  )r   r   r	   r   r   r  r  r   r   r   r  r  s     rT   r  z&AsyncIteratorNode.generate_result_codeO      ))+*A+}*]*]^^^

KKMMMMM##%%%%##DKKMM48<<<> 	? 	? 	? 	T"""""rU   N)r[   r\   r]   r   r  r   r   r   rb  r   r<  r  rW   rU   rT   r  r  5  s^         |HHDGO    # # # # #rU   r  c                   .    e Zd ZeZdZd Zd Zd Zd Z	dS )AsyncNextNoder(   c                 T    t                               | |j                   || _        d S rN   r  r  s     rT   r  zAsyncNextNode.__init__c  r  rU   c                     t           S rN   r  r   s     rT   r   zAsyncNextNode.infer_typeg  r  rU   c                     | S rN   rW   r   s     rT   r<  zAsyncNextNode.analyse_typesj  rp  rU   c           
      l   |j                             t          j        dd                     |                    |                                 d| j                                        d|                    |                                 | j	                             | 
                    |           d S )Nr  r  z! = __Pyx_Coroutine_AsyncIterNext(rc  )r   r   r	   r   r   r  r  r   r   r   r  r  s     rT   r  z"AsyncNextNode.generate_result_codem  r  rU   N)
r[   r\   r]   r   r   r   r  r   r<  r  rW   rU   rT   r  r  X  s\         DG! ! !    # # # # #rU   r  c                   *    e Zd ZddgZdZdZd Zd ZdS )WithExitCallNoder   
await_exprTNc                     | j                             |          | _         | j        r| j                            |          | _        t          j        | _        d| _        | S ry  )r   r<  r  r   r)  r   r   r   s     rT   r<  zWithExitCallNode.analyse_types  sQ    I++C00	? 	A"o;;C@@DO*	rU   c                    | j         r"|                    d| j        j        z             | j                            |           |j                            t          d          }|	                    | j
                   |j                            t          j        dd                     |                    |d| j        j        d| j                                        d           |                    | j        j        t          	           | j                            |           | j                            |           |                    |                    || j
                             |                    |t                     | j        r| j                            ||d
           |                    |d| j                                        d           | j                            |           | j                            |           | j        rB|                     |           |                    |                                 d|d           |                    |t          	           | j        r-|                    | j
        |                                            |j                            |           | j         r|                    d           d S d S )N	if (%s) {Fr  PyObjectCallr   = __Pyx_PyObject_Call(r  z, NULL);r  T)source_cnamedecref_sourcer  r   = __Pyx_PyObject_IsTrue(r  r   )test_if_runr   	with_statexit_varr   r  r  r  r   r  r   r   r   r	   r   r  r  r  r  r   r  r  r   r  r  r  r<  r  )rY   r   
result_vars      rT   r  z)WithExitCallNode.generate_evaluation_code  s    	>JJ{T^%<<===	**4000^11.U1SS
dh))+*A.+0 +0 	1 	1 	1

JJN###I  	! 	! 	! 	dn5NKKK	((...	T"""

4**:tx@@AAA
N333? 	-O44T
bf4gggJJZZZ1J1J1L1L1L1LMNNNO99$???O&&t,,, 	X%%d+++JJDKKMMMM:::VWWWj~>>> 	;!!$(DKKMM:::##J/// 	JJsOOOOO	 	rU   )r[   r\   r]   r   r  r  r<  r  rW   rU   rT   r  r  v  sH         %HKJ  % % % % %rU   r  c                   0    e Zd ZeZd Zd Zd Zd Zd Z	dS )ExcValueNodec                 <    t                               | |           d S rN   r   r  )rY   r   s     rT   r  zExcValueNode.__init__  s    $$$$$$rU   c                     || _         d S rN   var)rY   r  s     rT   set_varzExcValueNode.set_var  s    rU   c                     | j         S rN   r  rX   s    rT   r  z"ExcValueNode.calculate_result_code  s	    xrU   c                     d S rN   rW   r  s     rT   r  z!ExcValueNode.generate_result_code  r   rU   c                     | S rN   rW   r   s     rT   r<  zExcValueNode.analyse_types  rp  rU   N)
r[   r\   r]   r   r   r  r  r  r  r<  rW   rU   rT   r  r    sf        
 D% % %          rU   r  c                   J    e Zd Zg ZddZd Zd Zd Zd Zd Z	d Z
d	 Zd
 ZdS )TempNodeNc                 ~    t                               | |           || _        |j        rt          | _        d| _        d S rl  )r   r  r   rq   r   r$  r   )rY   r   r   rs   s       rT   r  zTempNode.__init__  s=    $$$$	 	/ .DrU   c                     | S rN   rW   r   s     rT   r<  zTempNode.analyse_types  rp  rU   c                     d| _         d S ry  r  r   s     rT   r8  z#TempNode.analyse_target_declaration      rU   c                     d S rN   rW   r  s     rT   r  zTempNode.generate_result_code  r   rU   c                 R    |j                             | j        d          | _        d S )NTr  )r  r  r   
temp_cnamer  s     rT   allocatezTempNode.allocate  s$    .66tyT6RRrU   c                 R    |j                             | j                   d | _        d S rN   )r  r  r(  r  s     rT   releasezTempNode.release  s%    ##DO444rU   c                 0    	 | j         S #  J d            xY w)NFz-Remember to call allocate/release on TempNode)r(  rX   s    rT   r  zTempNode.result  s'    	?"	IIIIIs   	 c                     d S rN   rW   r  s     rT   r  zTempNode.allocate_temp_result  r   rU   c                     d S rN   rW   r  s     rT   r  zTempNode.release_temp_result  r   rU   rN   )r[   r\   r]   r   r  r<  r8  r  r)  r+  r  r  r  rW   rU   rT   r!  r!    s         H         S S S          rU   r!  c                       e Zd Zd ZdS )
PyTempNodec                 T    t                               | |t          j        |           d S rN   )r!  r  r   r   )rY   r   rs   s      rT   r  zPyTempNode.__init__  s%    $Z%>DDDDDrU   Nr[   r\   r]   r  rW   rU   rT   r0  r0    s(        E E E E ErU   r0  c                   2    e Zd Zg ZddZd Zd Zd Zd ZdS )RawCNameExprNodeNc                 V    t                               | ||           |	|| _        d S d S )Nr  )r   r  r   )rY   r   r   r   s       rT   r  zRawCNameExprNode.__init__  s6    $$///DJJJ rU   c                     | S rN   rW   r   s     rT   r<  zRawCNameExprNode.analyse_types  rp  rU   c                     || _         d S rN   r   )rY   r   s     rT   	set_cnamezRawCNameExprNode.set_cname
  s    


rU   c                     | j         S rN   r8  rX   s    rT   r  zRawCNameExprNode.result  rs  rU   c                     d S rN   rW   r  s     rT   r  z%RawCNameExprNode.generate_result_code  r   rU   NN)	r[   r\   r]   r   r  r<  r9  r  r  rW   rU   rT   r4  r4    si        H   
          rU   r4  c                   2    e Zd ZeZdZdZdgZd Zd Z	d Z
dS )JoinedStrNodeTzString concatenationvaluesc                 8    fd| j         D             | _         | S )Nc                 `    g | ]*}|                                                             +S rW   )r<  r   )rc   vrs   s     rT   r   z/JoinedStrNode.analyse_types.<locals>.<listcomp>'  s3    YYYqs++>>sCCYYYrU   )r?  r   s    `rT   r<  zJoinedStrNode.analyse_types&  s%    YYYYT[YYYrU   c                     dS rw  rW   rX   s    rT   r?  zJoinedStrNode.may_be_none*      urU   c                 J	   |                     | j                   t          | j                  }|j                            t          d          }|j                            t          j        d          }|j                            t          j	        d          }|
                    |d|d|                    || j                             |                    |t                     |
                    d|z             |
                    d|z             t          | j                  D ];\  }}|                    |           |                    |           d|                                z  }d	|                                z  }	d}
t#          |t$                    r	 |j                            d
           d}	|j                            d           d}
t+          t          |j                            }n# t,          $ r |	dk    r|t/          t1          t2          |j                            }|dk     r$d}	t+          t          |j                            }n+|dk    r$d}	t+          t          |j                            }n	 Y n,w xY wt#          |t4                    r|j        j        j        rd}
|
s$|
                    |d|	d|d|	d|d
           |
                    |d|d           |                    |           |
                    d|d|d|                                d           |                    |           |                    |           =|                     | j                   |                      |           |j!        "                    tG          j$        dd                     |
                    d| %                                |||||                    |                                 | j                  fz             | &                    |           |'                    |t                     |j        (                    |           |j        (                    |           |j        (                    |           d S )NTr  Fz = PyTuple_New(rc  r  z	%s = 127;z__Pyx_PyUnicode_GET_LENGTH(%s)z"__Pyx_PyUnicode_MAX_CHAR_VALUE(%s)rQ  255zus-asciii   65535i   1114111z = (z > z) ? z : r  z += zPyTuple_SET_ITEM(r  r  JoinPyUnicodeStringTools.cz-%s = __Pyx_PyUnicode_Join(%s, %d, %s, %s); %s))r  r   r   r?  r  r  r   r   r^  c_py_ucs4_typer   r   r  	enumerater  r  r   r   r%  r   r:  rx   UnicodeEncodeErrormaxrP  r  FormattedValueNoder   r  r  r  r  r  r   r   r	   r   r  r  r  r  )rY   r   	num_itemslist_varulength_varmax_char_varir   ulengthmax_char_valueis_asciimax_chars               rT   r  z&JoinedStrNode.generate_evaluation_code.  s   dh$$	>//4/PPn22:3O\a2bb~33J4MZ_3``

HHII##Hdh7779 	: 	: 	: 	.111

9{*+++

;-... -- +	" +	"GAt))$///%%d+++69I9IIGADNNDTDTTNH$,,  3J%%k222%*NJ%%j111#H$ "#dj//22GG# * ! ! !%..#&s3
';';#<#<#f,,-4N&)#dj//&:&:GG%..-6N&)#dj//&:&:GG !!$ D"455  $*/:T   _

 LL...,,,P\P\P\^ _ _ _JJkkk777;<<<!!$'''JJJ(((AAAt~~GWGWGWGWXYYY..t444OOD!!!!dh!!$'''))+*A/Sb*c*cddd

BKKMM##DNN$4$4dh??FA A 	B 	B 	B 	T"""h777##H---##K000##L11111s   '8HBJJN)r[   r\   r]   r   r   r   re  r   r<  r?  r  rW   rU   rT   r>  r>    s^        
 DG(KzH    K2 K2 K2 K2 K2rU   r>  c                   P    e Zd ZddgZeZdZdZdZdddd	d
j	        Z
d Zd Zd ZdS )rO  r   format_specTNzString formattingPyObject_UnicodePyObject_ReprPyObject_ASCII__Pyx_PyNumber_IntOrLong)sradc                     dS rw  rW   rX   s    rT   r?  zFormattedValueNode.may_be_none  rD  rU   c                 X   | j                             |          | _         | j        r| j        j        rL| j        r| j        j         n| j         j        j        }| j         j                            ||          r|| _        | j        r2| j                            |                              |          | _        | j        k| j                             |          | _         | j        sE| j	        r| j	        dk    r3| j         j        t          u r | j                                         s| j         S | S )N)rZ  r_  )r   r<  rZ  rY  r   default_format_speccan_coerce_to_pystringc_format_specr   conversion_charr   r?  )rY   rs   rg  s      rT   r<  z FormattedValueNode.analyse_types  s   Z--c22
 	34#3#E 	36:6FoD,22DJOLoMz55c}5UU 3%2" 	[#/==cBBUUVYZZD%66s;;DJ# &T-A &TEY]`E`E`:?l224:;Q;Q;S;S2:%rU   c                    | j         | j        j        j        s| j        j                            | j                                        || j                   }|                    |                                 d|d|                    |                                 | j                             | 	                    |           d S | j        
                                }| j        j        t          u o| j                                         }| j        rd}| j        
                                }nd}t          j        }| j        }|dk    r|rd }|r_|                     |          }|J d|z              |d|d}|j                            t)          j        d	d
                     |dz  }nb| j        r.|j                            t)          j        dd
                     n-|j                            t)          j        dd
                     |                    |                                 d|d|d|d|                    |                                 | j                  	           | 	                    |           d S )Nr  rW  __Pyx_PyObject_Format__Pyx_PyObject_FormatSimpler_  z(invalid conversion character found: '%s'r
  r`  PyObjectFormatAndDecrefrJ  	AndDecrefPyObjectFormatPyObjectFormatSimpler  rc  )rg  r   r   rq   convert_to_pystringr  r   r   r   r  r   r   r?  rZ  r   empty_unicoderh  find_conversion_funcr   r   r	   r   )	rY   r   convert_func_callvalue_resultvalue_is_unicodeformat_funcrZ  rh  fns	            rT   r  z'FormattedValueNode.generate_result_code  s   )$*/2M) $
 C C
!!##T4+=!? !?JJ!!!''tx@@@B C C C   &&&Fz++--:?l:[4:CYCYC[C[?[ 	/1K*4466KK 8K .K.c!!&6!"O 	R**?;;B>>#MP_#_>>>')rr<<<8L--'(A?SSU U U;&KK 	R--'(8/JJL L L L --'(>PPR R R 	

KKMMMMKKLLKK##DKKMM48<<<> 	? 	? 	? 	T"""""rU   )r[   r\   r]   r   r   r   r   rg  re  rj   rr  r?  r<  r  rW   rU   rT   rO  rO  |  s         'HDGM%K  '	 
 
     "/# /# /# /# /#rU   rO  c                   2    e Zd ZdZej        Zd Zd Zd Z	dS )ParallelThreadsAvailableNodea*  
    Note: this is disabled and not a valid directive at this moment

    Implements cython.parallel.threadsavailable(). If we are called from the
    sequential part of the application, we need to call omp_get_max_threads(),
    and in the parallel part we can just call omp_get_num_threads()
    c                     d| _         | S ry  r  r   s     rT   r<  z*ParallelThreadsAvailableNode.analyse_types      rU   c                 2   |                     d           |                     d| j        z             |                     d| j        z             |                     d           |                     d| j        z             |                     d           d S )N#ifdef _OPENMPz2if (omp_in_parallel()) %s = omp_get_max_threads();z else %s = omp_get_num_threads();r  %s = 1;r  r   r  r  s     rT   r  z1ParallelThreadsAvailableNode.generate_result_code  s    

#$$$

G<@NK 	L 	L 	L

5FGGG

7

9t~-...

8rU   c                     | j         S rN   r  rX   s    rT   r  z#ParallelThreadsAvailableNode.result  
    ~rU   N
r[   r\   r]   __doc__r   
c_int_typer   r<  r  r  rW   rU   rT   ry  ry    sU           D  
      rU   ry  c                   2    e Zd ZdZej        Zd Zd Zd Z	dS )ParallelThreadIdNodez/
    Implements cython.parallel.threadid()
    c                     d| _         | S ry  r  r   s     rT   r<  z"ParallelThreadIdNode.analyse_types  r{  rU   c                     |                     d           |                     d| j        z             |                     d           |                     d| j        z             |                     d           d S )Nr}  z%s = omp_get_thread_num();r  r  r  r  r  s     rT   r  z)ParallelThreadIdNode.generate_result_code  sr    

#$$$

/$.@AAA

7

9t~-...

8rU   c                     | j         S rN   r  rX   s    rT   r  zParallelThreadIdNode.result  r  rU   Nr  rW   rU   rT   r  r    sU           D  
      rU   r  c                        e Zd Zd Zd Zd ZdS )_IndexingBaseNodec                     | j                                         p+| j         j        t          t          t
          t          t          fv S rN   )rZ  r   r   r2   r   r   r"   r   rX   s    rT   r   z_IndexingBaseNode.is_ephemeral  s>     y%%'' Q49>Xz><>Q ,Q 	QrU   c                 f    | j                                         o| j                                        S rN   )rZ  r|  r[  r=  rX   s    rT   r|  z"_IndexingBaseNode.check_const_addr%  s)    y))++H
0F0F0H0HHrU   c                 b    | j         j        r| j         j        j        rdS n| j         j        rdS dS r>  )r   r  r  rT  r  rX   s    rT   r   z_IndexingBaseNode.is_lvalue(  sF     9! 	y&/ u Y 	4 trU   N)r[   r\   r]   r   r|  r   rW   rU   rT   r  r    sG        
Q Q QI I I    rU   r  c                       e Zd Z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#dZd Zd Zd Zd Zd Zd Zd Zd$dZd ZdZd Zd Zd Zd Z 	 	 d%d Z!d! Z"d&d"Z#dS )'r\  rZ  r[  NTFc                 H    | j         j        | j        j                 | _        d S rN   )rZ  r   r[  rX   s    rT   r(  z#IndexNode.calculate_constant_resultH  s    #y89STrU   c                     | j                             |          }| j                            |          }	 ||         S # t          $ r }|                     |           Y d }~d S d }~ww xY wrN   )rZ  r2  r[  	Exceptionr6  )rY   r1  rZ  r[  r5  s        rT   r2  zIndexNode.compile_time_valueK  s    y++D11
--d33	-; 	- 	- 	-))!,,,,,,,,,	-s   > 
A(A##A(c                     | j         }|                                o7| j                                        o|j        o|j        j        p|j        j        S rN   )rZ  r;  r[  r   r  rT  rY   rZ  s     rT   r;  zIndexNode.is_simpleS  sU    y   KTZ%9%9%;%; KIK#'9#3#Ity7I	LrU   c                     | j         j        }|rS|j        rdS t          | j        t
                    r0|t          t          t          t          t          t          t          fv rdS t                              |           S rw  )rZ  r   r  r   r[  	SliceNoder   r"   r   r   r2   r   r   r   r?  rY   r  s     rT   r?  zIndexNode.may_be_noneX  st    IN	 	!" u$*i00 !^X|!0)Z!I I I 5##D)))rU   c                     d S rN   rW   r   s     rT   r8  z$IndexNode.analyse_target_declarationd  r   rU   c                    | j                             |          }|rd|j        s|j        rT| j        j        r| j        j        }n| j        g}t          j        | j	        |d           }|
                    ||          S | j        j        s| j        j        rvddlm} |                    |j                   | j        j        r| j        gnt!          | j        j                  }t#          j        ||                    ||                    S |j        sm| j                            |          }|<	 t-          |          }t#          j        ||          S # t0          t2          f$ r Y nw xY wt5          | j	        d           d S )N)r   positional_argskeyword_args)r  r(   r  z*Array size must be a compile time constant)rZ  re  r  python_type_constructor_namer[  r   r   r   TemplatedTypeNoder   analyser   r  r  r   view_utility_coder  r   MemoryViewSliceTypeget_axes_specsrq   r2  r  
CArrayTyper   r   r   )rY   rs   r  template_values	type_noder  axesr[  s           rT   re  zIndexNode.analyse_as_typeg  s   I--c22	 	N% N)O N:5 3&*joOO'+zlO!3$3!%' ' '	 !((	(BBB$ N
(J N(((((($$Z%ABBB'+z':U
||TZ_@U@U!5iAZAZ[^`dAeAefff* 
N
55c::$G #E

  *4YFFF '	2    dh LMMMts   2E E*)E*c                     g }| }|j         rR|j                            |          }|r(|j        r!|j        r|                    |j                   |j        }|j         R|S rN   )r[  rZ  re  r  modifier_namer  r[  )rY   rs   r  modifier_nodemodifier_types        rT   analyse_pytyping_modifiersz$IndexNode.analyse_pytyping_modifiers  s     	( 	0).>>sCCM >-"L >%3>  !<===)/M ( 	0 rU   c                 l    | j                             |          | j                            |          z   S rN   )rZ  rO  r[  r   s     rT   rO  zIndexNode.type_dependencies  s-    y**3//$*2N2Ns2S2SSSrU   c                    | j                             |          }| j        j        rV|j        rt
          S |j        rt          S |t          t
          t          t          t          t          fv r|S |j        r|S t          S | j                            |          }|r|j        st          | j        t                     rb|t          u rt"          j        S |t          u r|S |t          u rt"          j        S t          | j         t(                    rt          S |t          t          fv r"t+          || j         | j        |          }||S n|j        s|j        r|j        S |j        rrt          | j        t                     rX| j                                        r>| j        j        }|dk     r
||j        z  }d|cxk    r|j        k     rn nZ|j        |         S nL|j        rE|j        dk    r	 |j        dk    r|j        S t#          j         |j        |j!        dd                    S | j        j"        rf|j        r_|}| j        j#        D ]N}|j        s nFtI          | j%        tM          | j         j%        |          |                              |          }O|S |j'        rU G d d          } || j%        |           || j%        |          g}	|(                    d	|	          }
|
|
j)        j*        S tW          |          r6tW          |          r'| j        |f}tY          t[          ||g                    S |t          t          fv r|S t          S )
Nr   r   r(   r  rY  c                       e Zd Zd ZdS ))IndexNode.infer_type.<locals>.FakeOperandc                 :    | j                             |           d S rN   )__dict__update)rY   r  s     rT   r  z2IndexNode.infer_type.<locals>.FakeOperand.__init__  s    M((.....rU   Nr2  rW   rU   rT   FakeOperandr    s#        / / / / /rU   r  )r   r   []).rZ  r   r[  r   r  r   r  r   r   r"   r   r   r   r   r  r   r]  r   rK  c_uchar_typer  r   r  rT  r  r1  r   r   r8  r2  ndimr  r  r  r   r   r\  r   r   r  lookup_operatorr   r  r<   rH   rB   )rY   rs   r  
index_typer  r[  rz  ra  r  operands
index_funcindex_with_types               rT   r   zIndexNode.infer_type  s   I((--	: 	&" &!!+ &##|Z-y*F F F ! - &   &%Z**3//
 +	_*+ +	_z$*g/N/N +	_L(( "00h&&  n,,!..DIy11 _
 &%z95554DJD D D	($$ )! _Y%7 _ **$ _DJ)H)H _:1133 ; J6Eqyy/E2222IN22222(3E::- _>Q&&>Q&&$?*%9)/9>Z[Z\Z\K]^^^:- 	%)2N 	%%MZ_ % %$7 E )$($)-Vc9d9d9d01!3 !3 !33=:c??  %$! 
	3/ / / / / / / / y999z:::H ,,T8<<J%!229%% 	T/**E*E 	T#z:6O4Y@QRRSSS x000 "!rU   c                 0    |                      |d          S )NTgetting)analyse_base_and_index_typesr   s     rT   r<  zIndexNode.analyse_types  s    00d0CCCrU   c                     |                      |d          }|j        j        rt          | j        d           || u r1|                                st          | j        d|j        z             |S )NT)settingzAssignment to const dereference%Assignment to non-lvalue of type '%s')r  r   r  r   r   r   r>  s      rT   rD  zIndexNode.analyse_target_types  sp    00d0CC9 	?$(=>>>4<< 0 0<$(CdiOPPPrU   c                 @   |r| j                             |          | _         | j         j        j        rt          j        | _        | S | j        j        }|j        d         s;|r%t          | j        j
        | j        j                   nt          | j                   |sWt          | j        t                    r=t          j        | j        j                  r| j                            |          | _        | j         j        j        }|snt          | j         t&                    s|rR| j         j        j        s"| j         j        j        s0| j         j        j        s| j                             |          | _         |                     ||          }||S |j        | _        | j         j        }|j        s| j                            |          | _        | j        j        | _        | j        j        r| j        j        | _        |j        rZ|rt=          | j        dd           n| j        j         dv r| j         S | j                             |          | _         | j         j        }|j!        r| "                    ||||          S |j        s|j        r| #                    ||          S |j$        r| %                    ||          S |j        r| &                    |          S |j'        r| (                    |||          S tS          | j        d|z             t          j        | _        | S )N
wraparoundz%cannot assign to Unicode string indexr(   r}   )r   rI  z'Attempting to index non-array type '%s')*rZ  r<  r   r  r   r/   r[  r   rk   r   r   r   r   r]  r   long_literalr   r   r   r  r  r  rT  analyse_as_buffer_operationr   rU  original_index_typer  r  r  r   r   r   rq   analyse_as_pyobjectanalyse_as_c_arrayr  analyse_as_cppanalyse_as_c_functionr1  analyse_as_c_tupler   )	rY   rs   r  r  analyse_baser   is_memslicereplacement_noder  s	            rT   r  z&IndexNode.analyse_base_and_index_types  s   
  	5	//44DI9>" 	 #-DIK:&~l+ 	3 3&tz'7IIII&tz222  	<Jtz7;; 	<@RSWS]Sc@d@d 	<66s;;DJin7 	>
49i @ @ 	>H 	>y~' >	0E >I` > I88==	;;CII'##Y
IN	% 	+11#66DJ'+zD$'4 R+/+C+Q(( 	+  %DH&MUVWWWWWZ/7::9$ I88==	 IN	  	++C7GLLL 	!3 	**3999# 	&&sG444# 		--c222  	**3AAA$(;   #-DIKrU   c                    | j         j        }| j        j        j        rH|t          ur?t          | j        dd           | j                            |          | _        d| _        n-| j        j        j	        r|t          ur|r|j
        d         s|t          t          t          fv ri| j        j        j        rP|j
        d         rCt          | j        t                     r1| j                                        r| j        j        dk    rd| _        nd| _        | j                            t(          j        |                              |          | _        | j                            |           n&| j                            |          | _        d| _        | j        j        j	        r|t2          u rt(          j        | _        n| j        j        j	        r/|t          u r&|rt(          j        | _        nt(          j        | _        n|r0|t:          t          t<          t2          t          t          fv r|| _        nd }|t          t          fv r.| j        j        j	        rt?          || j         | j        |          }|t          t          t          fv r| j                              d          | _         ||j!        stD          | _        n|| _        | #                    ||           | S )	NzItem lookup of unicode character codes now always converts to a Unicode string. Use an explicit C integer cast to get back the previous integer lookup behaviour.r(   r}   boundscheckr  r   r  &'NoneType' object is not subscriptable)$rZ  r   r[  r  r   r   r   r   r   r  rk   r   r   r"   signedr   r]  r   r   r  r   r^  rK  r  create_to_py_utility_coder   rK  r  r  r   r   r   rG  rq   r   wrap_in_nonecheck_node)rY   rs   r   r  r  r  r  s          rT   r  zIndexNode.analyse_as_pyobjectN  s   IN	:?* 	y	/I/IDHhopr r r r 66s;;DJDLLZ_# 		(B(B 
!N=9
!"y*n&MMM!Z_3 N #| < N (
G<< N "Z;;==	 N CG*B\`aBaBa  --j.JCPPaabeffDJ$>>sCCCC66s;;DJDL:?! 	&i<&?&? #1DIIZ_# 	&	^(C(C 2&3		 '1		 	&)
NHl\egq'rrr!DIIIY
333
8N34DJD D D	Y
I>>> I778`aa	 	(=  +		%	##C111rU   c                 |   | j         j        }|j        | _        | j        j        rt	          j        | j                  | _        |r|| _        no| j        j        j        r+| j                            t          j	        |          | _        n3| j        j        j
        s"t          | j        d| j        j        z             | S )NzInvalid index type '%s')rZ  r   r  r  r   CReferenceTyper[  rq   r  r^  r  r   r   )rY   rs   r   r  s       rT   r  zIndexNode.analyse_as_c_array  s    IN	'	9! 	="1$)<<DI 	I!DIIZ_( 	I--j.JCPPDJJ' 	I$(5
GHHHrU   c                    | j         j        }|                    d| j         | j        g          }|@t	          | j        d|d| j        j        d           t          j        | _        d| _        | S |j        }|j	        r|j
        }|j        | _        |j        | _        | j        r@|sd| _        t          |           r(|                    t!          j        dd                     | j                            |j        d	         j        |          | _        |j        | _        |r)|j        j        st	          | j        d
| j        z             | S )Nr  z
Indexing 'z ' not supported for index type 'r  r  TCppExceptionConversionr  r   z#Can't set non-reference result '%s')rZ  r   r  r[  r   r   r   r/   r  r  r  r   r   r   r   r   r	   r   r  r   r  r  )rY   rs   r  r  r&  	func_types         rT   r  zIndexNode.analyse_as_cpp  sU   IN	&&tdi-DEE$((QZQZQZ\`\f\k\k\klmmm"-DI(DKM	 	,!+I(8(8 	j $#-d33 j$$[%<=UWg%h%hiiiZ))).*;*@#FF
)	 	O90= 	O$(ADIMNNNrU   c           	         | j         j        }|j        r|                     |           n|                     |          | _        d | _        |j        "t          | j	        d           t          | _        n| j        t          | _        nt          |j                  t          | j                  k    rLt          | j	        dt          |j                  dt          | j                             t          | _        n?|                    t          t          |j        | j                                      | _        | S )Nz)Can only parameterize template functions.z-Wrong number of template arguments: expected , got )rZ  r   rg  parse_indexed_fused_cdefparse_index_as_typestype_indicesr[  	templatesr   r   r/   r   ri  dictr}  rY   rs   r  s      rT   r  zIndexNode.analyse_as_c_function  s#   IN	 	d))#.... $ 9 9# > >DDJ"*dh KLLL&		"*&		Y())S1B-C-CCCdhhY011113t7H3I3I3I!L M M M&		%00c):MtO`6a6a1b1bcc	rU   c                    | j         j        }t          | j        t                    r| j                                        ry| j        j        }|j         |cxk    r|j        k     r&n n#|dk     r
||j        z  }|j        |         | _        n-t          | j
        d|d|d           t          j        | _        | S | j                             |          | _         |                     |||d          S )Nr   zIndex z out of bounds for 'r  Fr  r  r  )rZ  r   r   r[  r]  r   r   r8  r2  r   r   r   r/   r   r  )rY   rs   r  r  r  r[  s         rT   r  zIndexNode.analyse_as_c_tuple  s    IN	dj'** 	ptz/M/M/O/O 	pJ.E%8888).88888199Y^+E%07		dhhuuiii)* * * '1	K	44S99DI44S'SZin4ooorU   c                    t          | j        t                    r| j        j        }n| j        g}| j        }|j        }d}|j        rddlm} |j	        r'|
                    |          }||j        }|j        }|}|                    ||j                  \  }	}}
|	rt          | j        ||          }n$t          | j        ||          }n|j        s|j        r|j        st%          |          |j        k    rd}fd|D             }|j        ryt'          d |D                       }|r]t)          |          D ]M\  }}|j        rAt-          |j        |j        |j        |j                  }|                              }|||<   Nnt'          d	 |D                       }|r3t7          | j        ||          }t          | j        t8                    rJ ||                    |          }|S )
zI
        Analyse buffer indexing and memoryview indexing/slicing
        Nr(   r  )indicesrZ  Tc                 :    g | ]}|                               S rW   rA  )rc   r[  rs   s     rT   r   z9IndexNode.analyse_as_buffer_operation.<locals>.<listcomp>  s'    III5..s33IIIrU   c              3   T   K   | ]#}|j         j        p|j        p|j         j        V  $d S rN   )r   r  r   r<   rc   r[  s     rT   rf   z8IndexNode.analyse_as_buffer_operation.<locals>.<genexpr>  sL       ). ).! 
)YU^Yuz?Y). ). ). ). ). ).rU   r   r   r   c              3   .   K   | ]}|j         j        V  d S rN   r   r  r  s     rT   rf   z8IndexNode.analyse_as_buffer_operation.<locals>.<genexpr>   s'      (P(Pu):(P(P(P(P(P(PrU   )r   r[  rO  r   rZ  r   r   r  r  r^  merged_indicesunellipsifyr  MemoryViewSliceNoder   MemoryViewIndexNoder  r<   r   allrL  r   SliceIntNoder   r   r   r<  BufferIndexNode	CloneNode)rY   rs   r  r  rZ  r  r  r  r  have_slicesnewaxesr\  do_replacementrT  r[  s    `             rT   r  z%IndexNode.analyse_as_buffer_operation  sd    dj),, 	#joGGzlGyI	' #	A$$$$$$$ -!%!4!4W!=!=!-9D $	I,G,6,B,B7IN,[,[)K' ]#6txW[#\#\#\  #6txW[#\#\#\    	AI$= 	A( ACLLIN,J,J#' IIIIIII, Q%( ). ).%,). ). ). &. &.N & 3'0'9'9 3 3GAe$~ 3(4UYekX]Xbinis(t(t(t(-(;(;C(@(@-2
%((P(P(P(P(P%P%PN! A'6txW['\'\'\$)$*i@@@@@'/==c7KKrU   c                     |j         d         r| j                                        sd S | j                            d          | _        d S )N	nonecheckr  )rk   rZ  r?  rG  rY   rs   r  s      rT   r  z IndexNode.wrap_in_nonecheck_node
  sG    ~k* 	$)2G2G2I2I 	FI//0XYY			rU   c                    t          | j        t                    r| j        j        }n| j        g}g }|D ]L}|                    |                    |                     |d         |rt          |j        d            d S M|S )NrI  znot parsable as a type)r   r[  rO  r   r  re  r   r   )rY   rs   requiredr  r  r[  s         rT   r  zIndexNode.parse_index_as_types  s    dj),, 	#joGGzlG 	 	E 5 5c : :;;;B' ?%)%=>>>tt ( rU   c                    t           j        | _        d| _        | j        j        }g }| j        j        s| j        j        r |                    | j        j	                   nCt          | j        t                    r)| j        j        D ]}|                    |j	                   |                     |d          }|| j                            |          | _        | j        j        j        st#          | j	        d           n^| j        j        j        x| j        _        | _        | j        j        x| j        _        | _        d| j        _        d| _        d| j        _        d| _        dS t)          |          D ]\  }}|                    |          ||<   |                                }t/          |          t/          |          k    rt#          | j	        d          S t/          |          t/          |          k     r-|t/          |                   }	t#          | j	        d|	z            S t1          |||          D ]D\  }
}t3          fd|j        D                       st#          |
d	          c S j        r dS Et9          t1          ||                    }|                    |          }|j        rt#          | j	        d
           dS | j        j                                        D ]}|                     |          rh|| _        | j        j        r$|j        | _        d| _        | j        j!        | _!        d| j        j        _        || j        _        |j        | j        _         dS tE          d          )aK  
        Interpret fused_cdef_func[specific_type1, ...]

        Note that if this method is called, we are an indexed cdef function
        with fused argument types, and this IndexNode will be replaced by the
        NameNode with specific entry just after analysis of expressions by
        AnalyseExpressionsTransform.
        TF)r  Nz)Can only index fused functions with typeszToo many types specifiedzHNot enough types specified to specialize the function, %s is still fusedc                 :    g | ]}                     |          S rW   )r  )rc   rd   specific_types     rT   r   z6IndexNode.parse_indexed_fused_cdef.<locals>.<listcomp>U  s'    KKKQ--a00KKKrU   zType not in fused typez6Index operation makes function only partially specificz!Couldn't find the right signature)#r   r/   r   is_fused_indexrZ  r[  r   rZ  r  r   r   rO  r   r  r<  r   r  r   r   r  rL  specialize_fusedget_fused_typesr   r}  rl   typesr  r  ri  rg  r  r  r#  r   )rY   rs   r  	positionsr>  specific_typesrT  r   fused_typesrd   r   
fused_typerh  r  r   s                 @rT   r  z"IndexNode.parse_indexed_fused_cdef  s    )	"IN		: 	*!8 	*TZ^,,,,
I.. 	*z * *  ))))2232GG!11#66DJ9?. 
'dh KLLLL 04y/JJ	$*-1Z_<	$(	!#"&
"'DF 00 	; 	;GAt $ 5 5c : :N1//11~[!1!111#=>>>  3{#3#333C//0A $EGH$I J J J /2)2@2=/? /? 	 	*C
 KKKK*:JKKKLL <S":;;;;;$(>$ % ![.!A!ABB##$566= 	I$(JL L L L L "Y^NNPP I I	<<	**  )DIy- 1 &/_
,0)#'9=+/DIO(%.DIN&/oDIOEE" $$GHHHrU   zIndexing Python objectc                 >   | j         j        t          t          t          fv r\| j         j        t          u rd}n2| j         j        t          u rd}n| j         j        t          u rd}nJ d| j         j        z              | j         j        j        rA| j                                         dd                    d | j        D                       d	S | j         j        j	        rD| j
        j        }|d
k     r|| j         j        j        z  }| j                                         d|S | j        j        s| j        j        r,| j        | j         j        k    rt          | j        d           d S d}|| j                                         | j
                                        fz  S )NzPyList_GET_ITEM(%s, %s)zPyTuple_GET_ITEM(%s, %s)z0((unsigned char)(PyByteArray_AS_STRING(%s)[%s]))Fz$unexpected base type in indexing: %s<,c                 6    g | ]}|                                 S rW   )rr  )rc   params     rT   r   z3IndexNode.calculate_result_code.<locals>.<listcomp>  s$    XXXU%6688XXXrU   >r   .fzInvalid use of pointer slicez(%s[%s]))rZ  r   r   r   r"   rU  r  joinr  r1  r[  r   r8  r  rT  r   r   )rY   
index_coder[  s      rT   r  zIndexNode.calculate_result_codez  s   9>i^DDDy~**6

:--7

>11O

UDty~UUUUY^( 	$	  """"XXdFWXXXYYYY[ [ Y^% 		$J.Eqyy,,#y//11115599	  DI$6 DI<W<Wdh >???#JTY--//1B1B1D1DEEErU   c                    | j         j        j        r| j        j        t          u }t          |j        j        d                   o;| j        j	        o/t          | j         j        t                    o| j         j        dk     }t          |j        j        d                   }d| j                                        | j        j	        rdpd| j        j        |||fz  S dS )Nr  r   r  z, %s, %d, %s, %d, %d, %dr(   r  )r[  r   r  rZ  r   rH  r   rk   r  r  r   r   r&   rr  to_py_function)rY   r   is_listr  r  s        rT   extra_index_paramszIndexNode.extra_index_params  s    :?! 	in	1GT%0>?? :(/:
 :MJJ 93q8: 
 t/:=IJJK-(??AA(/5A:(7[	12 2 2 2rU   c                    | j         sd S d }d }| j        j        rd}| j        j        j        rE| j        j        t          u rd}n| j        j        t          u rd}nd}t          j	        dd          }n| j        j        t          u rd}t          j	        dd          }ne| j        j        t          u r3| j        j        t          t          fv rd	}t          j	        dd          }nd
}|j                            t          j	        dd                     t          j	        dd          }n| j        j        r@| j        j        t          u r-| j        j        j        sJ d}d}t          j	        dd          }n| j        j        t$          u r;| j        j        j        sJ | j        j        sJ d}d}t          j	        dd          }n@| j        j        j        r| j        s(J d| j        d| j        j        d| j        d            ||j                            |           | j        j        j        r| j                                        }n| j                                        }| j        j        j        r| j        rt1          || j        |                                 d| j                                        d| j                                        d| j        j        r|                                 nd | j        | j                   n|dk    rdnd|z  }|                    |                                 d|d| j                                        d||                     |          d|                    ||                                 z  | j                  
           | j        j        r|                     |           d S d S ) Nr  __Pyx_GetItemInt_List__Pyx_GetItemInt_Tuple__Pyx_GetItemInt
GetItemIntr  __Pyx_PyDict_GetItemDictGetItem__Pyx_PyObject_Dict_GetItem__Pyx_PyObject_GetItemObjectGetItem__Pyx_GetItemInt_Unicodez(Py_UCS4)-1GetItemIntUnicoderJ  __Pyx_GetItemInt_ByteArray-1GetItemIntByteArrayFzunexpected type z and base type z for indexing (r`  r  [z];!%sz	%%s == %sr
  r  rc  )r   r   rq   r[  r  rZ  r   r   r
   r   r   r	   r   r   r   r   r   r  r"   r  r   r   r  r   r   r   r  r   r  r   r  )rY   r   r  error_valuer&  r  error_checks          rT   r  zIndexNode.generate_result_code  s   | 	F9  $	5 Kz% `9>Y..6HHY^z117HH1H1=lL^__9>Y..5H#.#:=J\#]#]LLY^~55$*/hXdMe:e:e<H#.#:=J\#]#]LL7H$55*6|EWXXZ Z Z#.#:?L^#_#_LLY& 	549>\+I+I:?))))1H'K&23FXXLLY^~--:?))))9####3HK&23H/ZZLL).- 	5$2F 	55 5			49>>>48885 5 5 5 #--l;;;:?! 	0**,,JJ--//J9>& 	P4+? 	P#D$("&++----1A1A1C1C1C1C"&*"3"3"5"5"5"57!%!6@D$d&;	= = = = $/&#8#8%%kK>WKJJKKMMMMHHI''))))J++D1111&&{T[[]]'BDHMMMOP P P 9  	'  &&&&&	' 	'rU   c                 n   | j         j        j        r| j        j        t          u r0|j                            t          j        dd                     d}n/|j                            t          j        dd                     d}| j         	                                }n1| j         
                                }| j        j        t          u rd}nd}|                    |                    |d	| j        
                                d
|d
||                     |          d	| j                             d S )NSetItemIntByteArrayrJ  __Pyx_SetItemInt_ByteArray
SetItemIntr  __Pyx_SetItemIntr  PyObject_SetItemr
  r  r`  )r[  r   r  rZ  r"   r   r   r	   r   r  r   r   r   r  r  r   )rY   
value_coder   r&  r  s        rT   generate_setitem_codezIndexNode.generate_setitem_code  sN   :?! 	.y~// 11+,A?SSU U U7 11+L:LMMO O O-**,,JJ--//Jy~**+ .

4))	##%%%%


''----/ H  	 	 	 	 	rU   c           
      "   |                      |           | j        j        r*|                     |                                |           no| j        j        t          u r.|                     ||          }|                     ||           n.| j        j        j        r| j	        r| j	        dk    r|r\|rZ| j
        |k    rOt          || j        | j        |                                 |                                | j
        || j                   nt          || j        |                                 d|                                d| j        j        r|                                 nd | j
        | j                   n?|                    |                                 d|                                d           |                     |           |                     |           |                    |           |                    |           d S )Nr   r  r  )r  r   rq   r0  r   rZ  r"   _check_byte_valuer  r   r   r   r   r  r  r   r   r  r  r  r  )rY   r   r   r  r   r   r/  s          rT   r  z"IndexNode.generate_assignment_code  s   --d3339  	<&&s}}====Y^~--//c::J&&z48888Y^( 	<T-A 	<dFZ^aFaFa$ A AT=QUd=d=d /tTXtyKKMM3::<<1E#T%:< < < < (dh"&++---->%)Y%:DDKKMMM($*?A A A A
 JJ"kkmmmmSZZ\\\\:< < < 	++D111%%%""4(((trU   c                 <   |j         j        sJ t          |j                               |                                }|                                r9d|j        cxk    rdk     rn n|S d}t          |j        d|j        z  d           n|j         t          j	        k    }| j
        sg }|j        s|j         j        r|                    d|z             |j        s1|j        r*|j         t          j	        t          j        t          j        fv s|                    d|z             |rp|                    d	d
                    |          z             |                    d|                    | j                  z             |                    d           |rd|z  }|S )Nr      Tz9value outside of range(0, 256) when assigning to byte: %sr(   r}   z%s < 0z%s > 255if (unlikely(%s)) {z || zFPyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)"); %sr   z((unsigned char)%s))r   r  r  r  r   r   r   r   r   r  r   r   r  r  r   r   c_schar_typer   r  r   )rY   r   r   r/  
needs_cast
conditionss         rT   r2  zIndexNode._check_byte_value/  s   x..SX...ZZ\\
""$$ 		=C'----#-----!!JCG2474GH    
 Z%<<Jz 	 J~ 9 9!!(Z"7888 ;[;%(X"/1G"/21 &1 &1 !!*z"9:::  

06;;z3J3JJKKK

<OODH--./ / / 

3 	<.;JrU   c                 `   |                      |           | j        j        j        rId}| j                                        }|j                            t          j        dd                     n1| j        	                                }| j
        j        t          u rd}nd}|                    |                    |d| j
        	                                d||                     |          d| j                             |                     |           |                     |           d S )	N__Pyx_DelItemInt
DelItemIntr  PyDict_DelItemPyObject_DelItemr
  r  r`  )r  r[  r   r  r  r   r   r	   r   r   rZ  r   r   r  r  r   r  r  )rY   r   r  r&  r  s        rT   r  z IndexNode.generate_deletion_codeS  s@   --d333:?! 
	.)H**,,J--'6HIIK K K K --//Jy~**+-

4))	##%%%%
''----	/
 H  	 	 	 	++D111%%%%%rU   )FFTTrR  rP  )$r[   r\   r]   r   r  r[  r  r(  r2  r;  r?  r8  re  r  rO  r   r<  rD  r  r  r  r  r  r  r  r  r  r  re  r  r  r  r0  r  r2  r  rW   rU   rT   r\  r\  8  s1         HLLNU U U- - -L L L

* 
* 
*    @  T T Tb" b" b"HD D D   HM26F F F FP8 8 8t    0  ,p p p$3  3  3 jZ Z Z
   YI YI YIv +KF F F4  "F' F' F'P  B INGK   B" " "H& & & & & &rU   r\  c                        e Zd ZdZddgZdZdZdZd ZddZ	d	 Z
d
 Zd Zd Zd Zd Zd Zd ZddZddZd Z fdZ xZS )r  z
    Indexing of buffers and memoryviews. This node is created during type
    analysis from IndexNode and replaces it.

    Attributes:
        base - base node being indexed
        indices - list of indexing expressions
    rZ  r  TFrW   c                 4    |                      |d           d S NFr  rA  r   s     rT   rD  z$BufferIndexNode.analyse_target_types  s!    3.....rU   c                    | j         j        s<t          | j         j                  s#t	          | j        d           t          | _        | S |sZ| j         j        j        j        st	          | j        d           n.d| _	        | j         j        j
        rd| j         j        j        _	        d| _        |                     ||           |                     |           | S )zz
        Analyse types for buffer indexing only. Overridden by memoryview
        indexing and slicing subclasses
        zCan only index buffer variableszWriting to readonly bufferTr  )rZ  r   r<   r   r   r   r/   r   writabler  r  
buffer_auxnone_error_messageanalyse_buffer_indexr  r  s      rT   r<  zBufferIndexNode.analyse_types  s     y  	)H)H 	$(=>>>"DIK 	F9?'0 Fdh <===='+$9>+ FAEDIO.>"J!!#w///##C(((rU   c                    t          | j        j                  r>d | j        D             }t	          t          | j        j        |                    | _        n5| j                            |          | _        | j        j        j        | _        | j        j        | _        |r!| j        j	        s| j        j         rd| _
        d S d S d S )Nc                      g | ]}||j         fS rW   r  )rc   idxs     rT   r   z8BufferIndexNode.analyse_buffer_index.<locals>.<listcomp>  s    #L#L#LS#(O#L#L#LrU   T)r<   rZ  r   r  rH   rB   rK  r  buffer_typerq   r   )rY   rs   r  index_with_type_lists       rT   rF  z$BufferIndexNode.analyse_buffer_index  s    49>** 	-#L#Lt|#L#L#L #$9$).J^$_$_``DII	22377DI	,DI9> 	 	- 	 1J 	 DLLL	  	  	  	 rU   c                     dS )zk
        Called by IndexNode when this node is assigned to,
        with the rhs of the assignment
        NrW   rY   r   s     rT   analyse_assignmentz"BufferIndexNode.analyse_assignment  s      rU   c                     |j         d         r| j                                        sd S | j                            | j                  | _        d S )Nr  )rk   rZ  r?  rG  rE  r   s     rT   r  z&BufferIndexNode.wrap_in_nonecheck_node  sI    ~k* 	$)2G2G2I2I 	FI//0GHH			rU   c                     | j         s| j        r1| j        j        r#t	          | j        d           t          | _        d S d S d S )Nz2Cannot access buffer with object dtype without gil)r\  r]  r   rq   r   r   r/   r   s     rT   rs  zBufferIndexNode.nogil_check  sV      	'D$9 	'y$ 'dh TUUU&			' '	' 	'rU   c                     d| j         z  S Nr  )buffer_ptr_coderX   s    rT   r  z%BufferIndexNode.calculate_result_code  s    ---rU   c                 j    | j         }| j         j        r|j        }|j                            |          S rN   )rZ  is_nonecheckr>  r   	get_entryr  s     rT   buffer_entryzBufferIndexNode.buffer_entry  s3    y9! 	8Dy""4(((rU   c                    |j                             t          j        |j        |j        j        rt          j        nt          j                  d          }|                    |d|	                                d           |S )NFr  r  r  )
r  r  r   r  r   r  c_ssize_t_typec_size_t_typer   r  )rY   r   ivarrets       rT   get_index_in_tempz!BufferIndexNode.get_index_in_temp  s    n***	-1Y-=[
)):C[] ] 	 +  
 	

dkkmmmm4555
rU   c                      j         r7 j        s j        r)j        j        d         rt           j        dd            fd j        D             x _        }ddl	m
}                                  }|j        j        r|j        j        }n|j        d         }||                    |d  j        D             |j        j         j        | j         	          fS )
z8
        ndarray[1, 2, 3] and memslice[1, 2, 3]
        r  z(Use boundscheck(False) for faster accessr(   r}   c                 <    g | ]}                     |          S rW   )r]  )rc   r[  r   rY   s     rT   r   z6BufferIndexNode.buffer_lookup_code.<locals>.<listcomp>  s*    )e)e)ePT$*@*@d*K*K)e)e)erU   r  negative_indicesc                 &    g | ]}|j         j        S rW   )r   r  )rc   r[  s     rT   r   z6BufferIndexNode.buffer_lookup_code.<locals>.<listcomp>  s    EEE49+EEErU   )r   index_signedsindex_cnamesrk   r   r   r`  r  )r  r\  r]  r   rk   r   r   r  index_tempsr  r  rW  r   r  r`  buffer_defaultsput_buffer_lookup_code)rY   r   rd  r  rW  r`  s   ``    rT   buffer_lookup_codez"BufferIndexNode.buffer_lookup_code  s)      	[$ [(= [#.}= [DH&PXYZZZZ *f)e)e)e)eX\Xd)e)e)ee; 	((**& 	J+0A%56HIV::EEEEE$'2t-!2 ; 4 4 4 	4rU   c                    |                      |           |                     ||           |                     |           |                     |           |                    |           |                    |           d S rN   )r  generate_buffer_setitem_coder  r  r  r  rY   r   r   r  s       rT   r  z(BufferIndexNode.generate_assignment_code  s    --d333))#t444++D111%%%""4(((trU   r  c           	         | j         j        }t          |          rt          |j                  r|j                            t          t          | j         j                            d          }|                    d|z             |                    d|d|d| j         	                                d           |                    |t          | j                  d|d	|	                                d
           |j                            |           d S |                     |          \  }}| j        j        j        r|j                            |j        d          }|                                }	|                    |d|d
           |                    d|z  | j        j                   |                    d|	d|d           |                    d|d|d	|	d
           |                    d|z  | j        j                   |j                            |           d S |                    d|d|d	|                                d
           d S )NFr  __Pyx_call_destructor(%s);r  r  r  r  r*  z= r  r  z*%sz__Pyx_INCREF(z); __Pyx_XDECREF(*r  r   )rZ  r   r<   r:   r  r  rH   rD   r   r  rA   r  r  rg  rJ  r  rq   buf_ptr_typer  r  r  )
rY   r   r   opr  r#  rW  ptrexprptrr   s
             rT   ri  z,BufferIndexNode.generate_buffer_setitem_code  s}   IN	9%% 	*CCH*M*M 	...{<	;W;W/X/Xej.kkC JJ3c9:::JJJSSS$)BZBZB\B\B\B\]^^^JJ%dl3333""$$$$	& ' ' '
 N'',,,F !% 7 7 = =g!- 	D ...|/H:? / A ACzz||HJJSSS'''2333US[$*:*@AAAJJJ###      JJJRRR:;;;eck4+;+ABBBN'',,,,, JJJSZZ\\\\BCCCCCrU   c                 N   t          | j        j                  rx|                                 }|                    d|z             |                    d|d|d| j                                        t          | j                  d           d S |                     |          \  }| _	        | j        j
        rj|                                 }|                    |d| j	        d           |                    d|d	|d
           |                    d|z             d S d S )Nrl  r  r  r  r  z = (PyObject *) *r  r.  z == NULL)) z = Py_None;z__Pyx_INCREF((PyObject*)%s);)r<   rZ  r   r  r   r  rA   r  rg  rS  rq   )rY   r   resrW  s       rT   r  z$BufferIndexNode.generate_result_code  s8   49>** 	++--CJJ3c9:::JJJ	((***%dl3333	5 6 6 6
 F-1-D-DT-J-J*d*9  	= ++--CJJ3338L8L8LMNNNJJJCCCMNNNJJ5;<<<<<	= 	=rU   c                     | j         D ]}|j                            |           d| _         t          t          |                               |           d S rw  )rd  r  r  rP   r  r  )rY   r   temprS   s      rT   r  z"BufferIndexNode.free_subexpr_temps.  sZ    $ 	. 	.DN''----ot$$77=====rU   r>  rP  )r  )r[   r\   r]   r  r   r\  r  rd  rD  r<  rF  rN  r  rs  r  rW  r]  rg  r  ri  r  r  r^   r_   s   @rT   r  r  l  s<         	"H O K/ / /   0
  
  
   I I I
' ' '. . .) ) )  4 4 4:   (D (D (D (DT= = =*> > > > > > > > >rU   r  c                   0    e Zd ZdZdZddZd Zd Zd ZdS )	r  TFc                    ddl m} t          |          | _        | j        }|                    || j        j        j                  \  }}}|s5d| _	        | j        j
        s| j        j        rd| j        j        j        _	        | o!t          |          | j        j        j        k    | _        g }t          j        }g }	t          |          t          |          z
  | j        j        j        k    rEt"          | _        t%          || j        j        j                 j        d| j        j        z             | S d}
t)          |d d                    D ]\  }}|                    |          }|j        r2d| _        |	                    |           |                    d           T| j        j        j        |
         \  }}|
dz  }
|j        rd| _        |j        j        r|                    ||f           n|                    |df           dD ]U}t9          ||          }|j        s<|                    ||          }t=          |||           |	                    |           V|j        j        s|j        j         r[|j        j         rtC          |j        d	|           d| _"        |                    ||          }|||<   |	                    |           t"          | _        t%          |j        d
|j        z             | c S | j"        o| j         | _"        |	| _        || _#        |j$        | _$        | %                    |||           | &                    |           | S )Nr(   r  Tz&Too many indices specified for type %sr   )directstridedrx  r  z/Index should be typed for more efficient accessz/Invalid index for memoryview specified, type %s)'r  r  r@   is_pythran_moder  r  rZ  r   r  r  r   rZ  r   r   memslice_indexr   r^  r/   r   r   rL  r<  r  r^  r  r  r   r   r   r  setattrr  rq   r*   r]  original_indicesr   analyse_operationr  )rY   rs   r  r  r  r  r  r  r  new_indicesaxis_idxrT  r[  accesspackingattrr   s                    rT   r<  z!MemoryViewIndexNode.analyse_types:  ss         -c22,(2(>(>w	H[(\(\%Wg 	<#'D y  <DI$: <7;	$4#*{Rs7||ty~?R/R1
w<<#g,,&)<<<"DI'$).-.2:TY^KM M MK!'!!!*-- '	 '	HAu'',,E} (,%""5)))1222"in1(;OFGMH~ (,%:% 5KK 12222KK 3444 6 2 2D#E400E = 2 %
C @ @tU333#**51112 " ej&< :) h$UY0acfggg(,%
C88"
""5)))) '	ei!RUZU_!_``` !% 5 Sd>S:S" !(Y
sGT222##C(((rU   c                 @    d| _         |                     ||           d S )Nz"Cannot index None memoryview slice)rE  rF  )rY   rs   r  r  s       rT   r}  z%MemoryViewIndexNode.analyse_operation  s&    "F!!#w/////rU   c                 b    | j         j        r | }|j        s|j        rd|_        d|_        dS dS dS )z
        Support broadcasting for slice assignment.
        E.g.
            m_2d[...] = m_1d  # or,
            m_1d[...] = m_2d  # if the leading dimension has extent 1
        TN)r   r   r  rY   r   lhss      rT   analyse_broadcast_operationz/MemoryViewIndexNode.analyse_broadcast_operation  sU     9' 	0C' 03+C 0+/(+/(((		0 	00 0rU   c                 P    |                      |          }|r|j        |_        |S | S rN   )rN  r  r  s      rT   $analyse_as_memview_scalar_assignmentz8MemoryViewIndexNode.analyse_as_memview_scalar_assignment  s2    %%c** 	-0-KC*JrU   Nr>  )	r[   r\   r]   r]  r\  r<  r}  r  r  rW   rU   rT   r  r  5  sf        M M M M^0 0 00 0 0    rU   r  c                   T    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dd
ZdS )r  TFc                     t          d | j        D                       | _        | j        r| j        j        | _        dS dS )z@Slicing operations needing no evaluation, i.e. m[...] or m[:, :]c              3   l   K   | ]/}|j         o#|j        j        o|j        j        o|j        j        V  0d S rN   )r   r   r  r   r   r  s     rT   rf   z<MemoryViewSliceNode.analyse_ellipsis_noop.<locals>.<genexpr>  sV       $' $' N`u{2`uz7I`ejN`$' $' $' $' $' $'rU   N)r  r  is_ellipsis_nooprZ  r   r  s      rT   analyse_ellipsis_noopz)MemoryViewSliceNode.analyse_ellipsis_noop  sZ     !$ $' $'$' $' $' !' !'   	'	DIII	' 	'rU   c                    ddl m} |sd| _        d| _        nd| _        |                     ||           | j        rd S d | _        d| _        d| _        |	                    | j
        |          st          | _        d S t          j        | j        j        j        |          | _        | j                                        s:| j                                        s#| j                            |          | _        d S d S d S )Nr(   r  Tz&Cannot assign to None memoryview slicez"Cannot slice None memoryview slice)r  r  r  rE  r  r  r[  r   r  validate_axesr   r/   r   r   r  rZ  r  r;  r  r9  )rY   rs   r  r  r  s        rT   r}  z%MemoryViewSliceNode.analyse_operation  s          	K(,D%&ND##&JD#""3000  	F
#''$77 	"DIF249>3GNN		##%% 	6)A)A)C)C 	6	0055DIII	6 	6 	6 	6rU   c                     |j         j        sE| j         j                            |j                   s|j         j        rt          | j        |           S t          | j        |           S rN   )r   r   r  r  rq   MemoryCopyScalarr   MemoryCopySlicerM  s     rT   rN  z&MemoryViewSliceNode.analyse_assignment  s^    x* 	3	//99	3$	3 $DHd333"48T222rU   c                    |sdS | j         dd         }|dd         }t          | j                   D ]i\  }}|j        rN|j        j        r?|j        j        r3|j        j        r'|d         ||<   |                    d           |s|c S W dS |j        j	        s dS j|r9t          |          t          |          z   | j        j        j        k    rdS ||z  }|S )a  Return a new list of indices/slices with 'indices' merged into the current ones
        according to slicing rules.
        Is used to implement "view[i][j]" => "view[i, j]".
        Return None if the indices cannot (easily) be merged at compile time.
        Nr   )r|  rL  r   r   r  r   r   r   r   r  r   rZ  r  )rY   r  r~  rT  r_  s        rT   r  z"MemoryViewSliceNode.merged_indices  s     	4+AAA.!!!*d344 	 	DAqz 7?  qv~  !&.  %,QZKNKKNNN" +****+  44V] tt  	#;#g,,.1DDDt7"KrU   c                     | j         r2| j                                        p| j                                        S |                                 S rN   )r  rZ  r;  r  rX   s    rT   r;  zMemoryViewSliceNode.is_simple  sG      	G9&&((FDI,D,D,F,FF""$$$rU   c                 4    | j                                         S )z3This is called in case this is a no-op slicing node)rZ  r  rX   s    rT   r  z)MemoryViewSliceNode.calculate_result_code  s    y!!!rU   c           	      (   | j         rd S |                                 }| j         }d}t          | j                  }| j        D ]{}|j        rcd}|j        j        st          |          |_        |j
        j        st          |          |_
        |j        j        st          |          |_        lt          |           |t          |          rJ |                    || j        |                                 | j        |||j        j                   d S )NFT)r  r  rk   )r  rW  r  iterr  r|  r   r   r  nextr   r   r  generate_buffer_slice_coder  r   r   rk   )rY   r   rW  r  r  r  r[  s          rT   r  z(MemoryViewSliceNode.generate_result_code  s     	F((**,, $,* 
	 
	E~ 	"{* +"&r((EKz) *!%bEJz) *!%bEJR88//$'	;'2 	0 	4 	4 	4 	4 	4rU   c                    | j         r|                     |           n|                     |           | j        r|                     ||           n|                     ||           | j         r|                     |           n|                     |           |                    |           |                    |           d S rN   )	r  r  r  is_memview_scalar_assignment+generate_memoryviewslice_assign_scalar_code&generate_memoryviewslice_setslice_coder  r  r  rj  s       rT   r  z,MemoryViewSliceNode.generate_assignment_code  s      	011$7777))$///, 	C<<S$GGGG77TBBB  	.//5555''---""4(((trU   NrP  )r[   r\   r]   r^  r  r  r]  r  r  r}  rN  r  r;  r  r  r  rW   rU   rT   r  r    s         #(  ' ' '6 6 643 3 3  >% % %" " "4 4 48     rU   r  c                   0     e Zd ZdZdgZ fdZddZ xZS )MemoryCopyNodeze
    Wraps a memoryview slice for slice assignment.

        dst: destination mememoryview slice
    dstc                 ~    t          t          |                               |           || _        |j        | _        d S rN   )rP   r  r  r  r   rY   r   r  rS   s      rT   r  zMemoryCopyNode.__init__<  s5    nd##,,S111H			rU   Fc                 "   | j                             |           |                     ||           | j                             |           | j                             |           |                    |           |                    |           d S rN   )r  r  _generate_assignment_coder  r  rj  s       rT   r  z'MemoryCopyNode.generate_assignment_codeA  s    ))$///&&sD111''---D!!!""4(((trU   rP  )r[   r\   r]   r  r   r  r  r^   r_   s   @rT   r  r  3  s_          wH    
       rU   r  c                        e Zd ZdZdZdZd ZdS )r  z
    Copy the contents of slice src to slice dst. Does not support indirect
    slices.

        memslice1[...] = memslice2
        memslice1[:] = memslice2
    T__pyx_memoryview_copy_contentsc                    | j         }|j                            |j                   |j                            |j                   |                    |                    d| j        |                                |                                |j        j        |j        j        |j        j	        j
        fz  |j                             d S )Nz%s(%s, %s, %d, %d, %d))r  r   assert_direct_dimsr   r   r  copy_slice_cnamer  r  r  rq   )rY   r
  r   r  s       rT   r  z)MemoryCopySlice._generate_assignment_codeV  s    h##CG,,,##CG,,,

4))$(=(+

cjjll(+sx}(+(B(D D G  	 	 	 	 	rU   N)r[   r\   r]   r  r  r  r  rW   rU   rT   r  r  J  s;          "&7    rU   r  c                   (     e Zd ZdZ fdZd Z xZS )r  z
    Assign a scalar to a slice. dst must be simple, scalar will be assigned
    to a correct type and not just something assignable.

        memslice1[...] = 0.0
        memslice1[:] = 0.0
    c                 |    t          t          |                               ||           |j        j        | _        d S rN   )rP   r  r  r   r  r  s      rT   r  zMemoryCopyScalar.__init__m  s3    %%..sC888HN			rU   c                    ddl m} | j        j                            | j        j                   | j        j        j        }|                    d          }| j        j                            d          }|                                 |	                    |d|
                                d           | j                                        s| j                                        r| j        
                                }n4|	                    |d| j        
                                d           d}d}| j        j        }	|	D ]=}
t          |
t                    r&|
j        j        r|
j        j        r|
j        j        sd	}>|                    | j        j        || j        j        j        ||
          }|                                }|j        r|	                    d|z             |	                    d|d|d           |j        r|	                    d           |                                 |                                 d S )Nr(   r  r  z __pyx_temp_scalar = r  z __pyx_temp_slice = __pyx_temp_sliceFT)force_stridedzPy_DECREF(*(PyObject **) %s);z*((z *) z) = __pyx_temp_scalar;zPy_INCREF(__pyx_temp_scalar);)r  r  r  r   r  r   r  r   begin_blockr   r  r  r;  r|  r   r  r   r  r   r   
slice_iterr  start_loopsrq   	end_loops	end_block)rY   scalarr   r  r  	type_decl
slice_decldst_tempr  r  rI  slice_iter_objps                rT   r  z*MemoryCopyScalar._generate_assignment_codeq  s=         ((666#**2..	X]33B77


999fmmooooNOOO8""$$ 	*(:(:(<(< 	*x((HHJJjjj$(//BSBSBSBSTUUU)H(+ 	% 	%C#y)) %393D %3683C%3683C% !%#..tx}h/3x}/A4=J / L L &&(( 	<JJ6:;;;


)))QQQGHHH 	8JJ6777  """rU   )r[   r\   r]   r  r  r  r^   r_   s   @rT   r  r  d  sQ         # # # # #' ' ' ' ' ' 'rU   r  c                       e Zd Zg dZdZdZd Zd dZd Zd Z	d	 Z
d
 Zd Zd!dZd Z fdZdZ ej        ddddi          Z ej        ddddi          Z fdZd Z	 	 d"dZd#dZd Zd Zd Zd Zd Z xZS )$SliceIndexNode)rZ  r   r   sliceFNc                 :   | j                             |          }|j        s|j        rt          S |j        rt          S |t          t          t          t          t          t          t          fv r|S |j        s|j        rt          j        |j        d           S t"          S rN   )rZ  r   r  r  r   r  r   r"   r   r2   r   r   r  rT  r   c_array_typer  r   r  s      rT   r   zSliceIndexNode.infer_type  s    I((--	 	F)"8 	F' 	F:~x*IzC C C 	F!3 	F*9+>EEErU   r   c                     |t           ur7| j        r0| j                                        r|| j        j        z  }nt           }| j                            |          S rN   )r,  r   r   r   rZ  r`  r_  s     rT   r`  z"SliceIndexNode.inferable_item_node  sV    &&4:&z--// '33&y,,U333rU   c                     | j         j        }|r3|j        rdS |t          t          t
          t          t          t          fv rdS t          
                    |           S rw  )rZ  r   r  r   r   r   r2   r   r   r   r?  r  s     rT   r?  zSliceIndexNode.may_be_none  s^    IN	 	" uZ<,iE E Eu##D)))rU   c                     | j         d }n| j         j        }| j        d }n| j        j        }| j        j        ||         | _        d S rN   )r   r   r   rZ  )rY   r   r   s      rT   r(  z(SliceIndexNode.calculate_constant_result  sP    :EEJ.E9DD9,D#y8tDrU   c                 6   | j                             |          }| j        d}n| j                            |          }| j        d }n| j                            |          }	 |||         S # t          $ r }|                     |           Y d }~d S d }~ww xY wr   )rZ  r2  r   r   r  r6  )rY   r1  rZ  r   r   r5  s         rT   r2  z!SliceIndexNode.compile_time_value  s    y++D11:EEJ11$77E9DD9//55D	-d
## 	- 	- 	-))!,,,,,,,,,	-s   $	A. .
B8BBc                     d S rN   rW   r   s     rT   r8  z)SliceIndexNode.analyse_target_declaration  r   rU   c                 d    |                      |d          }|j        j        rt          |_        |S rA  )r<  r   rq   r   r>  s      rT   rD  z#SliceIndexNode.analyse_target_types  s3    !!#u!559  	'&DIrU   Tc                 P   | j                             |          | _         | j         j        j        s"| j         j        j        s| j         j        j        rpt          | j                  }t          | j        | j	        p|| j
        p||          }t          | j        || j                   }|                    ||| d          S | j	        r| j	                            |          | _	        | j
        r| j
                            |          | _
        |j        d         st          | j	        | j
                   | j         j        }|j        r7|s5| j	        s| j
        s|| _        nt!          j        |j                  | _        n|j        s|j        rt+          |          | _        nt|j        rt.          | _        n`|j        r|| _        nQ|j        rt!          j        |j                  | _        n+| j                             |          | _         t4          | _        |j        r&|| _        | j                             d          | _         | j        t4          u r| j	        r| j	        j        r| j
        r| j
        j        rvt          | j                  }t          | j        t=          j        | j	        p|          t=          j        | j
        p|          |                              |          | _         nt           j!        fd}| j	        rH| j	        j        j"        r || j	        d|          | _	        | j	        #                    |          | _	        | j
        rH| j
        j        j"        r || j
        d	|          | _
        | j
        #                    |          | _
        d
| _$        | S )Nr  )r[  rZ  Fr  r  r  c                    ddl m}m}  ||           }t          | j        t          | j        ||                                rt          |          nt                    |	                    |          t          | j        |dt          | j                                                |                                        |          } |||          S )Nr(   EvalWithTempExprNodeResultRefNoder,  is)operand1r   operand2)true_val	false_valtest)	UtilNodesr  r  CondExprNoder   r]  r  r  r,  r  PrimaryCmpNoder  r<  analyse_result_type)r   default_valuers   r  r  node_refnew_exprc_ints          rT   
allow_nonez0SliceIndexNode.analyse_types.<locals>.allow_none+  s    JJJJJJJJ(=..'H$"+>K>S>S>U>U(iM(:(:(:[i	   '00<<'!)!%!)$(!3!3	  
 $mC((   &%c**   ,+Hh???rU   r  r  r(   )%rZ  r<  r   r  r<   r   r  r   r  r   r   r\  r  rk   r   rT  r   r~  r  r  is_cpp_stringr{   r  r   r  r   r   r|  rG  r   copydeepcopyr  r^  rq   r  r   )	rY   rs   r  	none_noder[  r   r  r  r  s	           @rT   r<  zSliceIndexNode.analyse_types  s   I++C00	9># 		$ty~'E 		$Ij 		$ **Idh$(J$;)#'9#9	#,. . .E #485tyIIIJ::W'k" ; $ $ $ : 	711#66DJ9 	5	//44DI~l+ 	:"4:ty999IN	 	'g 	': Edi E%		&/	0CDD		  	'I$; 	'(--DII' 	'$DII 		'!DII 	' #+I,?@@DII	44S99DI&DI$ 	^!DI	334\]]DI9&&J 	%$*"7 	%	%&*i&:	% %TX..	&H-
(?i@@ty'=I>>"	  
  -$$ 
 0E@ @ @ @ @. z >:?. B!+DJS!A!ADJ!Z11%==
y <9>- M *
496F L LDI I//s;;	rU   c                 F   | j                             |          }|r| j        s}| j        svddlm} |                    |j                   t          | j	                  }t          | j	        |||          }t          j        ||                    ||g                    S d S )Nr(   r  r  )rZ  re  r   r   r  r  r   r  r  r   r  r   r  r  )rY   rs   r  r  r  
slice_nodes         rT   re  zSliceIndexNode.analyse_as_typeM  s    I--c22	 	M: Mdi M(((((($$Z%ABBB$TX..	&H#""	  
 "5z88zlKKM M MtrU   c                 l    |j         | _         t          t          |                               |          S rN   )r   rP   r  rs  rY   rs   rS   s     rT   rs  zSliceIndexNode.nogil_check_  s*    Y
^T**66s;;;rU   zSlicing Python objectSliceObjectr  r  Get)r  Setc                    | j         j        j        s| j         j        j        rf|t          t
          t          t          fv rJ|t          t
          fvr3|j        d         s&t          | j
        d| j         j        d|d           || _        |j        r:| j         j        j        r)| j        s"| j        s| j                             ||          S t          t           |                               ||          S )Nra   /default encoding required for conversion from '' to 'r  )rZ  r   r  r  r   r"   r   r   rk   r   r   rT  r   r   r  rP   r  r{  s      rT   r  zSliceIndexNode.coerce_tok  s    Y^% 	!)E 	!^X| TTT^ <<<N+>? =dhhY^^^XXX/0 0 0 !DI 	:!8 	:: :di :y**8S999^T**44XsCCCrU   c                 	   | j         j        st          | j        d| j         z             d S | j                                        }|                                 }|                                 }|                                 }| j        j         j        r| j                                        }| j        j         t          j
        t          j        fvrd|z  }| j         t          u rd}n| j         j                                        }| j        >|                    |d|d|d|d|                    || j                  	           n|                    |d|d|d|d	|d
|d|                    || j                             n=| j        j         j        r| j                                        }| j        j         t          j        k    rd|z  }| j        h|                    |d|d|d|                    || j                             |j                            t-          j        dd                     n|                    |d|d|d	|d
|d|                    || j                             |j                            t-          j        dd                     n| j        j         t0          u rk|j                            t-          j        dd                     |                    |d|d	|d	|d|                    || j                  	           n| j         t2          u r|j                            | j                   |                                 \  }}}	}
}}}|                    d|| j                                        |	|
|||||t;          |j        j        d                   |                    || j                  fz             n| j        j         t>          u r0|j                            tA          j        dd                     d}nE| j        j         tB          u r0|j                            tA          j        dd                     d}nd}|                    |d|d| j                                        d	|d	|d|                    || j                             | "                    |           d S )Nz,Slicing is not currently supported for '%s'.z((const char*)%s)	ByteArrayz = __Pyx_Pyz_FromString( + rc  z_FromStringAndSize(r   - z((const Py_UNICODE*)%s)z = __Pyx_PyUnicode_FromUnicode(pyunicode_from_unicoderJ  z( = __Pyx_PyUnicode_FromUnicodeAndLength(PyUnicode_Substringz = __Pyx_PyUnicode_Substring(zD%s = __Pyx_PyObject_GetSlice(%s, %s, %s, %s, %s, %s, %d, %d, %d); %sr  SliceTupleAndListr  __Pyx_PyList_GetSlice__Pyx_PyTuple_GetSlicePySequence_GetSlicer  r
  )#r   rq   r   r   rZ  r  
start_code	stop_coder  r   rm   ro   r"   rr   titler   r   r   r  c_py_unicode_ptr_typer   r   r	   r   r   r   get_slice_utility_codeget_slice_configr   rH  rk   r   r
   r   r  )rY   r   base_resultr  r  r  	type_namehas_c_start
has_c_stopc_startc_stoppy_startpy_stoppy_slicecfuncs                  rT   r  z#SliceIndexNode.generate_result_code{  s   y$ 	$(@49LN N NFi&&((__&&
NN$$	9># \	@)**,,Ky~j&@*Bb%ccc1K?yN**'		 IN0022	y 

!		#"

//AAACD D D D 

!		#"

!		"

//AAACD D D D Y^, B	@)**,,Ky~!AAA7+Ey 

#"

//AAA	CD D D  11+,DoVVX X X X 

#"

!		"

//AAACD D D  11+,DoVVX X X X Y^|++--%12GYY[ [ [JJFFKKJJII++FDH===?@ @ @ @ Y.((--d.IJJJ,0,A,A,C,C*[*gvwJJVI''))Vgx)4\BCC++FDH==Z? ?@ @ @ @ y~** 11&23FHZ[[] ] ]/:-- 11&23FHZ[[] ] ]0-JJFFEEI''))))JJII++FDH===?@ @ @ 	T"""""rU   c                 2   |                      |           | j        j        r|j                            | j                   |                                 \  }}}}	}
}}|                    | j        d| j	        
                                |
                                ||	|
||||t          |j        j        d                   f
z             n| j        r|                                 nd}|j        j        r#|j        j        }|                     ||           n|                                 d|}|j                            t'          j        dd                     |                    d| j	                                        d|d	|                                d
| j	                                        d|d           |                     |           |                     |           |                    |           |                    |           d S )Nz?__Pyx_PyObject_SetSlice(%s, %s, %s, %s, %s, %s, %s, %d, %d, %d)r  r  r  IncludeStringHrJ  	memcpy(&(r%  ]), r6  z[0]) * ());)r  r   rq   r   r   set_slice_utility_coder  r<  r   rZ  r   rH  rk   r   r  rT  r8  generate_slice_guard_coder  r	   r   r   r  r  r  r  r  )rY   r   r   r  r   r   r  r  r  r  r  r  r   start_offsetarray_lengths                  rT   r  z'SliceIndexNode.generate_assignment_code  s    --d3339  	--d.IJJJTXTiTiTkTkQKWfh!!$(QI''))MMOOVgx)4\BCCUE EF F F F 15
C4??,,,Lx  L"x}..t\BBBB,0NN,<,<,<,<llK--k.EFVXg.h.hiiiJJJ	  """"LLL

	  """"LLL    	++D111%%%""4(((trU   c                    | j         j        j        st          | j        d| j        z             d S |                     |           |j                            | j                   | 	                                \  }}}}}}}	|
                    | j        d| j                                         |||||	||t          |j        j        d                   f	z             |                     |           |                     |           d S )Nz=Deleting slices is only supported for Python types, not '%s'.z;__Pyx_PyObject_DelSlice(%s, %s, %s, %s, %s, %s, %d, %d, %d)r  )rZ  r   rq   r   r   r  r   r   r  r  r<  r   rH  rk   r  r  )
rY   r   r  r  r  r  r  r  r  r   s
             rT   r  z%SliceIndexNode.generate_deletion_code  s#   y~) 	$(QTXT]]_ _ _F--d333))$*EFFF(,(=(=(?(?	&j'6	7HdhI	##%%'8ZT%0>??MA A	B 	B 	B 	++D111%%%%%rU   c                    d\  }}}| j         rJ| j         j        j         }|r| j                                         }nd| j                                         z  }d\  }}}| j        rJ| j        j        j         }|r| j                                        }nd| j                                        z  }| j        rd| j                                        z  pd}|||||||fS )N)Fr  r  &%sr  )r   r   rq   r  r   r   r  )rY   r  r  r  r  r  r  r   s           rT   r  zSliceIndexNode.get_slice_config  s    );&Wh: 	:"jo99K :*++-- 4:#7#7#9#99&8#
FG9 	8!Y^77J 8))++$)"5"5"7"77:@%$**>*>*@*@"@JFZ&'8- 	-rU   c                    | j         j        j        sd S | j         j        j        }	 t	          |          x}}n# t
          $ r d }Y nw xY wd x}}| j        rT| j                                        }	 t	          |          }|dk     r|d||fz  }n||z  }n|}d }n# t
          $ r Y nw xY w| j        r| j                                        }	 t	          |          }|dk     r|d| j         j        j        |fz  }n||z  }t          |t                    r||z  }n|d|d}d }n# t
          $ r Y nw xY wd }d}	 t	          |          }	t          |t                    }n# t
          $ r d }	Y nw xY w|r"|dk     r|	dk    rt          | j        d           n?|r&|$|"|	|k    rt          | j        d|d|           n|||}d	|d
|d}n||}n|}|r|                    d|d|d           | j        r|                                 |                    d|d|d           | j        r|                                 |                    |                    | j                             |                    d           d S d S )Nr   z%s + %dz - (r`  FzAssignment to empty slice.z.Assignment to slice of wrong length, expected r  r
  z)-(if (unlikely((z) != ())) {zPyErr_Format(PyExc_ValueError, "Assignment to slice of wrong length, expected %" CYTHON_FORMAT_SSIZE_T "d, got %" CYTHON_FORMAT_SSIZE_T "d", (Py_ssize_t)(z), (Py_ssize_t)(r  r   )rZ  r   rT  r8  r  r   r   r  r   r   r&   r   r   r   r   r   r   r   )
rY   r   target_size
slice_sizetotal_lengthr   r   runtime_checkcompile_time_checkint_target_sizes
             rT   r  z(SliceIndexNode.generate_slice_guard_code,  sy   y~& 	FY^(
	 (+J7L:: 	  	  	 LLL	  9 	9##%%D4yy!88#+%.*d1C%C

"d*

!%J    : 	J%%''EE

199#+ )TY^-@%,H H-j-88 C%'JJ0:

EEE!BJ    "	G!+..O ",J!F!F  	# 	# 	#"OOO	#
  	'*q..""dh <=== 	'EMdl*,,dhh jj++!/ 0 0 0|!+/447MM MM&M 	JJJ---UVVVz &##%%%JJJ  KK01 1 1
 z /,,...JJttx00111JJsOOOOO	 	sF   8 AA/)B 
B&%B&
AD# #
D0/D08E E,+E,c                 F    | j         r| j                                         S dS )Nr  )r   r  rX   s    rT   r  zSliceIndexNode.start_code~  s%    : 	:$$&&&3rU   c                     | j         r| j                                         S | j        j        j        r| j        j        j        S dS )Nr  )r   r  rZ  r   rT  r8  rX   s    rT   r  zSliceIndexNode.stop_code  sB    9 	$9##%%%Y^$ 	$9>&&##rU   c                     dS )Nz<unused>rW   rX   s    rT   r  z$SliceIndexNode.calculate_result_code  s    zrU   rQ  r>  rR  rP  )r[   r\   r]   r   r   r  r   r`  r?  r(  r2  r8  rD  r<  re  rs  re  r
   loadr  r  r  r  r  r  r  r  r  r  r  r^   r_   s   @rT   r  r    s        211HEE  4 4 4 4* * *	E 	E 	E- - -    ^ ^ ^ ^@  $< < < < < *K4/4)He3DF F F 5/4)He3DF F FD D D D D g# g# g#R INGK       D& & & &&- - -&P P Pd  $ $ $      rU   r  c                   J    e Zd Zg dZdZeZdZd Zd Z	d Z
d ZdZd	 Zd
 ZdS )r  r  Tr(   c                 n    t          | j        j        | j        j        | j        j                  | _        d S rN   r  r   r   r   r   rX   s    rT   r(  z#SliceNode.calculate_constant_result  2    $J&I%I% '  'rU   c                    | j                             |          }| j                            |          }| j                            |          }	 t	          |||          S # t
          $ r }|                     |           Y d }~d S d }~ww xY wrN   r   r2  r   r   r  r  r6  rY   r1  r   r   r   r5  s         rT   r2  zSliceNode.compile_time_value      
--d33y++D11y++D11	-d+++ 	- 	- 	-))!,,,,,,,,,	-   A! !
B+BBc                     dS rw  rW   rX   s    rT   r?  zSliceNode.may_be_none  rn  rU   c                    | j                             |          }| j                            |          }| j                            |          }|                    |          | _         |                    |          | _        |                    |          | _        | j         j        r&| j        j        r| j        j        rd| _        d| _        | S r  )r   r<  r   r   r   r   r   )rY   rs   r   r   r   s        rT   r<  zSliceNode.analyse_types  s    
((--y&&s++y&&s++--c22
++C00	++C00	:  	!TY%9 	!di>R 	!"DO DLrU   z Constructing Python slice objectc                     | j         S rN   r  rX   s    rT   r  zSliceNode.calculate_result_code  r  rU   c                    | j         rqt          | j        | f          }|                    t          dd|          | _        |                    | j                  }|d S |                    | j                   |	                    | 
                                d| j                                        d| j                                        d| j                                        d|                    | 
                                | j                  	           |                     |           | j         r|                     |           d S d S )Nr  r5   cleanup_level	dedup_keyz = PySlice_New(r  rc  )r   r   r   r8  r   r  r;  r  r   r   r  r   r   r   r   r   r  r  )rY   r   r*  s      rT   r  zSliceNode.generate_result_code  sK   ? 	$&ty4'::I#00XYen0ooD33D4DEED|MM$(###


$$&&&&	##%%%%	##%%%%''tx@@@B	C 	C 	C 	T"""? 	(!!$'''''	( 	(rU   N)r[   r\   r]   r   r   r#   r   r   r(  r2  r?  r<  re  r  r  rW   rU   rT   r  r    s         )((HHDG' ' '- - -  
 
 
 5K     ( ( ( ( (rU   r  c                   6    e Zd ZdZd Zd Zd Zd Zd Zd Z	dS )	r  r   c                 n    t          | j        j        | j        j        | j        j                  | _        d S rN   r  rX   s    rT   r(  z&SliceIntNode.calculate_constant_result  r  rU   c                    | j                             |          }| j                            |          }| j                            |          }	 t	          |||          S # t
          $ r }|                     |           Y d }~d S d }~ww xY wrN   r   r!  s         rT   r2  zSliceIntNode.compile_time_value  r"  r#  c                     dS rw  rW   rX   s    rT   r?  zSliceIntNode.may_be_none  rn  rU   c                 &   | j                             |          | _         | j                            |          | _        | j                            |          | _        | j         j        s| j                             |          | _         | j        j        s| j                            |          | _        | j        j        s| j                            |          | _        | j         j        r&| j        j        r| j        j        rd| _        d| _        | S r  )r   r<  r   r   r  r6  r   r   r   s     rT   r<  zSliceIntNode.analyse_types  s    Z--c22
I++C00	I++C00	z! 	;55c::DJy  	9	33C88DIy  	9	33C88DI:  	!TY%9 	!di>R 	!"DO DLrU   c                     d S rN   rW   rX   s    rT   r  z"SliceIntNode.calculate_result_code  r   rU   c                     | j         | j        | j        fD ]0}t          |t                    r|j                                         1d S rN   )r   r   r   r   r  r>  r  )rY   r   ra  s      rT   r  z!SliceIntNode.generate_result_code  sJ    DIdi/ 	 	A!Y'' 	 	rU   N)
r[   r\   r]   r   r(  r2  r?  r<  r  r  rW   rU   rT   r  r    su         G' ' '- - -    "      rU   r  c                   H    e Zd ZdZd Zd Zd Zd ZddZd Z	d Z
d	 Zd
ZdS )CallNodeNc                 ~   | j         }|                              }t          |t                    rt	          j        |j                  S |t          u rt          |dd           }|	|j	        p|}|j
        r|j        }|j        rt          | j         dd           rtt          | d          rd| j         j                                        }fd| j        D             }t	          j        ||          }|r|j	        }|j
        r|j        }|j        S |j        S |t&          u rl|j        re|j        r^|j        j	        rR|j        j	        }|j        r|S |j        r6|j        j        dk    rt          j        S |j        j        t2          j        v r|S | j                                       }|r|j        s|j        r|S t          S )Nr   r   c                 :    g | ]}|                               S rW   r   rc   r>  rs   s     rT   r   z'CallNode.infer_type.<locals>.<listcomp>!  s%    FFFSS^^C00FFFrU   r   )r&  r   r   rg  r   r~  rl  r   r   r   r  r  rU  r  r   all_alternativesr   
best_matchr  r   r   r{  r|  rr   r  r   #types_that_construct_their_instancere  is_struct_or_unionr  )	rY   rs   r&  r  r   alternatives	arg_types
func_entryresult_types	    `       rT   r   zCallNode.infer_type  s   ='',,	h,, 	<&x':;;;&&Hgt44E !J3)	 	,!+I! 	+t}gt44 1v9N9N 1#}2CCEEFFFFDIFFF	'29lKK
 1 *I ' 8$-$7	$00(()## +HN +x~7J +&n10 +&& 0 +~*g55)77!,0[[[**M11#66	 	)6 	):P 	rU   c                 6    | j                             |          S rN   )r&  rO  r   s     rT   rO  zCallNode.type_dependencies8  s     }..s333rU   c                     dS rw  rW   rX   s    rT   r;  zCallNode.is_simple=  s	    
 urU   c                 
   | j         | j         S | j        j        }|t          u rG| j        j        r;| j        j        }|j        j        rdS |j        j        r|j        t          j
        v rdS t                              |           S rw  )may_return_noner&  r   r   r   r   r{  r|  rr   r   r9  r   r?  )rY   r  r   s      rT   r?  zCallNode.may_be_noneD  s    +''M&		!!dm&;!M'Ez+ u
* J'"MMMu##D)))rU   c                    ||j         }|t          j        u r|j        r|j        r|j        j        r|j        j        t          j        v ri|j        j        dk    r#t          j	        | _         t          j	        | _
        n-t          j        |j        j                 | _         t          | _
        d| _        d S |j        r-|j        r&|j        j         | _         t          | _
        d| _        d S t          | _         d S )Nr   F)r   r   r   r   r   r  rr   r9  r   r  r$  builtin_typesr   rB  r  )rY   r&  r  s      rT   set_py_result_typezCallNode.set_py_result_typeQ  s     I)))  * * ) * #w'RRR~"g--&4	$.$<!!#1(.2EF	$2!#(D    	'("5 	' !+0DI .D#(D   &DIIIrU   c           
         | j                                       }|r|j        r|                                 \  }}g }t	          ||j        j                  D ]H\  }}|                    t          |j	        t          |j	        |j                  |                     I|r
||j        z  }|| _        t          | _        |                                |                     |           dS |r|j        rfd| j        D             | _        |j                            d          }|s5t)          | j         j	        d| j         j        z             t*          | _        | S t/          | j         j	        |j                  | _         || j         _        | j                             |                                           |                                || _        dS d S d S )N)r   r   )r   keyr   Tc                 :    g | ]}|                               S rW   rA  r6  s     rT   r   z8CallNode.analyse_as_type_constructor.<locals>.<listcomp>z  '    GGGS#++C00GGGrU   z<init>z'no constructor found for C++  type '%s')r&  re  r:  explicit_args_kwdsr}  r,  rs  r  DictItemNoder   rC  rr   key_value_pairsDictNoderS   r<  r  r  r   r-  r   r/   r   r4  r   r9  rr  analyse_c_function_call)	rY   rs   r   r   r  rv  r>  memberrm  s	    `       rT   analyse_as_type_constructorz$CallNode.analyse_as_type_constructork  s   },,S11 	D+ 	0022JD$E"4)?@@ s sV\cg:#'Y_Yd;e;e;empqqqrrrr .--#(D %DNs###NN4%%%4 	d' 	GGGGDIGGGDI*++H55K dm')RUYUbUg)ghhh&	,T]->@PQQDM"-DMM##D$?$?$A$ABBB((---DI4	 	 	 	rU   c                     | j         j        S rN   )r   r  rX   s    rT   r   zCallNode.is_lvalue  s    y%%rU   c                     |                                  }|j        r|                                  d S |j        s't	          |dd          s|                                  d S d S d S )Nr   F)function_typerq   rr  r  r   )rY   rs   r  s      rT   rs  zCallNode.nogil_check  s|    &&((	  	NN# 	GIw,N,N 	NN	 	 	 	rU   zCalling gil-requiring functionrN   )r[   r\   r]   rB  r   rO  r;  r?  rE  rP  r   rs  re  rW   rU   rT   r3  r3    s         O& & &P4 4 4
  * * *' ' ' '4  8& & &   3KKKrU   r3  c                        e Zd Zg dZdZdZdZdZdZdZ	dZ
dZd Zed             Zd Zd Zd Zd	 Zd
 Zd Zd Zd Z fdZd Z xZS )r.  )rY   coerced_selfr&  r   r  NFc                     | j                                       }fd| j        D             }	  || S # t          $ r }|                     |           Y d }~d S d }~ww xY w)Nc                 :    g | ]}|                               S rW   r2  rc   r>  r1  s     rT   r   z5SimpleCallNode.compile_time_value.<locals>.<listcomp>  '    BBB&&t,,BBBrU   )r&  r2  r   r  r6  )rY   r1  r&  r   r5  s    `   rT   r2  z!SimpleCallNode.compile_time_value  s    =33D99BBBB	BBB	-8T?" 	- 	- 	-))!,,,,,,,,,	-s   5 
AAAc                     |j         }|                    |j                  }|sJ d|d|j                    t	          ||j        ||j                  } | |||g          }|S )NzGetter not found in scope r4  )rr   r   r   r%  )r,  r  rr   ru  r  r   )rR   r   r#  r   property_scopegetter_entryr&  r   s           rT   for_cpropertyzSimpleCallNode.for_cproperty  s     %11%*==jjj>>>SaSiSijjjjCej<K\]]]s3666rU   c                    | j                                         }|dk    rt          | j                  dk    rt	          | j        j        d           d S | j        d                             |          }|s"t	          | j        d         j        d           d S t          j        |          S |dk    rYt          | j                  dk    rt	          | j        j        d           | j        d         	                    |          }|j
        S d S )Npointerr(   zonly one type allowed.r   zUnknown typetypeof)r&  rA  r   r   r   r   re  r   r~  r<  r   )rY   rs   r  r   operands        rT   re  zSimpleCallNode.analyse_as_type  s    }0022949~~""dim%=>>>>>y|33C88 5$)A,*N;;;;;%.t444X49~~""dim%=>>>il0055G<	 rU   c                     | j         d fS rN   rL  rX   s    rT   rJ  z!SimpleCallNode.explicit_args_kwds  s    y$rU   c                    | j         r| S d| _         |                               r| S d| j        _        | j                                      | _        | j        }|j        r8|j        r1|j        j        r%|j        | _	        t          | j	                  |_        |                                 }d| _        t                    r|j        rt          |          rvd}t!          | j        | j                  | _        | j                                      | _        | j        j        D ]}|t)          |          z  }t+          |          | _        | j        rw                    t/          |                     t0                              | t5          |          | j        t7          t9          || j        j                                      S |j        rwt!          | j        | j                  | _        | j                                                                    | _        d | _        |                     ||           d| _         n?fd| j        D             | _        | !                               |j"        dk    rd| _         | S )NTr(   FrL  )function_cnamer  r   c                 :    g | ]}|                               S rW   rA  r6  s     rT   r   z0SimpleCallNode.analyse_types.<locals>.<listcomp>  rI  rU   r   )#analysedrP  r&  r4  r<  rZ  r   
is_cmethodr#  rY   r  rS  is_numpy_call_with_exprsr@   rU  rE   rO  r   r   r  rC   rH  add_include_filerF   NumPyMethodCallNoderM  rG   rH   r=   rq   r   rE  r   rN  r   )rY   rs   r&  r  has_pythran_argsr>  s    `    rT   r<  zSimpleCallNode.analyse_types  s   = 	K++C00 	K"#33C88=  	0X^ 	08Q 	0 !DI$TY//HL&&((	(-%3 	CH$? 	C/99	C#&tx	BBBDN!^99#>>DN~* K K $Ec$J$JJ  ,01A,B,BD)( 	$  !>x!H!HIII&00.x88. !28T^=P!Q!QRR	 1    " 
	$&tx	BBBDN!^99#>>QQRUVVDNDI##Hi888DLLGGGGDIGGGDI((---(C//#rU   c                 :    | j         j        }|j        r|j        }|S rN   )r&  r   r  r  rY   r  s     rT   rS  zSimpleCallNode.function_type  s'     M&	 	,!+IrU   c                    | j         j        }|t          u rt          | _        d S |j        r<|j        r5| j        r&| j        j        j        rt          | j        d           | j	        }n| j        r| j        g| j	        z   }n| j	        }|j
        rA| j         j        j                            d          }|t          j        | _        d| _        d S nNt          | j         d          r| j         j        }n,| j         j        r| j         j        r| j         j        j        }nd }|r| j         j        j        r+| j         j                                        }d |D             }n|                                }t          j        d |D             || j        ||          }|st          j        | _        d| _        d S d|_        |j
        s|| j         _        |j        | j         _        |                                 }nOd }|                                 }|j        s2t          | j        d|z             t          j        | _        d| _        d S t3          |j	                  }||j        z
  }	t3          |          }
|j        r|	|
k    rd	| _        d	| _        |rg|j        r_|j	        rW|j        sO|j	        d
         }|d
         }|j        r| j        rV| j                            d                     t3          |j!                  dk    rdnd          d|j!        g          | _        n(|                    d|j!        |j        j!        g          }| j        rS|j"        rtG          | j                  }ntI          | j                  }|%                    |j        |          x}| _&        nO|j        j'        rC|%                    |j        |          }|j        j'        rtQ          |tR                    rd|_*        ||d
<   d}tW          tY          ||
                    D ]}|j	        |         }|j        }||         %                    ||          }|j        r|                    d          }|j        r	|d
k    rd}nS|j        j-        rG|j.        s@|d
k    r| j        n2|/                                rn|d
k    rd}|0                    |          }|||<   tW          ||
          D ]}||         }|j        j-        ru|j        tb          u rt          j2        }n|j        3                                }|$t          | j	        |d	z
           j        d           n|%                    ||          x||<   }|j        r|d
k    rd}|rtW          |
d	z
            D ]y}|d
k    r| j        ||         }|/                                r-|j        j
        r:|j.        r|j        j-        rN|d
k    s|d	k    r| j        ti          |j        dd
            nz|| j	        d d <   tQ          | j         tj                    r$t          j6        | j         j7                  | _        n|j8        | _        | j         j9        s| j         j:        r#| j         j        }|r|j;        s|j<        rd	| _        | j        j-        rtz          | _>        d	| _        n)|j?        |j@        rd	| _        n| j        jA        rd	| _        | j        r/| j        jB        r#t          jC        | j        jD                  | _        |j@        dk    r7t          |          r(|F                    t          jH        dd                     |jI        d         | _J        d S )Nz4Cannot call a static method on an instance variable.z
operator()r  r   c                     g | ]	}|j         
S rW   )r   )rc   fs     rT   r   z:SimpleCallNode.analyse_c_function_call.<locals>.<listcomp>.  s    ;;;A;;;rU   c                     g | ]	}|j         
S rW   r  rc   r>  s     rT   r   z:SimpleCallNode.analyse_c_function_call.<locals>.<listcomp>2  s    *D*D*D38*D*D*DrU   TzCalling non-function type '%s'r(   r   *'NoneType' object has no attribute '%{0}s'   .30r  PyExc_AttributeError)r   rF  z@descriptor '%s' requires a '%s' object but received a 'NoneType'rF  FzGcannot pass None into a C function argument that is declared 'not None'z5Python object cannot be passed as a varargs parameterTArgument evaluation order in C function call is undefined and may not be as expectedr   r  r  overflowcheck)Kr&  r   r/   rU  is_static_methodrY   r{  r   r   r   r  r,  r-  r   r  r  r   r[  r  rg  r  r7  r8  r  rS  r   optional_arg_counthas_optional_argsr   rh  not_nonerG  r  rr   accept_builtin_subtypesCMethodSelfCloneNoder  r  rU  r|  r   r  exact_builtin_typerangeminrq   r   rV  r9  r   rm   default_coerced_ctyper   rg  r~  rl  r  r   rZ  r  utility_code_definitionr   r$  r   r   r   r  CFakeReferenceTyper  r   r   r	   r   rk   rz  )rY   rs   r  r   overloaded_entry	functypesr;  r   	max_nargsexpected_nargsactual_nargs
formal_argr>  some_args_in_tempsrT  formal_type	arg_ctyper=  s                     rT   rN  z&SimpleCallNode.analyse_c_function_call  s%   M&	
"""DIF! 
	i&@ 
	y XTY^= X dh VWWW9DDY 	I;*DD9D! 	$#}17>>|LL'&1	#,  ( T]G,, 	$#}2]' 	$DM,H 	$#}17# 	}!* C M.QQSS	;;;;;/@@BB)*D*Dt*D*D*D*6#tM ME  &1	#, EJ) ,&+#!&DM**,,IIE**,,I) dh @9 LMMM&1	#,  	''	"Y%AA4yy' 	Nl,J,J%&D"DL  	U% 	). 	A[ 	"*Jq'C" 
H9 	H $	 ; ;DKKUXY^YcUdUdhjUjUjEEprss4%*ZL !< !2 !2DII //Z%*Z1E$F 0 H HC y 
35 /.ty99CC#DI..C*---
*M*MMd''0 3mmJOS998+ 3
30O0O 3-2C*DG #s9l3344 	 	A"*J$/Kq'##K55C" _++]_ _{ 2q55)-&% 2ci 266di3--// 
2 1uu-1*,,S11CDGG y,// 	* 	*Aq'Cx# 	B8x'' * :II # > > @ @I$$)AaC.,QS S S S %(MM)S$A$AADGc{ *q1uu%)" 	 <>**  66di31g++-- X* Y 
38#7 
  1uuQ49+@)  BC  D  D  D	!!! dm[11 	."+DM,DEEDII!-DI=  	!DM$> 	!,J !z6 !*:\ ! 9  	 .DDLL&2i6O2DLLY) 	DL < 	ODI2 	O"5di6MNNDI $++-i88 j$$[%<=UWg%h%hiii ^O<rU   c                 *    |                                  S rN   )c_call_coderX   s    rT   r  z$SimpleCallNode.calculate_result_code  s    !!!rU   c                    |                                  }| j        t          j        u s|j        sdS |j        }g }t          t          || j                            }t          |j                  }||j	        z
  }t          | j                  }|d |         D ]4\  }}	|	
                    |j                  }
|                    |
           5|j        rE|                    t          t          | j        p| j        j        j                                       |j	        r(||k    rd}n
d| j        z  }|                    |           | j        t          |          d          D ])}	|                    |	                                           *| j                                        dd                    |          d}|S )Nr  r  r  r
  r  r`  )rS  r   r   r/   rU  r   r  r}  r   r|  r  r  r  rx   r  wrapper_callr&  r   is_unbound_cmethodopt_arg_structr  r  r  )rY   r  formal_argsarg_list_coder   r  r  r  r  
actual_argarg_codeoptional_argsr  s                rT   r  zSimpleCallNode.c_call_code  s   &&((	9
---Y5K-9nCTY//00	''	"Y%AA49~~&*?N?&; 	+ 	+"J
!44Z_EEH  ****# 	h  S):)ddm>Q>d%e%e!f!fggg' 	0-- & %(; ;  ///)C$4$4$5$56 	? 	?J  !;!;!=!=>>>>!]113333TYY}5M5M5M5MNrU   c                 V    |                                  }|j        r|j        dk    rdS dS )Nr   FT)rS  r   r   rn  s     rT   r  z#SimpleCallNode.is_c_result_required  s5    &&((	( 	I,E,L,L5trU   c                 &   | j         }|j        s|j        r|j                            |j                   d}| j        j        o| j        j        }| j	        r|r|
                                |v r|j                            t          j        dd                     |                    d| j        d         
                                d| j        d         j                                        d|                    | j                  d           |j        j        r5t)          | j        j                  d	k    s| j        j        r6| j        j        r*t/          t0          |                               |           d S | j        j        r| j        j        d         nd }| j        | j        ||f}|D ]}||                    |           |                    | j                   | j        sJ |                     |           ||j                            t          j        d
d                     |                    | 
                                d|                                d|                     | 
                                | j                             n|j                            t          j        dd                     |                    | 
                                d|                                d|                                d|                     | 
                                | j                             | !                    |           |D ].}|*|"                    |           |#                    |           /d S )N)abslabs__Pyx_abs_longlongCommon
Overflow.cr.  r   z == __PYX_MIN(z))) {                PyErr_SetString(PyExc_OverflowError,                                "Trying to take the absolute value of the most negative integer is not defined."); z; }r(   PyObjectCallNoArgr  z = __Pyx_PyObject_CallNoArg(rc  PyObjectCallOneArgz = __Pyx_PyObject_CallOneArg(r  )$r&  r   rZ  r   use_entry_utility_coder   r   r  r  rz  r  r   r	   r   r   r   rr  r   r   rq   r   r  r   rP   r.  r  rY   rU  r  r   r  r   r   r  r  r  )	rY   r   r&  abs_function_cnamesis_signed_intr>  r   subexprrS   s	           rT   r  z'SimpleCallNode.generate_evaluation_code  s   = 	Dx4 	D33HNCCCC	(=TY-= 	8- 	8HOO4E4EI\4\4\--k.EhP\.].]^^^JJJ !IaL//1111 IaL-DDFFFF OODH55557 8 8 8 }( 	C0C,D,Dq,H,H# -I(,(A -I.$''@@FFFF )-(;Edn!!$$It0(C@ 	7 	7G"00666dh|!!$''';--k.E#%7/9 /9 : : :JJKKMMMM&&((((++DKKMM48DDDFG G G G --k.E$&8/: /: ; ; ;JJKKMMMM&&((((MMOOOO++DKKMM48DDD	FG G G 	T""" 	) 	)G"..t444""4(((	) 	)rU   c                 
   |                                  }|j        r| j                                        }|j                            t          j        dd                     |                    | 	                                d| j
                                        d|d|                    | 	                                | j                             |                     |           d S |j        rb|j        j         }| j        r*t%          | j                  }t%          |j                  |j        z
  }|j                            |j        j        d          | _        |                    | j        dt2          j        d	z   d
t%          | j                  |z
  d           t7          t9          |j        | j                            }|||         D ]X\  }}	|                    | j        d|                    |j                  d
|	                    |j                   d           Yg }
| j         j        r3| j!        r,|
"                    d| 	                                z             nm| j         j#        rJ| j!        sJ |
"                    | j         $                    | 	                                                     n|j%        dk    r|j&        }|j%        }|D|
"                    | 	                                d|j'        (                    |                     |r|r|
sYtS          | j
        dd           }tU          j+        | j        |j        j,        |r|j        nd | j         j-        d|o|j.                   |j                            t          j        dd                     |
"                    d           n|
"                    d           | j!        s|
rC| /                                }| 	                                rFd| 	                                z  }| j!        r'| j         j        rta          tb          | j         |          }nd}|j%        dk    rDte          || j        ||d| j         j        r| 	                                nd |j&        |           nO|
r/|3                    d4                    |
          | j                  }nd}|                    ||d|           | j         j        r)| 	                                r|                     |           | j        r#|j        5                    | j                   d S d S d S )Nr  r  r  r  z	, NULL); Tr  r   r  r  r  r&  r   z == r   )function_namevoid_returnis_callis_from_pxdr   r   r   r   z%s = r  z && rW  )6rS  rq   r  r   r   r   r	   r   r   r  r&  r   r   r  rU  r  	gil_ownedr}  r   r   r|  r  op_arg_structr  r  r   pyrex_prefixr  r}  opt_arg_cnamerr   r  r   r   r  r   error_conditionr   r   r  	cast_coder   r   write_noexcept_performance_hintr,  r  defined_in_pxdr  r.   r   r   r   r  r  )rY   r   r  r  r   r  r  r   r  r  
exc_checksexc_val	exc_checkperf_hint_entryr   r  
goto_errors                    rT   r  z#SimpleCallNode.generate_result_code7  s   &&((	  M	A~//11H--k.E 2/4 /4 5 5 5JJKKMMMMM++----HH++DKKMM48DDD	FG G G   &&&&&# B	A00E% D"49~~!$Y^!4!4y7S!S&*n&B&B+5$ 'C 'H 'H#

++++c111DI7779 : : : C		::;;.2>,3N.O D D*J
JJ ///%33JODDDD&00AAAA C D D D D Jy$ > >!!%$++--"78888- >|###!!$)";";DKKMM"J"JKKKK*c11#3%5	&%%DKKMMMM9CXCbCbcjCkCkCk&lmmm > >) b.5dmWd.S.SO&F $$.*>FU._o.B.B[_,0I,=t-<-_A_	b b b b
 (99'34H.YY[ [ ["))*FGGGG"))*<===| /z /&&((;;== !DKKMM1C| G	(= G '~ty#FFC,33+D$(ssCCC<P=AY=R,\DKKMMMX\,5,EuN N N N " (%)%7%7J8O8OQUQY%Z%Z

%'
JJSS###zzBCCC9( /T[[]] /((...% A++D,?@@@@@EB	A B	ABA ArU   )r[   r\   r]   r   rY   rU  r  r  r}  r   rg  rz  r2  rd  r^  re  rJ  r<  rS  rN  r  r  r  r  r  r^   r_   s   @rT   r.  r.    s4        IHHHDLILEHM- - -   [     "  . . .`	 	 	I= I= I=V" " "  <  7) 7) 7) 7) 7)rOA OA OA OA OA OA OArU   r.  c                   "    e Zd ZdgZdZdZd ZdS )rk  r  Tc                    |                     | j                   |                     |           | j        j        J | j        j        }|D ]}|                    |           |                    d           |                    d|                                 z             |                    d|                                 d|                                 d| j	        dd
                    d |D                       d		           d S )
Nz.// function evaluation code for numpy functionrl  r  r  r  z{}(r  c              3   >   K   | ]}|                                 V  d S rN   )r  )rc   ra  s     rT   rf   z?NumPyMethodCallNode.generate_evaluation_code.<locals>.<genexpr>  s.      77Qa&&((777777rU   )};)r  r   r  r  r   r   r  r   r  re  r  )rY   r   r   r>  s       rT   r  z,NumPyMethodCallNode.generate_evaluation_code  s   dh!!$'''~)111~" 	/ 	/C((....

CDDD

/$++--?@@@


KKMMMMKKMMMMII77$7777777	9 	: 	: 	: 	: 	:rU   N)r[   r\   r]   r   r   rB  r  rW   rU   rT   rk  rk    s6         }HGO: : : : :rU   rk  c                        e Zd ZddgZdZd ZdS )PyMethodCallNoder&  r  Tc           	      &   |                     | j                   |                     |           | j                            |           | j        j        J | j        j        }|D ]}|                    |           | j        j        }|r| j        	                                }n|j
                            t          d          }| j                            |           |                    |d| j                                        d           | j                            |           | j                            |           |j
                            t          d          }|                    d|z             |j
                            t&          j        d          }|                    d|z             d }| j        j        r || j                  rd	nd
}	nh| j        j        rZ| j        j        rN| j        j        D ]>}
|
j        }|r3|j        r,|j        j        r |j        j        j        r ||          rd	}	 n?d
}	nd
}	|                    d           |                    d|	d|d           |                    |d|d           |                    d|z             |                    d|z             |                    |t                     |                    dt                     |                    |t          d           |                    d|z             |                    d           |                    d           |                    d           |j                            tA          j!        dd                     |                    d           |                    d|rtE          |          dz   nd||rd#                    d |D                       ndfz             |                    d | 	                                ||tE          |          |fz             |$                    |t                     |j
        %                    |           |j
        %                    |           |D ],}|                    |           |                    |           -|                    |&                    | 	                                | j                             | '                    |           |r5| j                            |           | j                            |           n5|(                    |t                     |j
        %                    |           |                    d           d S )!NTr  r  rW  r  Fr  c                 >    | j         }|j        r|j        j        rdS dS r>  )r#  r   r   r  )r  r#  s     rT   attribute_is_likely_methodzMPyMethodCallNode.generate_evaluation_code.<locals>.attribute_is_likely_method  s)    (C{ sy4 u4rU   likelyunlikelyz#if CYTHON_UNPACK_METHODSr  z(PyMethod_Check(r  z = PyMethod_GET_SELF(r  if (likely(%s)) {z/PyObject* function = PyMethod_GET_FUNCTION(%s);r&  r~  r   r  PyObjectFastCallr  r  z(PyObject *__pyx_callargs[%d] = {%s, %s};r(   r5   r  c              3   >   K   | ]}|                                 V  d S rN   r   rs  s     rT   rf   z<PyMethodCallNode.generate_evaluation_code.<locals>.<genexpr>  s*      66#cmmoo666666rU   r  z=%s = __Pyx_PyObject_FastCall(%s, __pyx_callargs+1-%s, %d+%s);))r  r   r  r&  r  r  r   r   r   r  r  r  r   r  r  r   r  r  r   r   c_uint_typerZ  r   r   r   r#  r   rq   r  r  r   r   r	   r   r   r  r0  r  r   r  r  )rY   r   r   r>  reuse_function_tempr&  self_argarg_offset_cnamer  likely_methodr  r   s               rT   r  z)PyMethodCallNode.generate_evaluation_code  s   dh!!$'''..t444~)111~" 	/ 	/C((.... #m3 	+}++--HH~33Nt3TTHM..t444HHHHHdm.E.E.G.G.G.GHIIIM00666M$$T***>//4/PP

<(*+++>77
8N[`7aa

9//000	 	 	 =% 	'(B(B4=(Q(QaHHWaMM]" 	't}'= 	'"m4 + +
" U/ EIN uy~Ga 11%88 (0 *&M

.///


mmmXXXNOOO

HHHhhhGHHH 	

&1222

DxOPPP.111
N333HnjAAA

9//000

3

3

8 	))#$68JKK	M 	M 	M 	

3 	

=#*SYY]]:>JDII66666666FA
 
 	 	 	
 	

RKKMMIIV  	 	 	 	x888##H---##$4555 	! 	!C&&t,,,NN4    

4**4;;==$(CCDDDT""" 	2M00666M$$T****!!(N;;;N''111

3rU   N)r[   r\   r]   r   r   r  rW   rU   rT   r  r    s9         K(HGc c c c crU   r  c                   8    e Zd ZddgZdZeZdZdZd Z	d Z
d ZdS )InlinedDefNodeCallNoder   r  r(   Nc                     | j         j        }|j        s|j        rdS t	          |j                  t	          | j                  k    rdS |j        rdS dS r>  )r&  def_nodestar_argstarstar_argr   r   num_kwonly_argsrn  s     rT   can_be_inlinedz%InlinedDefNodeCallNode.can_be_inlined"  s]    =)	 	!7 	5y~#di..005$ 	5trU   c                    | j                                       | _         fd| j        D             | _        | j        j        }t          | j                  }d}t          |          D ]}|j        |         j        }| j        |                             |          }|j	        r	|dk    rd}nE|j        j
        r9j        s2|                                rn|dk    rd}|                              }|| j        |<   |rvt          |dz
            D ]c}| j        |         }|                                r$|j        j        r1j        r|j        j
        rE|dk    rt          |j        dd            nd| S )Nc                 :    g | ]}|                               S rW   rA  r6  s     rT   r   z8InlinedDefNodeCallNode.analyse_types.<locals>.<listcomp>/  s'    CCCc'',,CCCrU   Fr   Tr(   ry  )r  r<  r   r&  r  r   r  r   r  r   rq   r   rV  r9  r  r   r   )rY   rs   r  r  r  rT  r  r>  s    `      rT   r<  z$InlinedDefNodeCallNode.analyse_types,  s   !/==cBBCCCC	CCC	M*	49~~ #|$$ 	 	A#.+0K)A,((c::C{ 2q55)-&% 2ci 2++-- 
2 1uu-1*,,S11CDIaLL 	 <>**  il++-- X* Y 
38#7 
  1uu)  BC  D  D  D  rU   c                    | j                                         g}| j        j        }t	          | j        |j                  D ]f\  }}|j        j        r.|                    |	                    |j                             ?|                    |
                                           gd                    |          }|                    | 
                                d| j        j        j        j        d|d|                    | 
                                | j                             |                     |           d S )Nr  r  r
  rc  )r  r   r&  r  r}  r   r   rq   r  r  r  r  r   r   pyfunc_cnamer   r   r  )rY   r   r  r  r>  	proto_args         rT   r  z+InlinedDefNodeCallNode.generate_result_codee  s'   &00223M*	!$)Y^<< 	. 	.NCx# .in = =>>>>

----99X&&

&,999''tx@@@	B	C 	C 	C 	T"""""rU   )r[   r\   r]   r   r   r   r   r&  r  r  r<  r  rW   rU   rT   r  r    sb         (HGDHM  7 7 7r# # # # #rU   r  c                   ,    e Zd Zg ZddZd Zd Zd ZdS )PythonCapiFunctionNodeNc                 F    t                               | |||||           d S )N)rr   r   r   r  r  )rY   r   py_namer   r  r  s         rT   r  zPythonCapiFunctionNode.__init__z  s;    $'(| 	 	E 	E 	E 	E 	ErU   c                     | S rN   rW   r   s     rT   r<  z$PythonCapiFunctionNode.analyse_types~  rp  rU   c                 V    | j         r!|j                            | j                    d S d S rN   )r  r   r   r  s     rT   r  z+PythonCapiFunctionNode.generate_result_code  s:     	A--d.?@@@@@	A 	ArU   c                     | j         S rN   r8  rX   s    rT   r  z,PythonCapiFunctionNode.calculate_result_code  rs  rU   rN   )r[   r\   r]   r   r  r<  r  r  rW   rU   rT   r  r  w  sa        HE E E E  A A A    rU   r  c                       e Zd ZdZ	 ddZdS )PythonCapiCallNodeFNc                     |j         | _        | j        | _        t          |||||          | _        t          j        | |fi | d S )N)r  )r  r   r$  r  r&  r.  r  )rY   r   r  r  r  r  rJ  s          rT   r  zPythonCapiCallNode.__init__  s[    )	 I.-') ) )
 	c44V44444rU   r<  )r[   r\   r]   rB  r  rW   rU   rT   r  r    s4         O /3	5 	5 	5 	5 	5 	5rU   r  c                   6     e Zd ZddgZdZ fdZd Zd Z xZS )CachedBuiltinMethodCallNoder#  r   Tc                     t          t          |                               |j        ||||j        |j                   d S )N)r#  r   r   rB  r   )rP   r  r  r   rB  r   )rY   	call_noder#  r   r   rS   s        rT   r  z$CachedBuiltinMethodCallNode.__init__  sL    )40099M4%5	 	: 	! 	! 	! 	! 	!rU   c                 R    | j         | j         S t                              |           S rN   )rB  r   r?  rX   s    rT   r?  z'CachedBuiltinMethodCallNode.may_be_none  s(    +''##D)))rU   c           
         | j         j        j        }| j                                         }d | j        D             }|j                            ||| j        |          }|                    | 	                                d|d|
                    | 	                                | j                             |                     |           d S )Nc                 6    g | ]}|                                 S rW   r  rs  s     rT   r   zDCachedBuiltinMethodCallNode.generate_result_code.<locals>.<listcomp>  s     555C555rU   r  rW  )r#  r   r   r   r   r   cached_unbound_method_call_coder   r   r  r   r   r  )rY   r   
type_cname	obj_cnamer   	call_codes         rT   r  z0CachedBuiltinMethodCallNode.generate_result_code  s    X](
H&&((	5549555$DDz4#3T; ;	

KKMMMM999##DKKMM48<<<
 	 	 	 	T"""""rU   )	r[   r\   r]   r   r   r  r?  r  r^   r_   s   @rT   r  r    sf         vHG! ! ! ! !* * *

# 
# 
# 
# 
# 
# 
#rU   r  c                   F    e Zd ZeZg dZej        Zd Z	d Z
d Zd Zd ZdS )GeneralCallNode)r&  r  r  c                 
   | j                             |          }| j                            |          }| j                            |          }	  ||i |S # t          $ r }|                     |           Y d }~d S d }~ww xY wrN   )r&  r2  r  r  r  r6  )rY   r1  r&  r  r  r5  s         rT   r2  z"GeneralCallNode.compile_time_value  s    =33D99.AA$GG(;;DAA	-8_==== 	- 	- 	-))!,,,,,,,,,	-s   A 
B"A==Bc                     | j         r| j         j        r| j        j        st	          | j        d          | j        j        | j         fS )Nz0Compile-time keyword arguments must be explicit.)r  rW  r  r   r   r   r   rX   s    rT   rJ  z"GeneralCallNode.explicit_args_kwds  s[     	Dd&7&G 	D(@	DtxBD D D#($*;;;rU   c                 :   |                      |          r| S | j                            |          | _        | j        j        j        s| j        j        j        rt          | _        | S t          | j        d          r{|                                 }||| ur|                    |          S | j        j	        j
        r | j                            |          | _        n:|| u rt          | j        d           n n| j                            |          | _        | j        r| j                            |          | _        | j                            |          | _        | j                            |          | _        |                     | j                   d| _        | S )Nr   zRNon-trivial keyword arguments and starred arguments not allowed in cdef functions.r(   )rP  r&  r<  r   rq   r  r/   r  map_to_simple_call_noder   r  r   r   r   r  r  rE  r   r>  s      rT   r<  zGeneralCallNode.analyse_types  s   ++C00 	K33C88}!- 	F}!* &	t}g.. F3355#D(8(8--c222](4 $(M$D$DS$I$IDMMT\\$(EF F F F
  $ @ @ E E 	E $ 1 ? ? D DD#3AA#FF 33C88 	...rU   c                    t          | j        t                    s| S | j        j        s| S | j        }t          |dd          }|s| S |j        }|j        r|j	        }|j
        s| S | j        j        | j        }|j        }|j        r
|dd         }t                    t          |          k    r6t          | j        dt          |          t                    fz             dS d |dt                             D             }|t                    d         }d}t!                    }	t#          |          }
d}|j        D ]A}|j        j        }||
v rt          |j        d|z             d	}|
                    |           Bt-          ||j                  D ]Q\  }}|j        j        }|j        |k    r5|                    |           |dz  }|	                    |j                   Q dd
lm}m} g }t          |j                  |k    r|t          |	          d         }t9          fdt;          |j                  D                       }d}|D ]}|j        }||vr|s|}|r&|j        r| c S t          | j        d|z              dS ||         \  }}|                    |           |dz  }|j                                        r|	                    |j                    ||j                  }|                                sJ |	                    |           |                    ||f           |rg }g }|d         d         }|	D ]g}||u r n`|                                r|                    |           2 ||          }|                    |           |                    |           h|r|}	|d tA          |          D             z   }|j        D ],}|j        j        }||vrd	}t          |j        d|z             -|rdS tC          | j        ||	          }|ddd         D ]} |||          }|S )z
        Tries to map keyword arguments to declared positional arguments.
        Returns self to try a Python call, None to report an error
        or a SimpleCallNode if the mapping succeeds.
        r   Nr(   zDfunction call got too many positional arguments, expected %d, got %sc                 *    h | ]}|j         	|j         S rW   r  rs  s     rT   r   z:GeneralCallNode.map_to_simple_call_node.<locals>.<setcomp>  s2     
 
 
x
H
 
 
rU   r   Fzargument '%s' passed twiceT)r  
LetRefNodec                 V    g | ]%\  }}|j         j        |t                    z   |ff&S rW   )rG  r   r   )rc   rT  r>  pos_argss      rT   r   z;GeneralCallNode.map_to_simple_call_node.<locals>.<listcomp>A  sK     P P P"(!S  #w}qX.DE P P PrU   z(C function call is missing argument '%s'rI  c                     g | ]\  }}|S rW   rW   )rc   rT  r>  s      rT   r   z;GeneralCallNode.map_to_simple_call_node.<locals>.<listcomp>q  s    $F$F$Feac$F$F$FrU   z/C function got unexpected keyword argument '%s'r%  )"r   r  rO  r  rW  r&  r   r   r  r  rU  r   rh  r   r   r   r  setrL  rG  r   addr}  rr   r  r  r  r  r  rL  r  r;  rt  r.  )rY   r&  r   rS  rJ  declared_argsmatched_argsunmatched_argsmatched_kwargs_countr   seen
has_errorsr>  rr   decl_argr  r  tempskeywordsfirst_missing_keywordr   rt  
final_args	new_tempsfirst_temp_arg	arg_valuer   r  s                              @rT   r  z'GeneralCallNode.map_to_simple_call_node  sy    $.	:: 	K 0 	K='400 	K
 	4)3M) 	K',"%* 	.)!""-Mx==3}----$( 2585G5G58]]5DD E E E 4
 
 -ns8}}n =
 
 
 's8}}~~6 H~~ <  
) 	 	C7=Dt||cg;dBCCC!
HHTNNNN !1GHH 	 	MHc7=D}$$  &&&$)$CI&&&&
 	@???????v%&&)===*3t99::6N P P P P,5f6L,M,MP P P Q QH$(!* . .}x''0 504-* 
 ( $
  $$( %46K%L M M M44#D>S  &&&$)$9&&(( .KK	****%:ci00D>>+++++KK%%%LL#t---- G
	!&q"!% 0 0I N22 **,, 0")))4444)z)44!((..."))$//// &%D!$F$Fve}}$F$F$FF ) 	 	C7=D<''!
cgG    	4 dhEEE$$B$K 	4 	4D''d33DDrU   c                    | j         j        rd S | j        r| j                                        }nd}|j                            t          j        dd                     |                    | 	                                d| j
                                        d| j                                        d|d|                    | 	                                | j                  	           |                     |           d S )Nr  r  r  r  r  rc  )r   r  r  r   r   r   r	   r   r   r  r&  r  r   r   r  )rY   r   rJ  s      rT   r  z$GeneralCallNode.generate_result_code  s   9%vv 	&0022FFF))+*A.+0 +0 	1 	1 	1

''))))$..0000''tx@@@B	C 	C 	C 	T"""""rU   N)r[   r\   r]   r   r   r   r+   rr  rs  r2  rJ  r<  r  r  rW   rU   rT   r  r    s}         D>>>H.K- - -< < <  @J J JX# # # # #rU   r  c                   H    e Zd ZdgZdZd Zd Zd Zd Ze	j
        ZdZd Zd	S )
AsTupleNoder>  r(   c                 B    t          | j        j                  | _        d S rN   )r   r>  r   rX   s    rT   r(  z%AsTupleNode.calculate_constant_result  s    $TX%=>>rU   c                     | j                             |          }	 t          |          S # t          $ r }|                     |           Y d }~d S d }~ww xY wrN   )r>  r2  r   r  r6  )rY   r1  r>  r5  s       rT   r2  zAsTupleNode.compile_time_value  sm    h))$//	-:: 	- 	- 	-))!,,,,,,,,,	-s   + 
AAAc                     | j                             |                              |          | _         | j         j        t          u r| j                             d          S t          | _        | S Nr  )r>  r<  r   r   r   rG  r   s     rT   r<  zAsTupleNode.analyse_types  sY    8))#..AA#FF8=J&&8--.QRRR	rU   c                     dS rw  rW   rX   s    rT   r?  zAsTupleNode.may_be_none  rn  rU   Constructing Python tuplec                 T   | j         j        t          t          fv rdnd}|                    |                                 d|d| j                                         d|                    |                                 | j                             | 	                    |           d S )N__Pyx_PySequence_TuplePySequence_Tupler  r
  rc  )
r>  r   r   r   r   r  r   r   r   r  )rY   r   r  s      rT   r  z AsTupleNode.generate_result_code  s    ,0HMnj=Y,Y,Y((_q

tx))++++''tx@@@B	C 	C 	C
 	T"""""rU   N)r[   r\   r]   r   r   r(  r2  r<  r?  r+   rr  rs  re  r  rW   rU   rT   r  r    s{         wHG? ? ?- - -     .K-K# # # # #rU   r  c                   T    e Zd ZdgZdZeZdZd Zd Z	d Z
d Zd Zd	 Zd
Zd Zd ZdS )MergedDictNoder  r(   Tc                     i }| j         }| j        D ]Y}|j        rd |j        D             }n|j                                        }|D ]"\  }}|r||v rt          d|z            |||<   #Z|| _        d S )Nc              3   8   K   | ]\  }}|j         |j         fV  d S rN   r   rc   rG  r   s      rT   rf   z;MergedDictNode.calculate_constant_result.<locals>.<genexpr>  sM       A A'S% -u/DE A A A A A ArU   $duplicate keyword argument found: %s)reject_duplicatesr  rW  rL  r   	iteritemsr   )rY   r  r  r   rv  rG  r   s          rT   r(  z(MergedDictNode.calculate_constant_result  s     2% 	$ 	$D# 9A A+/+?A A A ,6688# $ $
U$ S$%Kc%QRRR#s$
  &rU   c                 V   i }| j         }| j        D ]}|j        rfd|j        D             }n'|                                                              }	 |D ]"\  }}|r||v rt          d|z            |||<   #k# t          $ r}|                     |           Y d }~d }~ww xY w|S )Nc                 j    g | ]/\  }}|                               |                               f0S rW   rX  )rc   rG  r   r1  s      rT   r   z5MergedDictNode.compile_time_value.<locals>.<listcomp>  sU     A A A'S% 00668P8PQU8V8VW A A ArU   r  )	r  r  rW  rL  r2  r   r   r  r6  )	rY   r1  r  r  r   rv  rG  r   r5  s	    `       rT   r2  z!MergedDictNode.compile_time_value  s    2% 	1 	1D# BA A A A+/+?A A A //55??AA1"' ( (JC( WSF]]()ORU)UVVV"'F3KK(  1 1 1--a000000001s   %A==
B&B!!B&c                     dS rw  rW   r   s     rT   rO  z MergedDictNode.type_dependencies      rrU   c                     t           S rN   r   r   s     rT   r   zMergedDictNode.infer_type  s    rU   c                 8    fd| j         D             | _         | S )Nc                     g | ]=}|                                                                                 d           >S )z1argument after ** must be a mapping, not NoneTyper<  r   rG  r6  s     rT   r   z0MergedDictNode.analyse_types.<locals>.<listcomp>  s\     
 
 
  c""55c::LLCE E
 
 
rU   )r  r   s    `rT   r<  zMergedDictNode.analyse_types  s:    
 
 
 
 (	
 
 
 rU   c                     dS rw  rW   rX   s    rT   r?  zMergedDictNode.may_be_none  rn  rU   Constructing Python dictc                    |                     | j                   |                     |           t          | j                  }t          |          }|                    |           |j        t          ur*|	                    d|
                                z             |j        rj|                    |           |	                    |                                 d|
                                d           |                    |           n|	                    |                                 d|
                                d|                    |                                 |j                             |                     |           |                    |           |j        t          ur|	                    d           |j                            t)          j        dd                     |	                    |                                 d	|
                                d|                    |                                 | j                             |                     |           |                    |           |	                    d
           |                    |           t/                      }|D ]}|j        rw|j        D ]l}|                    |           | j        r|	                    d|                                 d|j        
                                d           |                    d           |	                    d|j        
                                d|                    | j                             |	                    d
           |                    |j        j        d|                                 d|j        
                                d|j        
                                d           |                    |           |                    |           n|                    |           | j        r\|                    d           |                    |j        d|                                 d|
                                d           n|                    d           |	                    d|                                 d|
                                d           |	                    d|
                                z             |	                    |                    |j                             |	                    d
           |                    |           |                    |           t?          |          D ]/}|j                            t)          j        |d                     0d S )Nz$if (likely(PyDict_CheckExact(%s))) {r  r  z = PyDict_Copy(rc  r  r  r  z6 = __Pyx_PyObject_CallOneArg((PyObject*)&PyDict_Type, r   if (unlikely(PyDict_Contains(r  r  RaiseDoubleKeywords+__Pyx_RaiseDoubleKeywordsError("function", PyDict_SetItem(r`  MergeKeywordsz__Pyx_MergeKeywords(RaiseMappingExpectedzif (unlikely(PyDict_Update(z	) < 0)) {zVif (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseMappingExpectedError(%s);FunctionArguments.c) r  r   r  r  r  r  r  r   r   r   r   rW  r  r  r  r   r  r  r   r   r	   r   r  r  rL  r  rG  r  r   r<  r   rt  )rY   r   r   r   helpersr>  helpers          rT   r  z'MergedDictNode.generate_evaluation_code  s   dh!!$'''D%&&Dzz%%d+++9I%%JJ=~~''( ) ) )  
	.%%d+++JJT[[]]]]DNN4D4D4D4DEFFF..t4444JJ    ''tx@@@B C C C   &&&''---9I%%JJz"""--k.E$&8/: /: ; ; ;JJ    ''tx@@@B C C C   &&&''---JJsOOO%% &	& &	&D# %&/ ) )C00666- 	(


 KKMMMMG--////$1 2 2 2  $9:::


G--//// OODH555$7 8 8 8 

3))#'++))++++	++----8/ 0 0 0 ..t444NN4((((#)& --d333) $KK000))$((t~~'7'7'7'759 : : : : KK 6777JJJt~~'7'7'7'7 9 : : :JJ  FHLHXHX Y Z Z ZJJttx88999JJsOOO++D111%%%%Woo 	f 	fF--k.EfNc.d.deeee	f 	frU   c                 D    | j         D ]}|                    |           d S rN   )r  r  rY   r   r   s      rT   r  zMergedDictNode.annotateY  s3    % 	  	 DMM$	  	 rU   N)r[   r\   r]   r   r   r   r   r  r(  r2  rO  r   r<  r?  re  r  r  rW   rU   rT   r  r    s        
 HGD& & &$  (         -KOf Of Ofb         rU   r  c                      e Zd ZdZ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)dZd Zd Zd Zd Zd Zd Zd Zd Zd*dZd+dZd Zd ZdZ d Z!d Z"d Z#d  Z$d! Z%d" Z&d# Z'd$ Z(	 	 d,d%Z)d-d&Z*d' Z+d( Z,dS ).r/  r(   r#  Nr   TFc                     t          | j        t                    r| j        j        r| j        dk    s| j        S | j                                        }|r|d| j        S d S )Nparallelr   )r   r#  r  r  r$  rA  )rY   cys     rT   rA  z!AttributeNode.as_cython_attributew  sk    tx** 	")	"+-->!X))++ 	2 bb$..11trU   c           	      $   |t           u rk| j        }|r8|j        r1|j        r*d| _        |j        | _        |                     |           | S |r'|j        r| j        j        t          j	        urddl
m}m}  || j        | j        j                  }| j        j        |_        || _        t                              | ||          }t!          j        dd          }t%          j        t$          j         t%          j        dt$          j         d           t%          j        dt$          j         d           g          }	t+          | j        d|	||g|	          }
 |||
          }|                    |          S t                              | ||          S )
Nr(   r  r  PyMethodNew2Argr  r  rY   __Pyx_PyMethod_New2Arg)r  r  r   r  )r   r   rU  r  r   analyse_as_python_attributer#  r   r   r   r  r  r  r$  r   r  r	   r   r   r  r  r  r   r<  )rY   r	  rs   r   r  r  obj_nodeunbound_noder  r  binding_callcomplete_calls               rT   r  zAttributeNode.coerce_to  s    ~%%JE "8+ "80A "8 ".
00555 85- 8$(-wGX2X2X
 KJJJJJJJ(=FFF(,(=%#'11$#FF(4%'9  '0-"/
8QSWXX"/
8QSWXX0 	  2H":'&1!-      !5 4X| L L$223777!!$#666rU   c                     | j         }|                    d          r|                    d          rd S t          | j        j        |          | _        d S )N__)r$  
startswithendswithr   r#  r   )rY   r  s     rT   r(  z'AttributeNode.calculate_constant_result  sR    ~??4   	T]]4%8%8 	F&tx'?FFrU   c                 H   | j         }|                    d          r/|                    d          rt          | j        d|z             d S | j                            |          }	 t          ||          S # t          $ r }| 	                    |           Y d }~d S d }~ww xY w)NrE  z6Invalid attribute name '%s' in compile-time expression)
r$  rF  rG  r   r   r#  r2  r   r  r6  )rY   r1  r  r#  r5  s        rT   r2  z AttributeNode.compile_time_value  s    ~??4   	T]]4%8%8 	$(JTQS S S4h))$//	-3%%% 	- 	- 	-))!,,,,,,,,,	-s   'A7 7
B!BB!c                 6    | j                             |          S rN   )r#  rO  r   s     rT   rO  zAttributeNode.type_dependencies      x))#...rU   c                    |                      |d          }|G|j        j        r/|j        j        j        rt	          j        |j        j                  S |j        j        S |                     |          }||j        j        S | j                            |          }| 	                    ||           |j
        r| j        j        rt          S | j        r| j        j        rt          S | j        S )NFtarget)obj_type)#analyse_as_cimported_attribute_noder   r   rU  r   r~  analyse_as_type_attributer#  r   analyse_attributer|  r   rh  )rY   rs   r   rN  s       rT   r   zAttributeNode.infer_type  s    77E7JJz '4:?#? '!*4:?;;;z&--c22:?"8&&s++sX666# 	"	(> 	" "!Z 	"DJ1 	" "!yrU   c                     d| _         d S ry  r  r   s     rT   r8  z(AttributeNode.analyse_target_declaration  r%  rU   c                     |                      |d          }|j        j        rt          | j        d| j        z             |                                st          | j        d| j        z             |S )Nr(   rL  z"Assignment to const attribute '%s'r  )r<  r   r  r   r   r$  r   r>  s      rT   rD  z"AttributeNode.analyse_target_types  st    !!#!229 	S$(@4>QRRR~~ 	Q$(CdiOPPPrU   c                 j   | j         st          j        | _         |j        d         | _        |                     ||          }||s|                     |          }||                     ||          }|J |j        s|j	        r|j
        rd|j
        _        |j        r|                    |           |S )Nr  T)r   r   r/   rk   r  rO  rP  "analyse_as_ordinary_attribute_noderZ  r   r   r  wrap_obj_in_nonecheck)rY   rs   rM  r   s       rT   r<  zAttributeNode.analyse_types  s    y 	."-DI!$0B!C77VDD<<11#66D<::3GGD### 	# 	#4: 	#"DJO 	,&&s+++rU   c                 R   | j                             |          }|r|                    | j                  }|r:|j        s3|j        s|j        s|j        s|j        r| 	                    |||          S | 
                    |          rt          | j        d| j        z             | S d S )Nz&cimported module has no attribute '%s')r#  rb  r  r$  r  r  rU  r  r  as_name_noder  r   r   )rY   rs   rM  module_scoper   s        rT   rO  z1AttributeNode.analyse_as_cimported_attribute_node  s    
 x11#66 		 ,,T^<<E =U@ =$=(-(:=}=(-= ((eV<<<66s;; dh H4> YZZZtrU   c                      j         j        rd S  j                                       rAj        sj        sj        rj                             j                  }|rv|j	        sj        rh|j
        j        r\j        r j        sd S |}n1                     |          } fd|j        D             |_                             |d          S nj        sj        r j        j        v rYj        j        D ],}|j         j        k    r                     |d          c S -t-           j         j        d           nt-           j         j        d           d S )Nc                 >    g | ]}                     |          S rW   )_create_unbound_cmethod_entry)rc   overloaded_alternativers   rY   r   s     rT   r   z;AttributeNode.analyse_as_type_attribute.<locals>.<listcomp>  s=     > > > 6 !>>tE[]`aa> > >rU   FrL  z not a known value of )r#  rY  re  r{  r|  r  r,  r  r$  rh  r   rU  r4  r\  overloaded_alternativesrX  r(  r  r?  r   enum_valuesrr   r   r   )rY   rs   r   
ubcm_entryr   s   ``  @rT   rP  z'AttributeNode.analyse_as_type_attribute  s   
 8% 	Fx'',, 	[% [)= [AR [
..t~>> Le. L$2C L
H_ L+ 
#~ (#'4%*

%)%G%GeUX%Y%Y
> > > > > >:?:W> > >
:  ,,S*U,KKK [!1 [>T[00!%!7 _ _ :77#'#4#4S%#4#N#NNNN 8 dhX\X\(]^^^^$(DNNNTXTX$YZZZtrU   c                 :   |j         r|j        j        |j         }|j        j        s|j        r|j        j        r|j        }n|j        r,t          | j        |j	        d|           t          j        }net          j        |j                  }|j        d d          |_        t          j        d|dd           |j        d<   n|j        d|j        }|j        }t#          j        |j	        ||          }d|_        |j         |_         d|_        |j        |_        |S )Nz not a static member of rY   r   r  r(   )
func_cnamer   r  r{  parent_scopeis_cpp_class_scoper  r   r   rr   r   r/   r  r   r  vtabptr_cnamer   r   r  rU  r  r,  )rY   r   r   rs   r   r   r`  s          rT   r\  z+AttributeNode._create_unbound_cmethod_entry*  s(     	
 8 @$Ez* 
T$
T),)9)L
T
" Tdh%***dd STTT"- 	%*--"Z]
 * 7fd S S
1 $ 2 2 2EKK@EJE\%*eU;;
"#
 % 0
()
% ;
rU   c                 "   | j                             |          }|r|                    | j                  S | j         j        sL| j                             |          }|r0t          |dd           |j                            | j                  S d S )Nr,  )r#  rb  lookup_typer$  rY  re  r   r,  )rY   rs   rY  r  s       rT   re  zAttributeNode.analyse_as_typeD  s    x11#66 	<++DN;;;x) 	C0055I CWY>>J 224>BBBtrU   c                     | j                             |          }|rB|                    | j                  }|r&|j        r|j        j        s|j        j        r|j        S d S rN   )r#  rb  r  r$  r  r   r{  r|  rY   rs   rY  r   s       rT   rm  z'AttributeNode.analyse_as_extension_typeN  sm     x11#66 	& ,,T^<<E & &:/ &5:3M & :%trU   c                     | j                             |          }|r*|                    | j                  }|r|j        r|j        S d S rN   )r#  rb  r  r$  r  ri  s       rT   rb  zAttributeNode.analyse_as_moduleY  sT     x11#66 	' ,,T^<<E ' '&trU   c                     t                               | | j        |          }|r|                    |          }n|                    |          }d|j        _        |S )N)rr   r   r(   )r  rM  r$  rD  r  r   r  )rY   rs   r   rM  r   s        rT   rX  zAttributeNode.as_name_nodec  s^     !!$T^5!II 	2,,S11DD,,S11D
rU   c                     | j                             |          | _         |                     |           | j        r| j        j        r| j        s	 | j        r|sd| _        t          | _	        n|r'| j         j
        j        rt          | j        d           nh| j        ra| j        j        rU|s>t                              | j        | j         | j                                      |          S t          | j        d           | S )Nr(   z'Assignment to an immutable object fieldz"Assignment to a read-only property)r#  r<  rQ  r   rh  r4  
is_py_attrr   r   r$  r   r|  r   r   is_cpropertyr.  r^  )rY   rs   rM  s      rT   rU  z0AttributeNode.analyse_as_ordinary_attribute_noden  s
   8))#..s###: 	$*/ 	 	 ? 
	B 3 $2! 	B5 	B$(EFFFFZ 	BDJ3 	B g%33DHdh
SSaabefff$(@AAA rU   c                    |d u}d| _         | j        | _        |N| j        j        j        s| j        j        j        r| j                            |          | _        | j        j        }n|j        s|j        rt          }|j	        s|j
        r|j        }d| _        n3|j        s|j        rd| _        n|j        r|j        rd| _        nd| _        |j        rs|                                r|j                            | j                  }|j        r|s| j        dk    r@d| _        d| _        d| _        | j        j                            | j                  | _        d S |                    | j        || j                   |j                            | j                  }|r	|j        rd }n+t;          | j        d|z             t<          j        | _        d S || _         |rl|j        r |j!        dk    rt;          | j        d           |j"        r|j        | _        d S |j#        r|j$        r|j%        r|j        | _        |j&        | _        d S 	 | '                    |||           d S )	Nr   r  r   TTz/Cannot select attribute of incomplete type '%s'__weakref__z,Illegal use of special attribute __weakref__)(rm  r$  rO  r#  r   r  r  r   r   r  rT  r  rn  r{  r|  r  is_fake_referencehas_attributesattributes_knownr,  r  r   is_memslice_transposer   r  	transposer   declare_attributer  r   r   r/   r   rr   rn  r  r  rh  r   r?  )rY   rs   rN  immutable_objr   s        rT   rQ  zAttributeNode.analyse_attribute  s    ,nx}& <$(-*H <866s;;x}HH! *X%> *)? 	h/ 	)HDGG' 	8+C 	DGG" 	x'A 	DGGDG" *	((**  224>BB. 	Ku 	K~,,592'+/3,$(HM$;$;DH$E$E	 224>3QQQ ( : :4> J J !U_ ! EdhE      '1	DJ - T%*2M2M$($RSSS %  %
DIF' 0E %JZ  %
DI"'+DKF
 
 	((hFFFFFrU   c                    || j         j        }|                    | j                  | _        | j        | _        t
          | _        d| _        |j        s|j        s|j	        sT|j
        sM|j        sF|j        s?|j        s8|j        r|                    |          s|j        r:|                    |          r%|s!| j                             |          | _         d S d S |j        ri| j         j        s| j         j        rQ| j         j        j        r@| j         j        j        j        j        r%|s!| j                             |          | _         d S d S t/          | j        d|d| j        d           d S d S d S )Nr(   zObject of type 'z' has no attribute 'r  )r#  r   mangle_class_private_namer$  rO  r   rm  rq   r  r  r  r  r   r  r1  r  	is_structr   rU  r   rZ  r   r  r   r   )rY   rs   rN  rx  s       rT   r?  z)AttributeNode.analyse_as_python_attribute  s   x}H66t~FFn"	# 	2H,= 	2" 2h&< 2)2-5-H2*2 !*2 08/N/Ns/S/S2 !*	2 08/N/Ns/S/S	2
 % @#x::3??DHHH@ @' 	2TX-= 	2AV 	22	227C	2 % @#x::3??DHHH@ @ dhhxx12 2 2 2 2!	2 	2 	2 	2rU   c                    |j         d         sd S d }d}| j        j        j        rF| j        r?| j        s8d                    t          | j                  dk    rdnd          }| j        f}nP| j        j        j	        r?| j
        rd}n5| j        j        j                            | j                  }|r
d}|j        f}|r$| j                            |d	|
          | _        d S d S )Nr  rW   rt  ru  rv  r  z&Cannot transpose None memoryview slicez5Cannot access '%s' attribute of None memoryview slicerw  rx  )rk   r#  r   r{  needs_none_checkrm  r  r   r$  r   ru  r,  r  rr   rG  )rY   rs   r  rF  r   s        rT   rV  z#AttributeNode.wrap_obj_in_nonecheck  s   ~k* 	FHM+ 	00E 	0	0>EEsSWSaObObfhOhOheenpqqC>+KKX]- 	0) 0>+77GG 0QC#(:-K 	Kx11#7M>I 2 K KDHHH	K 	KrU   c                 @    | j         r|                                  d S d S rN   )rm  rr  r   s     rT   rs  zAttributeNode.nogil_check  s,    ? 	NN	 	rU   zAccessing Python attributec                 6    | j                             |          S rN   )r#  r  r   s     rT   r  z0AttributeNode.is_cimported_module_without_shadow  s    x::3???rU   c                     | j         r-|                                 p| j                                         S t                              |           S rN   )r#  r  r;  r  rX   s    rT   r;  zAttributeNode.is_simple
  sE    8 	,&&((@DH,>,>,@,@@%%d+++rU   c                 H    | j         rdS t                              |           S ry  )r#  r  r   rX   s    rT   r   zAttributeNode.is_lvalue  s%    8 	,4%%d+++rU   c                 v    | j         r| j                                         S t                              |           S rN   )r#  r   r  rX   s    rT   r   zAttributeNode.is_ephemeral  s4    8 	/8((***((...rU   c                 l    |                                  }| j        r| j        j        r| j        sd|z  }|S rR  )calculate_access_coder   r  r_  )rY   r  s     rT   r  z#AttributeNode.calculate_result_code  sA    ++--: 	&$*4 	&T^ 	&v%FrU   c                    | j         }|                    |j                  }| j        r| j        j        r|j        j        rn| j        j        sb| j        j        r| j        j        S | j        j        r| j        j	        | _
        d|j        j        d|| j        |j        j        d| j
        S | j        r| j
        S d S |j        j        r d| j
                                        d|dS |j        j        rA| j        r:| j        j        r.|j                            |                                d          }|| j        | j
        S )	Nz	((struct z *))->__Pyx_Cr
  r`  T)to_object_struct)r#  r  r   r   rh  r{  is_builtin_cmethodfinal_func_cname
from_fusedr   rO  vtabstruct_cnamern  vtabslot_cnamer  r  upperr|  r  r  r  )rY   r#  obj_codes      rT   r  z#AttributeNode.calculate_access_code"  sh    h==**: 	?$*/ 	?x) #$*2O #:. 7:669' 3
 #'*"2DK H---xxH+++T[[: : $ #{"
 FX  	? 	?&*k&7&7&9&9&9&9888DDx' UDJ U4:;Q U8--cjjllt-TT'x$++>>rU   c                    | j         r| j        r0|j                            t	          j        dd                     d}n/|j                            t	          j        dd                     d}|                    |                                 d|d| j        	                                d|
                    | j                  d	|                    |                                 | j                  	           |                     |           d S | j        j        rB| j        r| j        j        D ]#\  }}|d
k    rt'          | j        d            d S $|                    |                                 d| j                                        d           |                    |                                 | j        d           d|                                 z  }|                    |                    || j                             d S | j        rH|                    d|                                 d|                    | j                  d           d S d S | j        j        r~| j        rw| j        r|                                 }n| j        rJ |                                 }| j                            |          }|                    | j        | j        |           d S | j        j        r| j        j        j        rd S | j        r-| j        j         r#|j        !                    | j                   d S d S d S )NPyObjectLookupSpecialr  __Pyx_PyObject_LookupSpecialPyObjectGetAttrStr__Pyx_PyObject_GetAttrStrr  r
  r  rc  rp  z=Transposing not supported for slices with indirect dimensionsr  Tr  z__pyx_memslice_transpose(&%s)zif (unlikely(!zR.memview)) {PyErr_SetString(PyExc_AttributeError,"Memoryview is not initialized");r   r  )"rm  is_special_lookupr   r   r	   r   r   r  r#  r   r  r$  r   r   r  r   r   ru  r  r   r  r  r  r   r   r  r_  r   r  r  r  r{  rh  r  )rY   r   lookup_func_namer  r  rp  undereferenced_resultr  s           rT   r  z"AttributeNode.generate_result_codeF  s   ? 6	D% ? 11+,CEWXXZ Z Z#A   11+,@BTUUW W W#> JJKKMMMM$$$H&&((((**4>::::++DKKMM48DDDFG G G   &&&&&Y) %	D) F'+y~  OFGdh )C D D D '
 

8I8I8I8IJKKK//ty)- 0 / / / 4dkkmmC

411!TX>>?????' F



  ;;====$//$(*C*C*C*C	EF F F F FF F Z' 	DD,B 	D~ E(,%%<'''(,(B(B(D(D%!%!K!KLa!b!b%%dh
Oa%bbbbb x} D!@ D D
 5 D 77
CCCCCD D D DrU   c                     | j         rD| j        j        r8| j        r1|                    |                                 | j        d           d S t                              | |           d S )NTr  )r   r   r   ru  r0  r  r   r  r  s     rT   r  z$AttributeNode.generate_disposal_code  si    < 	8DI8 	8T=W 	8""4;;==$)d"KKKKK++D$77777rU   c                 ^   | j                             |           | j        r|j                            t          j        dd                     |                    | j        d| j         	                                d|
                    | j                  d|	                                d           |                    |           |                    |           n| j         j        j        r|                    d| j                                        | j         j        j        d| j                             | j         j                  d|                    |                                           d           |                    |           |                    |           nM|                                 }| j        j        ru| j        rn|                    |           |                    |           |                    || j                   |                    ||                                            nB| j        j        r6d	d
lm} |                     |||                                | j        |           | j        j        s@|                    |d|!                    |                                           d           |"                    |           |                    |           | j                             |           | j                             |           d S )Nr,  r  z__Pyx_PyObject_SetAttrStr(r  r`  __Pyx_SET_Cr
  r  r(   r  r  r  )#r#  r  rm  r   r   r	   r   r<  r   r   r  r$  r  r  r   r  r   rO  r  implementation_suffixr  r   r  rq   r  r  r  r  
put_decrefr   r  r  put_assign_to_memviewslicer  r  )rY   r   r   r  r   r   select_coder  s           rT   r  z&AttributeNode.generate_assignment_code  s   ))$///? %	!--'(<>PQQS S S!!$((H&&((((**4>::::MMOOOO%& & &
 &&t,,,NN4    X]% 	!JJJ!!###333""48=1111djjll++++	- . . .
 &&t,,,NN4    ++--Ky$ I)= I((...$$T***TY777TZZ\\::::- I((((((55#S#**,,	4I I I 9/ ?

#..tzz||<<<<>? ? ?
 --d333NN4   ''---D!!!!!rU   c           	          | j                             |           | j        s$| j        j        j        rd| j        j        j        v r|j                            t          j
        dd                     |                    | j        d| j                                         d|                    | j                  d           nt!          | j        d           | j                             |           | j                             |           d S )N__del__r,  r  r-  r  r`  z+Cannot delete C attribute of extension type)r#  r  rm  r   r,  is_property_scoperu  r   r   r	   r   r<  r   r   r  r$  r   r  r  r  s      rT   r  z$AttributeNode.generate_deletion_code  s   ))$///? 		Ktz/A 		K#-1A1I#I#I--'(<>PQQS S S!!$((H&&((((**4>::::<= = = =
 $(IJJJ''---D!!!!!rU   c           
          | j         rd\  }}nd\  }}|                    | j        t          ||| j        z  t          | j                                       d S )N)py_attrzpython attribute (%s))c_attrzc attribute (%s)r7  )rm  r  r   r6   r   r   r$  )rY   r   r9  r:  s       rT   r  zAttributeNode.annotate  s^    ? 	7<KE446KE4dhudTY6FSQUQ_M`M` a a abbbbbrU   c                 x    | j                                         }|rt          j        |d| j                  S d S )Nr   )r#  rO  r   r0  r$  )rY   rD  s     rT   rO  z/AttributeNode.get_known_standard_library_import  sA    h@@BB 	Y!/;;;0WXXXtrU   rQ  rN   rw  rR  rP  )-r[   r\   r]   rZ  r   r   r4  r}  ru  r  rm  rA  r  r(  r2  rO  r   r8  rD  r<  rO  rP  r\  re  rm  rb  rX  rU  rQ  r?  rV  rs  re  r  r;  r   r   r  r  r  r  r  r  r  rO  rW   rU   rT   r/  r/  ^  sy        LwHEI!J	 	 	(7 (7 (7TG G G
- 
- 
-/ / /  2          $! ! !F  4  	 	 	  	 	 	  0DG DG DG DGL2 2 2 2:K K K0   /K@ @ @, , ,, , ,/ / /  "? "? "?H7D 7D 7Dr8 8 8 INGK*" *" *" *"X" " " "c c c    rU   r/  c                   T    e Zd ZdgZdZeZdZdZd Z	d Z
d Zd Zd Zd	 Zd
 Zd ZdS )StarredUnpackingNoderM  r(   Fc                 @    t                               | ||           d S )NrL  r  )rY   r   rM  s      rT   r  zStarredUnpackingNode.__init__  s#    $F33333rU   c                 r    | j         st          | j        d           | j                            |           d S Nz&starred expression is not allowed here)starred_expr_allowed_herer   r   rM  rg  r   s     rT   rg  z)StarredUnpackingNode.analyse_declarations  s=    - 	F$(DEEE((-----rU   c                 6    | j                             |          S rN   )rM  r   r   s     rT   r   zStarredUnpackingNode.infer_type  s    {%%c***rU   c                     | j         st          | j        d           | j                            |          | _        | j        j        | _        | S r  )r  r   r   rM  r<  r   r   s     rT   r<  z"StarredUnpackingNode.analyse_types  sI    - 	F$(DEEEk//44K$	rU   c                 :    | j                             |           d S rN   )rM  r8  r   s     rT   r8  z/StarredUnpackingNode.analyse_target_declaration  s    ..s33333rU   c                 f    | j                             |          | _         | j         j        | _        | S rN   )rM  rD  r   r   s     rT   rD  z)StarredUnpackingNode.analyse_target_types  s*    k66s;;K$	rU   c                     dS Nr  rW   rX   s    rT   r  z*StarredUnpackingNode.calculate_result_code  r$  rU   c                     d S rN   rW   r  s     rT   r  z)StarredUnpackingNode.generate_result_code  r   rU   N)r[   r\   r]   r   r`  r   r   r   r  r  rg  r   r<  r8  rD  r  r  rW   rU   rT   r  r    s         zHJDG %4 4 4. . .
+ + +  4 4 4  
      rU   r  c            
           e Zd ZddgZdZdZdZdZd Zd Z	d Z
dd	Zd
 Zd Zd Zd Zd Zd ZddZ fdZ	 	 ddZ ej         ej        ej         ej        dej        d          g                    Zd Zd ZddZd Zd Z xZ S )SequenceNoder   r   r(   NFc                 *    fd| j         D             S )Nc                 :    g | ]}|                               S rW   rX  rY  s     rT   r   z8SequenceNode.compile_time_value_list.<locals>.<listcomp>  rZ  rU   rL  r0  s    `rT   compile_time_value_listz$SequenceNode.compile_time_value_list  s    BBBB	BBBBrU   c                     d| _         g }| j        D ]O}|j        r1| j         rt          |j        d           d| _         |j        }d|_        |                    |           P|| _        d S )NFz,more than 1 starred expression in assignmentT)starred_assignmentr   r`  r   r   rM  r  rY   r   r>  s      rT   replace_starred_target_nodez(SequenceNode.replace_starred_target_node  s    "'9 	 	C~ &* S#'#QRRR*.'j!%KK			rU   c                 l    |                                   | j        D ]}|                    |           d S rN   )r  r   r8  rY   rs   r>  s      rT   r8  z'SequenceNode.analyse_target_declaration)  sF    ((***9 	0 	0C**3////	0 	0rU   c                 h   t          | j                  D ]9\  }}|s|                    |          }|                    |          | j        |<   :| j        rU| j                            |          }|j        j        s|                    |          }|                    |          | _        d| _        | S rl  )	rL  r   r<  r   r   r   r  rK  r   )rY   rs   skip_childrenrT  r>  r   s         rT   r<  zSequenceNode.analyse_types.  s    	** 	7 	7FAs  -'',,11#66DIaLL 	A*88==K#* B)<<SAA*;;C@@DrU   c                 H   | j         |k    r| S | j        rJ t          | j                  |j        k    r1t          | j        d|j        t          | j                  fz             fdt          | j        |j                  D             }t          | j        ||d          S )NzHtrying to coerce sequence to ctuple of wrong length, expected %d, got %dc                 B    g | ]\  }}|                     |          S rW   )r  )rc   r>  r   rs   s      rT   r   z1SequenceNode.coerce_to_ctuple.<locals>.<listcomp>C  s+    fffYS$dC00fffrU   T)r   r   r   )
r   r   r   r   r8  r   r   r}  r2  rO  rY   r	  rs   coerced_argss     ` rT   coerce_to_ctuplezSequenceNode.coerce_to_ctuple<  s    9  K####ty>>X]**$(fs49~~j/ / 0 0 0ffff#diQYQdBeBefff8TRRRRrU   c           	         |                                   t          d | j        D                       s| S g }g }| j        D ]}|j        rc|rF|                    t          |d         j        |                              |d                     g }|                    |j                   l|                    |           |rD|                    t          |d         j        |                              |d                     t          | j        || j
                  }| j        r8t          | j        d|| j                            |          d| j
        d          }|S )Nc              3   $   K   | ]}|j         V  d S rN   )r`  rs  s     rT   rf   z?SequenceNode._create_merge_node_if_necessary.<locals>.<genexpr>H  s$      77c3>777777rU   r   rL  Tr  r   )inplacer   r   )_flatten_starred_argsrl   r   r`  r  rO  r   r<  rM  MergedSequenceNoder   r   
binop_noder   )rY   rs   r   r?  r>  r   s         rT   _create_merge_node_if_necessaryz,SequenceNode._create_merge_node_if_necessaryF  st   ""$$$77TY77777 	K9 	# 	#C~ #  KK	&)-f E E E S STWgk S l lmmmFCJ''''c"""" 	fKK	&)-f===KKC_cKddeee!$(D$)<< 	<#tT%5%H%H%M%M49d< < <D rU   c                     g }| j         D ]V}|j        r8|j        j        r,|j        j        s |                    |j        j                    A|                    |           W|| j         d d <   d S rN   )r   r`  rM  r   r   r  r  r  s      rT   r  z"SequenceNode._flatten_starred_args^  s{    9 	! 	!C~ !#*"D !SZMc !CJO,,,,C    	!!!rU   c                     dS rw  rW   rX   s    rT   r?  zSequenceNode.may_be_noneg  rn  rU   c                 z   | j         rt          | j        d           g | _        g | _        d| _        t          | j                  D ]\  }}|                    |          x}| j        |<   |j	        rN|j
                            t                    st          |j        d           |j
        t          u rt          |_
        t          | j        |          }|                    |j
        |          }||urd| _        | j                            |           | j                            |           t          | _
        | S )Nz#can't assign to multiplied sequenceFz2starred target must have Python object (list) typeT)r   r   r   unpacked_itemscoerced_unpacked_itemsany_coerced_itemsrL  r   rD  r`  r   r  r   r   r0  r  r  )rY   rs   rT  r>  unpacked_itemcoerced_unpacked_items         rT   rD  z!SequenceNode.analyse_target_typesj  sD    	C$(ABBB &(#!&	** 	F 	FFAs!$!9!9#!>!>>C$)A,~ )x//	:: P#'NP P P8~--(CH&tx55M$1$;$;CHc$J$J!$999)-&&&}555'../DEEEE"	rU   c                 0    |                      |           d S rN   generate_operation_coder  s     rT   r  z!SequenceNode.generate_result_code      $$T*****rU   c                 &	   ||                                  }dx}}d }| j        ru|ss| j        }|j        j        r`|                                 }t	          |j        t                    r|j        dk    rd|j        z  }n|j        j        r
d|d|d}nd|d}| j        t          u r| j	        s| j
        r|s|                    d|t          | j                  d	                    d
 | j        D                       |                    || j                  fz             |                    |t$                     nh| j        j        rLt)          | j                  D ]5\  }}|                    |d|d|                                 d           6n| j        t*          u rd\  }	}
n+| j        t          u rd\  }	}
nt-          d| j        z            t          | j                  }|                    |d|	d||d|                    || j                             |                    |t$                     |rWt.          j        }|                    d|z             |dk    r|}n|d|}|                    d|d|d|d|d	           nd}t3          |          D ]}| j        |         }|s|                                s:|                    |                                 |                                           |                    |           |                    d|
d|d	|r	|r|d|p|p|d	|                                d|                    | j                  d           |r*|                    d           |                    d           ||j        j         r|                    dt.          j        d |d	|                                d|                    t.          j        | j                             |                    t.          j        t$                     |!                    |t$                     |                    |dt.          j        d           |                    d           d S d S d S )!Nr  r   z * %sz * ((z<0) ? 0:r`  z * (z%s = PyTuple_Pack(%d, %s); %sr  c              3   >   K   | ]}|                                 V  d S rN   r  rs  s     rT   rf   z>SequenceNode.generate_sequence_packing_code.<locals>.<genexpr>  s*      ??c#--//??????rU   r  r  r  )
PyList_New__Pyx_PyList_SET_ITEM)PyTuple_New__Pyx_PyTuple_SET_ITEMz'sequence packing for unexpected type %sr
  rc  z{ Py_ssize_t %s;r(   z * zfor (z=0; z < rW  z++) {r  r  )) r   z{ PyObject* z = PyNumber_InPlaceMultiply()"r  r   r   r  r   r   r&   r  r   r   slowr   r   r   r  r   r   r  r   r1  rL  r   r   r   r  r  r  r  r   r  r   r   rq   r  )rY   r   rM  plainsize_factorc_multr   rT  r>  create_funcset_item_func	arg_countcounteroffsets                 rT   generate_sequence_packing_codez+SequenceNode.generate_sequence_packing_code  s   >[[]]F!!f 
	8E 
	8*K& 8$++--{:MJJ 8#3a77")K,G"GKK %, 8 8:@&&&&&"IKK8 06vv"7K9
"""49"f"JJ6DI		??TY?????''99	:; ; < < <
 OOFN3333Y  3	 #DI.. . .3

FFAAAszz||||- . . . ..
 yI%%-R*]]j((-T*]]#$MPTPY$YZZZDIIJJYY''999; < < < OOFN333  !1

-7888>>$FF*1''99=F


GGWWWfffggg     9%% 
0 
0il ?!3!3!5!5 ?OOCJJLL#))++>>>$$T***


!MMFF\@VVVQQ(?QV[qQQMMOOOOOODH----/ 0 0 0 0   

3

3"{'7'C"JJJ'''1F1F1H1H1H1H''(?JJJ    OOF3^DDDOOFN333JJVVVV-D-D-DEFFFJJsOOOOO #"""rU   c                    | j         r;| j         j        j        r*t          t          |                               |           d S | j        t          u r8| j        s| j        r*t          t          |                               |           d S | j	        D ]}|
                    |           | j         r| j                             |           d S d S rN   )r   r   r  rP   r  r  r   r   r  r   r  r  )rY   r   r>  rS   s      rT   r  z+SequenceNode.generate_subexpr_disposal_code  s     	> 0 5 < 	>,%%DDTJJJJJY*$$$/$TY$,%%DDTJJJJJ
 y 8 811$7777  > 77=====> >rU   c                     | j         r|                     ||           n|                     ||           | j        D ]}|                    |           |                    |           d S rN   )r   generate_starred_assignment_code!generate_parallel_assignment_coder  r+  r  )rY   r   r   r  r   r   r   s          rT   r  z%SequenceNode.generate_assignment_code  s{    " 	>11#t<<<<223===' 	 	DLLtrU   r  c                 x   | j         D ]}|                    |           |j        t          u p!|j        t          t
          fv p|j        j         }t          | j                   dk    }|r|                     |||           nH|	                    d           | 
                    ||| j         |           |	                    d           | j        D ]}|                    |           t          t          | j                            D ].}| j        |                             | j        |         |           /d S )NrJ   use_loopr  r   )r  r)  r   r   r   r   r|  r   (generate_special_parallel_unpacking_coder   (generate_generic_parallel_unpacking_coder  r  r  r   r  )rY   r   r   r   special_unpacklong_enough_for_a_loop
value_noderT  s           rT   r  z.SequenceNode.generate_parallel_assignment_code  sw    ' 	  	 DMM$(n4 : X*i)@@:!$!99 	 "%T%8!9!9A!= 	99c$: : < < < < JJsOOO99c4.9O : Q Q QJJsOOO5 	6 	6J//5555s49~~&& 	6 	6AIaL11+A.6 6 6 6	6 	6rU   c           
         d}d|                                 z  }|j        t          u rdg}|                                r|}nc|j        t          u rdg}|                                r|}n;ddg}d|                                 z  }d|                                 z  }d|d|d	}|                    d
|z             |                    d|                                 z             |                    d           |                    dt          | j                  z             |j        	                    t          j        dd                     |                    dt          | j                  t          | j                  fz             |j        	                    t          j        dd                     |                    d           |                    |                    | j                             |                    d           |                    d           t          |          dk    r|                    d|d         z             t          | j                  D ]8\  }	}
|                    d|
                                |d         |	fz             9t          |          dk    rw|                    d           t          | j                  D ]8\  }	}
|                    d|
                                |d         |	fz             9|                    d           | j        D ]<}
|                    |
                                |
                                           =|                    d           |st          | j                  D ]\  }	}
|                    d|
                                |	|                    |
                                | j                  fz             |                    |
                                |
j                   n/|                    d           |                    d           |                    dt          | j                  d d!                    d" | j        D                       d#           |                    d$t          | j                  z             |                    d%|                    d&| j                  z             |                    d&t,                     |                    d'           |                    d           |                    d           |                    d(           |                    |           |dk    r|                    d           d S ||k    r|                    d           |j        	                    t          j        d)d                     |                    d*|                    | j                  z             |                    d           d S |                    d           |                     ||| j        |+           |                    d           d S ),N1zlikely(%s != Py_None)r  r  zlikely(PyTuple_CheckExact(%s))zPyList_CheckExact(%s)r
  z) || (r`  r  zPyObject* sequence = %s;z2Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);zif (unlikely(size != %d)) {RaiseTooManyValuesToUnpackr  z1if (size > %d) __Pyx_RaiseTooManyValuesError(%d);RaiseNeedMoreValuesToUnpackz9else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);r   r  r5   z(if (likely(Py%s_CheckExact(sequence))) {r   z"%s = Py%s_GET_ITEM(sequence, %d); r  r(   r  z&%s = PySequence_ITEM(sequence, %d); %sr  zPy_ssize_t i;PyObject** temps[] = {r  c                 <    g | ]}d |                                 z  S r  r  rq  s     rT   r   zISequenceNode.generate_special_parallel_unpacking_code.<locals>.<listcomp>V   s%    PPPD%$++--/PPPrU   r  zfor (i=0; i < %s; i++) {z1PyObject* item = PySequence_ITEM(sequence, i); %sr   z*(temps[i]) = item;r  RaiseNoneIterErrorz%__Pyx_RaiseNoneNotIterableError(); %sr  )r   r   r   r?  r   r   r   r   r   r   r	   r   r   r   rL  r  r  r  r   r   r  r  r   r  r  )rY   r   r   r  sequence_type_test
none_checkr4   tuple_check
list_checkrT  r   s              rT   r  z5SequenceNode.generate_special_parallel_unpacking_code   sQ    ,s}}>
8y  $XN   0%/"X##%YN   0%/"%v.N:S]]__LK1CMMOOCJJ3>;;


!K

;!33444

-?@@@ 	

GHHH

03ty>>ABBB))#$@BTUU	W 	W 	W

F	NNC	NNJ, , 	- 	- 	-))#$ACUVV	X 	X 	X

NOOO

4??48,,---

3

QRRR~!##JJANSTDUUVVV !455 	6 	6GAtJJ;~a0!?5 5 6 6 6 6~!##JJz"""$T%899 : :4

?KKMM>!#4aC9 9 : : : :JJsOOO' 	9 	9DOODKKMM4::<<8888

7 	$T%899 : :4

CKKMM1++DKKMM48DDGF F G G G ty9999	: JJsOOOJJ'''JJJD'((((PPD<OPPPQQQQS T T T JJ1C8K4L4LLMMMJJJ''99; < < <OOFN333JJ,---JJsOOOJJsOOO

8""4((($$JJsOOOOO:--JJz"""--'(<>PQQS S SJJ>QUQYAZAZZ[[[JJsOOOOOJJz"""99c4. : C C CJJsOOOOOrU   Tc           
         |j                             t          j        dd                     |j                             t          j        dd                     |                    d           |rK|                    dt          | j                  dd                    d |D                       d	           |j        	                    t          d
          }|                    |d|                                d|                    || j                             |                    |t                     |                    |           |j        	                    | j        d          }|                    |d|d           |                    d          }|d|d}	|r|                    dt          |          z             |                    d|	z             |                    |           |                    dt                     |                    d           |                    d           nt)          |          D ]o\  }
}|                    d|
|                                |	|                                fz             |                    |           |                    |           p|r|j                             t          j        dd                     |                    | j        d|	t          |          fz             |                    d|z             |                    |t                     |                    d          }|                    |           |                    |           |                    |t                     |                    d|z             |                    d           |                    |                    | j                             |                    |           |j                            |           |r|j                            |           d }|S )Nr  r  
IterFinishzPy_ssize_t index = -1;r  r  r  c                 <    g | ]}d |                                 z  S r  r  rq  s     rT   r   zISequenceNode.generate_generic_parallel_unpacking_code.<locals>.<listcomp>{   s%    KKKD%$++--/KKKrU   r  Tr  r  rc  Fr  r  unpacking_failedr
  r`  z$for (index=0; index < %s; index++) {z*PyObject* item = %s; if (unlikely(!item)) r   z*(temps[index]) = item;r   z(index = %d; %s = %s; if (unlikely(!%s)) UnpackItemEndCheckz$__Pyx_IternextUnpackEndCheck(%s, %d)r  unpacking_donezCif (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);)r   r   r	   r   r   r   r  r  r  r  r   r   r   r   r  r  r  rz  r  r{  rL  r  r  r<  r  r  r   r  )rY   r   r   r  r  	terminateiterator_tempiternext_funcunpacking_error_labelunpack_coderT  r   unpacking_done_labels                rT   r  z5SequenceNode.generate_generic_parallel_unpacking_codeq   st   ))#$ACUVV	X 	X 	X))#L2DEE	G 	G 	G

+,,, 	OJJJD'((((KKNKKKLLLLN O O O 44^PT4UU

''tx@@@B	C 	C 	C
 	~666""4(((44T5MZ_4``

MM===* 	+ 	+ 	+ !%/A B B"/--? 	+JJ=N@S@SSTTTHHAKOPPPMM/000OOFN333JJ0111JJsOOOO$^44 + +4>#	B' '( ( ( 3444$$T**** 	A--'(<>PQQS S S!!$(,RN##V% -% & & & JJ|m3444!!-@@@#~~.>??*+++,---m^<<<

<-/000

XYYY

4??48,,---+,,,##M222 	!N''666 MrU   c                 *   t          | j                  D ]<\  }}|j        r0| j        |         }| j        d |         }| j        |dz   d          } n=J d }|r|D ]}	|	                    |           |                    d           |                     |||dd          }t          |          D ]'\  }}	| j        |         }
|
                    |           (|                    d           |                    |           |	                                }|                    |d|s|j
        r|j        t          t          fv rdnd	d
|p|                                d|                    || j                             |                    |           |r6|                    |t                     |j                            |           n|                    |           |rp|j                            t1          j        dd                     |j                            t6          j        d          }|                    |d|d           |                    d|t;          |          fz             |                    dt;          |          ||                    | j                  fz             |                    d           |d d d         D ]}	|	                    |           t          t?          |d d d         | j        d d d                             D ]\  }\  }	}|                    d           |                    d|	                                |||dz   fz             |                    d|z             |                    d           |                    d|	                                |||dz   fz             |                    d           |	                    |           |                    |           |                    d           |j                            t          d          }|                    d|||t;          |          |                    || j                  fz             |                     |t                     |j                            |           |!                    |t                     |                    |d|d|d           |                    d           |                    d|z             |j                            |           |                    d           t          | j                  D ]&\  }}|"                    | j        |         |           'd S )Nr(   Fr  T)r  r
	  r   r  __Pyx_PySequence_ListKeepNewPySequence_Listr
  rc  r  r  r  z = PyList_GET_SIZE(r  zif (unlikely(%s < %d)) {z)__Pyx_RaiseNeedMoreValuesError(%d+%s); %srI  z#if CYTHON_COMPILING_IN_CPYTHONz!%s = PyList_GET_ITEM(%s, %s-%d); z((PyVarObject*)%s)->ob_size--;r  z!%s = PySequence_ITEM(%s, %s-%d); r  z #if !CYTHON_COMPILING_IN_CPYTHONz*%s = PySequence_GetSlice(%s, 0, %s-%d); %srW  z = NULL;zCYTHON_UNUSED_VAR(%s);)#rL  r   r`  r  r)  r   r  r  r  r  r   r   r   r   r   r   r   r  r  r  r  r  r   r   r	   r   r  r   r^  r   r   r}  r  r  r  )rY   r   r   rT  r>  starred_targetunpacked_fixed_items_leftunpacked_fixed_items_rightr	  r   r  target_listlength_tempcoerced_argsublist_temps                  rT   r  z-SequenceNode.generate_starred_assignment_code   s/   	** 	 	FAs~ !%!4Q!7-1-@!-D)-1-@1-F*	 L$ 
	1 $ $d####JJsOOO IIc4 J 0 0M %%>?? : :4!8;
33D9999JJsOOO%%%$++--

KK%'*-+':=(~W`Fa:a:a +*&' ' ,S]]__,,##K:::< 	= 	= 	= 	&&t,,, 	-!!-@@@N''6666&&t,,,% '	!--'(EGYZZ\ \ \.66z7S`e6ffKJJkkk;;;OPPPJJ1[#F`BaBa4bbcccJJB.//**F, , - - - JJsOOO244R48 $ $d####*3C8RSWSWUWSW8X8<8STXTXVXTX8Y5[ 5[ +\ +\ ; ;&&D+

<===

>NN$$k;!BE E F F F 

;kIJJJ

7###

>NN$$k;!BE E F F F

8$$$$$T***44T::::JJ9:::>77SW7XXLJJCk;<V8W8W''dh??GA A B B B OOL.999N''444OOK888JJ\\\<<<XYYYJJwJJ/,>???N''555JJx   	** 	O 	OFAs(()DQ)GNNNN	O 	OrU   c                     | j         D ]}|                    |           | j        r>| j        D ]}|                    |           | j        D ]}|                    |           d S d S rN   )r   r  r  r  rY   r   r>  s      rT   r  zSequenceNode.annotate!  s    9 	 	CLL 	#* # #T""""2 # #T""""		# 	## #rU   rP  rw  rR  r>  )!r[   r\   r]   r   r   r  r   r  r  r  r8  r<  r  r  r  r?  rD  r  r  r  r  r   r~  r  r   r  r  r  r  r  r  r  r^   r_   s   @rT   r  r    s        &HNKDC C C  0 0 0
   S S S  0      .+ + +W W W Wr> > > > >  INGK	 	 	 	 .*-.Bj.B!#J#D**CTJJ$/ /  
6 6 64X X XtE E E ENRO RO ROh# # # # # # #rU   r  c                   ^    e Zd ZeZdZdZd ZddZd Z	d Z
d Zd Zd	 Zd
 Zd Zd Zd ZdS )rO  Fr  c                     | j         s| j        st          S fd| j        D             }t          d |D                       rt          S                     | j        |          j        S )Nc                 :    g | ]}|                               S rW   r   r6  s     rT   r   z(TupleNode.infer_type.<locals>.<listcomp>!!  s%    >>>SS^^C((>>>rU   c              3   N   K   | ] }|j         p|j        p|j        p|j        V  !d S rN   )rq   r   rx  rg  )rc   r   s     rT   rf   z'TupleNode.infer_type.<locals>.<genexpr>"!  sR       & & b4#:bd>QbUYUb & & & & & &rU   )r   r   r   rl   declare_tuple_typer   r   )rY   rs   r<  s    ` rT   r   zTupleNode.infer_type!  s     	49 	>>>>DI>>>	 & &$& & & & & 	%%dh	::??rU   c                    | j         rd| _         | j        rd| _        t          | j                  dk    rd| _        d| _         | S |sEt          | j                  D ]0\  }}|j        rd|_        |                    |          | j        |<   1| j	        s[t          d | j        D                       s=|                    | j        d | j        D                       j        | _        d| _        | S t                              | |d          }|                    |          }|j        s|S t#          d |j        D                       s|S |j	        r+|j	        j         r.t%          |j	        j        t(                    rd|_        d|_         nO|j	        j        j        s0|j	        j        j        s|j	                            |          |_	        d|_        d|_        |S )	NFr   Tc              3   l   K   | ]/}|j         p#|j        j        p|j        j        p|j        j        V  0d S rN   )r`  r   rq   r   rg  rs  s     rT   rf   z*TupleNode.analyse_types.<locals>.<genexpr>9!  sX       . . s38+?s38C^sbebjbs . . . . . .rU   c              3   $   K   | ]}|j         V  d S rN   r  rs  s     rT   rf   z*TupleNode.analyse_types.<locals>.<genexpr>;!  s$      9X9Xs#(9X9X9X9X9X9XrU   r(   r  c              3   $   K   | ]}|j         V  d S rN   )r   )rc   childs     rT   rf   z*TupleNode.analyse_types.<locals>.<genexpr>D!  s%      ;;5#;;;;;;rU   )r   is_partly_literalr   r   r   rL  r`  r  r<  r   rl   r 	  r   r   r  r  r   r  r   r   r&   rq   r  r   )rY   rs   r  rT  r>  r   s         rT   r<  zTupleNode.analyse_types'!  s
   ? 	$#DO! 	+%*D"ty>>Q DL"DOK 	6#DI.. 6 63> 948C1"0055	!  	 . .#'9. . . . .	 ..tx9X9Xdi9X9X9XYY^DIDLK))$4)HH33C88+ 	K;;;;;;; 	K 		* +		*4+;]KK		* !DL"DOO#(4 LT=M=R=Y L#'#3#F#Fs#K#K DL%)D"rU   c                     | j         sd S fd| j         D             }t          d |D                       rd S                     | j        |          }|j        S )Nc                 :    g | ]}|                               S rW   )re  r6  s     rT   r   z-TupleNode.analyse_as_type.<locals>.<listcomp>V!  s'    DDD3c))#..DDDrU   c              3      K   | ]}|d u V  	d S rN   rW   )rc   rd   s     rT   rf   z,TupleNode.analyse_as_type.<locals>.<genexpr>W!  s&      --QqDy------rU   )r   rl   r 	  r   r   )rY   rs   r   r   s    `  rT   re  zTupleNode.analyse_as_typeR!  sp    y 	4DDDD$)DDD
--*----- 	4&&tx<<zrU   c                    | j         j        r|j        r+| j         j        |j        k    r|                     |          S |t          u s	|t
          u rKfd| j        D             }t          | j        |t          | j	        d          
                    d          S |                                                   |          S |j        r| j	        s|                     |          S t                              | |          S )Nc                 :    g | ]}|                               S rW   )r   r6  s     rT   r   z'TupleNode.coerce_to.<locals>.<listcomp>a!  s'    QQQ 6 6s ; ;QQQrU   r(   )r   r   r   r   Tr  )r   r1  r8  r  r   r   r   rO  r   r   r<  r   r  r  r  s     ` rT   r  zTupleNode.coerce_to\!  s   9 	?! Mdin&E&E,,Xs;;;Z''8~+E+EQQQQtyQQQ H%# $ 0    -4-889 ..s33==hLLL 	?(8 	?((3777))$#>>>rU   c                     t          | j        | j        | j                  }t	          | j        t                    rt          | j                  |_        |S N)r   r   )r  r   r   r   r   r   r   r  rY   rd   s     rT   as_listzTupleNode.as_listp!  sJ    TXDI4;KLLLd*E22 	; $T%9 : :ArU   c                     dS ry  rW   rX   s    rT   r;  zTupleNode.is_simplev!      trU   c                     dS ry  rW   rX   s    rT   rV  zTupleNode.nonlocally_immutablez!  r1	  rU   c                 X    t          | j                  dk    r| j        S t          j        S r   )r   r   r  r   empty_tuplerX   s    rT   r  zTupleNode.calculate_result_code~!  s'    ty>>A##%%rU   c                 L    t          d | j        D                       | _        d S )Nc                     g | ]	}|j         
S rW   r  rs  s     rT   r   z7TupleNode.calculate_constant_result.<locals>.<listcomp>!  s(     &: &: &:(+#&: &: &:rU   )r   r   r   rX   s    rT   r(  z#TupleNode.calculate_constant_result!  s8    $ &: &:/3y&: &: &:  ;  ;rU   c                     |                      |          }	 t          |          S # t          $ r }|                     |           Y d }~d S d }~ww xY wrN   )r  r   r  r6  rY   r1  r?  r5  s       rT   r2  zTupleNode.compile_time_value!  sk    --d33	-==  	- 	- 	-))!,,,,,,,,,	-s   & 
AAAc                    t          | j                  dk    rd S | j        s| j        rt	          | j        | j        r| j        nd g| j        z             }|                    t          dd|          }|	                    |          }|S|
                    | j                   |                     ||| j                    |                    |t                     | j        r	|| _        d S | j        j        j        r|j                            t%          j        dd                     |                    |                                 d|d	| j                                        d
|                    |                                 | j                             |                     |           d S |                    |                                 d|d	| j                                        d
|                    |                                 | j                             |                     |           d S d| j        j        _        |                     |           d S )Nr   r   r5   r(  )r  PySequenceMultiplyr  z = __Pyx_PySequence_Multiply(r  rc  z = PyNumber_Multiply(T)r   r   r   r&	  r   r   r   r8  r   r;  r  r   r  r  r  r  r   r   r	   r   r   r  r   r  r   r   r  )rY   r   r*  tuple_targetr?  s        rT   r  z!TupleNode.generate_operation_code!  sg   ty>>QF? 	6d4 	6 'tyt3`43C3C\`2adhdm2mnnI,,^WTUaj,kkL99,GGJ%##DH---33JX\XgTg3hhh&&|^DDD +#/   !&- + 11+,@BTUUW W W

KKMMMM<<<1A1H1H1J1J1J1J++DKKMM48DDD    $$T*****

KKMMMM<<<1A1K1K1M1M1M1M++DKKMM48DDD    $$T*****#'DIO //55555rU   NrP  )r[   r\   r]   r   r   r&	  re  r   r<  re  r  r/	  r;  rV  r  r(  r2  r  rW   rU   rT   rO  rO  !  s         D-K@ @ @) ) ) )V  ? ? ?(      & & &; ; ;- - -"6 "6 "6 "6 "6rU   rO  c                   `    e Zd Zg Z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dS )r  FzConstructing Python listc                     dS rw  rW   r   s     rT   rO  zListNode.type_dependencies!  r$  rU   c                     t           S rN   )r   r   s     rT   r   zListNode.infer_type!      rU   c                     | j         D ]}|j        rd|_        t                              | |          }|                    |          S ry  )r   r`  r  r  rB  r   )rY   rs   r>  r   s       rT   rB  zListNode.analyse_expressions!  sO    9 	5 	5C~ 504-//c::&&s+++rU   c                    t          d          5 }t          | j                  | _        t                              | |          }d d d            n# 1 swxY w Y   ||_        |j        rd| _        |	                    |          }|S )NTr  )
r   r  r   original_argsr  r<  obj_conversion_errorsr  r  r  )rY   rs   errorsr   s       rT   r<  zListNode.analyse_types!  s    &&& 	9&!%diD--dC88D	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 &," 	(#'D 33C88s   5AAAc                    |j         rT| j        D ]}t          |           g | _        | j                            |          st          | j        d|z             n|j        s|j        r-|j	        t          j        urt          | j                  }| j        rpt          | j        j        t"                    r9| j        j        dk    rt          | j        d|z             n(|| j        j        z  }nt          | j        d|z             |j	        }t          j        ||          | _        t'          t          | j                            D ]I}| j        |         }t          |t*                    r|j        }|                    ||          | j        |<   Jn|j        r5t3          | j        | t          j                                      ||          S | j        rt          | j        d|z             nU|j        rt          | j                  t          |j        j                  k    rt          | j        d|z             nt          | j                  t          |j        j                  k     rt=          | j        d|z  d	           t?          tA          | j        |j        j                            D ]G\  }\  }}t          |t*                    r|j        }|                    |j        |          | j        |<   H|| _        nA|j!        r| "                    ||          S tF          | _        t          | j        d|z             | S )
NzCannot coerce list to type '%s'r   z4Cannot coerce non-positively multiplied list to '%s'z1Cannot coerce dynamically multiplied list to '%s')rb  r   z%Cannot coerce multiplied list to '%s'zToo many members for '%s'zToo few members for '%s'r(   )$rq   rC	  r   r   r   r   r   rT  r  r  r   c_void_typer   r   r   r   r   r&   r  r  rB	  r  r>  r  r  TypecastNoder   r{  r,  rs  r   rL  r}  r1  r  r/   )	rY   r	  rs   rt   r
  r  rT  r>  rO  s	            rT   r  zListNode.coerce_to!  s;    +	J1 " "S!!!!)+D&9''11 Ndh AH LMMM %	J8? %	J8JR\Rh8h8hty>>L dd.>NN d'71<<dh(^ai(ijjjj$(8(HH$($WZb$bccc *I"-iFFDI3t12233 = =ilc#566 "'C"}}Y<<	!	=
 " 	J$Z=VWWWaabjloppp 	J$(ChNOOOO 	J49~~HN$> ? ???dh ;h FGGGGty>>C(B$C$CCCDH&@8&KQOOO(1#d6H(.Jd2e2e(f(f C C$A}V!#'9:: &!g#&==c#B#BDIaLL DII 	J((3777"DI$(=HIIIrU   c                     | S rN   rW   rX   s    rT   r/	  zListNode.as_list"  rp  rU   c                     t          | j        | j        | j                  }t	          | j        t                    rt          | j                  |_        |S r-	  )rO  r   r   r   r   r   r  r   r.	  s     rT   as_tuplezListNode.as_tuple
"  sJ    dhTYD<LMMMd*D11 	< %d&: ; ;ArU   c                    | j         j        rZ| j        r*|j                            | j         ddd          | _        d S |j                            | j         dd          | _        d S t                              | |           d S )NFT)r  staticreusable)r  rM	  )r   rT  r  r  r  r  r  r  r  s     rT   r  zListNode.allocate_temp_result"  s    9 	:# A!%!=!=I%u "> "N "N "&!=!=I%% "> "A "A --dD99999rU   c                 \    | j         rt                      d | j        D             | _        d S )Nc                     g | ]	}|j         
S rW   r  rs  s     rT   r   z6ListNode.calculate_constant_result.<locals>.<listcomp>!"  s(      6  6  6$'C 6  6  6rU   )r   r   r   r   rX   s    rT   r(  z"ListNode.calculate_constant_result"  s@     	,, 6  6+/9 6  6  6rU   c                 x    |                      |          }| j        r|| j                            |          z  }|S rN   )r  r   r2  )rY   r1  ls      rT   r2  zListNode.compile_time_value$"  s@    ((.. 	;!44T:::ArU   c                 \   | j         j        r0| j        D ]}t          |           |                     |           d S | j         j        r| j        r|                    d           |                    dt          j	        z             |                    d
                    t          j	        | j                                                             dt          | j                  t          j	        fz  }nd}t          | j                  D ]\  }}|j         j        r|j                            t#          j        dd                     |                    d	|                                 d
||d|                                d|                                 d
           |                    |                                 d
||d|                                d           | j        r,|                    d           |                    d           d S d S | j         j        rst)          | j        | j         j        j                  D ]L\  }}|                    |                                 d|j        d|                                d           Md S t1          d          )Nr  zPy_ssize_t %s;z&for ({i} = 0; {i} < {count}; {i}++) {{)rT  countz+ (%d * %s)r  r  rJ  r  r%  r  r6  z[0]));z] = r  r   r   r  zList type never specified)r   rq   rC	  r   r  rT  r   r   r   r  r  r  r   r   rL  r   r   r	   r   r{  r}  r,  rs  r   r   )rY   r   rt   r  rT  r>  rO  s          rT   r  z ListNode.generate_operation_code*"  s   9  $	=1 " "S!!!!//55555Y  	= 

3

+f.EEFFF

CJJ-T5E5L5L5N5N K P P Q Q Q&#di..&:Q)RR#DI.. ' '38$ '$55k6MN^`o6p6pqqqJJJqq&&&

dkkmmmm     
 JJ

	 & ' ' ' '
   

3

3    Y  	="49dio.IJJ # #V

KKMMMMLLLJJLLLL" # # # ## #   ;<<<rU   N)r[   r\   r]   rC	  r   r   r  re  rO  r   rB  r<  r  r/	  rJ	  r  r(  r2  r  rW   rU   rT   r  r  !  s         DO,K    , , ,  - - -^    : : :6 6 6  %= %= %= %= %=rU   r  c                   R    e Zd ZdgZdZeZd Zd Zd Z	d Z
d Zd Zd	 Zd
 Zd ZdS )ComprehensionNodeloopTc                     | j         S rN   r  r   s     rT   r   zComprehensionNode.infer_typeZ"  
    yrU   c                    | | j         _        |                     |           t          | j        t
          j                  rUt          | j        j        t                    sJ | j        j                    | j        j                            d |           d S t          | j        t
          j	                  sJ | j                    d S rN   )
r  rM  re  r   rV	  r   _ForInStatNoder  r_  ForFromStatNoder   s     rT   rg  z&ComprehensionNode.analyse_declarations]"  s    !di!566 	Kdi0.AAUU49CUUUUI))$44444di)>??JJJJJJJrU   c                 :    | j                             |           d S rN   )rV	  rg  r   s     rT   ri  z-ComprehensionNode.analyse_scoped_declarationsg"  s    	&&s+++++rU   c                 R    | j         s| j                            |          | _        | S rN   rb  rV	  rB  r   s     rT   r<  zComprehensionNode.analyse_typesj"  s)    # 	;	55c::DIrU   c                 R    | j         r| j                            |          | _        | S rN   r^	  r   s     rT   rn  z,ComprehensionNode.analyse_scoped_expressionso"  s)     	;	55c::DIrU   c                     dS rw  rW   rX   s    rT   r?  zComprehensionNode.may_be_nonet"  rn  rU   c                 0    |                      |           d S rN   r  r  s     rT   r  z&ComprehensionNode.generate_result_codew"  r  rU   c           
         | j         t          j        u rd}nC| j         t          j        u rd}n-| j         t          j        u rd}nt          d| j         z            |                    |                                 d|d|                    |                                 | j	                             | 
                    |           | j                            |           d S )NzPyList_New(0)zPySet_New(NULL)zPyDict_New()z"illegal type for comprehension: %sr  rW  )r   r   r   r   r   r   r   r  r   r   r  rV	  generate_execution_code)rY   r   create_codes      rT   r  z)ComprehensionNode.generate_operation_codez"  s    9))))KKY'***+KKY'+++(KK Dty PQQQ

KKMMMM;;;##DKKMM48<<<> 	? 	? 	? 	T"""	))$/////rU   c                 :    | j                             |           d S rN   )rV	  r  r  s     rT   r  zComprehensionNode.annotate"      	4     rU   N)r[   r\   r]   r   r   r,  r   r   rg  ri  r<  rn  r?  r  r  r  rW   rU   rT   rU	  rU	  R"  s         (KG$O  K K K, , ,  
  
  + + +0 0 0 ! ! ! ! !rU   rU	  c                   >    e Zd ZdgZdZej        Zd Zd Z	d Z
d ZdS )ComprehensionAppendNoder  Nc                     | j                             |          | _         | j         j        j        s| j                             |          | _         | S rN   )r  rB  r   rq   r   r   s     rT   rB  z+ComprehensionAppendNode.analyse_expressions"  sD    I11#66	y~) 	:	44S99DIrU   c           
      V   | j         j        t          u r0|j                            t          j        dd                     d}n2| j         j        t          u rd}nt          d| j         j        z            | j	        
                    |           |                    |                    |d| j                                         d| j	                                        d| j                             | j	                            |           | j	                            |           d S )	NListCompAppend
Optimize.c__Pyx_ListComp_Append	PySet_Addz'Invalid type for comprehension node: %sr
  , (PyObject*)r`  )rM  r   r   r   r   r	   r   r   r   r  r  r   r   r  r   r  r  rY   r   r&  s      rT   rc	  z/ComprehensionAppendNode.generate_execution_code"  s6   ;y((--'(8,GGI I I.HH[))"HH9DK<LLN N N 		**4000

4%%HHK    I' x	  	 	 	
 		((...	T"""""rU   c                 <    | j                             ||           d S rN   )r  r  r  s      rT   r  z5ComprehensionAppendNode.generate_function_definitions"  s     	//T:::::rU   c                 :    | j                             |           d S rN   )r  r  r  s     rT   r  z ComprehensionAppendNode.annotate"  rf	  rU   )r[   r\   r]   r   rM  r   r  r   rB  rc	  r  r  rW   rU   rT   rh	  rh	  "  sf         (KF D  # # #(; ; ;! ! ! ! !rU   rh	  c                   .    e Zd ZddgZd Zd Zd Zd ZdS )DictComprehensionAppendNodekey_expr
value_exprc                 B   | j                             |          | _         | j         j        j        s| j                             |          | _         | j                            |          | _        | j        j        j        s| j                            |          | _        | S rN   )ru	  rB  r   rq   r   rv	  r   s     rT   rB  z/DictComprehensionAppendNode.analyse_expressions"  s    99#>>}!- 	B M<<SAADM/==cBB#/ 	F"o@@EEDOrU   c                 8   | j                             |           | j                            |           |                    |                    d| j                                        d| j                                         d| j                                        d| j                             | j                             |           | j         	                    |           | j                            |           | j        	                    |           d S )Nr0  ro	  r`  )
ru	  r  rv	  r   r   rM  r  r   r  r  r  s     rT   rc	  z3DictComprehensionAppendNode.generate_execution_code"  s
   ..t44400666

4%%%K    M  """"O""$$$$' x	  	 	 	
 	,,T222  &&&..t444""4(((((rU   c                 r    | j                             ||           | j                            ||           d S rN   )ru	  r  rv	  r  s      rT   r  z9DictComprehensionAppendNode.generate_function_definitions"  s8    33C>>>55c4@@@@@rU   c                 n    | j                             |           | j                            |           d S rN   )ru	  r  rv	  r  s     rT   r  z$DictComprehensionAppendNode.annotate"  s4    t$$$  &&&&&rU   N)r[   r\   r]   r   rB  rc	  r  r  rW   rU   rT   rt	  rt	  "  s]        |,K  ) ) )A A A' ' ' ' 'rU   rt	  c                   N     e Zd ZdgZdZdZdZeZd	 fd	Z	d Z
d Zd Zd Z xZS )
InlinedGeneratorExpressionNodegenNTc                 &   |j         j        }d|_        |W|t          t          t
          fv s
J |            ||_        |                    t          ||t          j
                  |            t          t          |           j        |fd|i| d S )NT)rM  r   r}	  )r  gbody
is_inlinedr   r   r   inlined_comprehension_typer  r4  r   retval_cnamerP   r|	  r  )rY   r   r}	  comprehension_typerJ  r	  rS   s         rT   r  z'InlinedGeneratorExpressionNode.__init__"  s    ")%)Xy)IIIIK]III/AE,MM'-?ATUU'     	=,d33<STTcTVTTTTTrU   c                     | j         dvS )N)rl   r  rt  )	orig_funcrX   s    rT   r?  z*InlinedGeneratorExpressionNode.may_be_none"  s    ~%===rU   c                     | j         S rN   r  r   s     rT   r   z)InlinedGeneratorExpressionNode.infer_type"  rX	  rU   c                 D    | j                             |          | _         | S rN   )r}	  rB  r   s     rT   r<  z,InlinedGeneratorExpressionNode.analyse_types"  s    8//44rU   c           
         |                     |                                 d| j                                        d|                    |                                 | j                             |                     |           d S )Nz = __Pyx_Generator_Next(rc  )r   r  r}	  r   r   r  r  s     rT   r  z3InlinedGeneratorExpressionNode.generate_result_code #  s|    

KKMMMM48??,,,,##DKKMM48<<<> 	? 	? 	? 	T"""""rU   rN   )r[   r\   r]   r   r	  rM  r   r   r   r  r?  r   r<  r  r^   r_   s   @rT   r|	  r|	  "  s         wHIFGD
U 
U 
U 
U 
U 
U> > >    # # # # # # #rU   r|	  c                   V    e Zd ZdZ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S )r  z
    Merge a sequence of iterables into a set/list/tuple.

    The target collection is determined by self.type, which must be set externally.

    args    [ExprNode]
    r   TzConstructing Python collectionc                    |t           t          fv rZ|rX|d         j        rK|d         j        t           ur7t	          |d         j        |d         j        d|d         j                  |d<   t          	                    | |||           d S )Nr   T)r   r   r   )r   r   )
r   r   r   r   r  r   r   r   r   r  )rY   r   r   r   s       rT   r  zMergedSequenceNode.__init__#  s    Iz***t*Q8W*Aw|9,,"47;T!W\4]abc]d]pqqqQ$$T:::::rU   c                 z   g }| j         D ]]}|j        r|j        r|j        j        dk    r!|j        s|j        rd |j         D             }n|j        }|                    |           ^| j        t          u rt          |          }n.| j        t          u rt          |          }n| j        t          u sJ || _        d S )Nr   c              3   $   K   | ]}|j         V  d S rN   r  rs  s     rT   rf   z?MergedSequenceNode.calculate_constant_result.<locals>.<genexpr>##  s%      BB,BBBBBBrU   )r   r   r   r   rX  r  r   r   r  r   r   r   )rY   r  r   rv  s       rT   r(  z,MergedSequenceNode.calculate_constant_result#  s    I 
	! 
	!D+ 0@ #3q88" -d&B -BB	BBB,MM%    9  [[FFY*$$6]]FF9	))))%rU   c                    g }| j         D ]{}|j        r&|j        r|j                                      dk    r/|j        s|j        rfd|j         D             }n|                              }|                    |           || j        t          u r=	 t          |          }nZ# t          $ r}| 
                    |           Y d }~n6d }~ww xY w| j        t          u rt          |          }n| j        t          u sJ |S )Nr   c              3   B   K   | ]}|                               V  d S rN   rX  rY  s     rT   rf   z8MergedSequenceNode.compile_time_value.<locals>.<genexpr>7#  s1      KK#//55KKKKKKrU   )r   r   r   r2  rX  r  r   r   r  r  r6  r   r   r   )rY   r1  r  r   rv  r5  s    `    rT   r2  z%MergedSequenceNode.compile_time_value/#  s:   I 		! 		!D+ 0@ #66t<<AA" 6d&B 6KKKKKKK//55MM%    9  1V 1 1 1--a000000001Y*$$6]]FF9	))))s   B& &
C0C

Cc                     dS rw  rW   r   s     rT   rO  z$MergedSequenceNode.type_dependenciesF#  r$  rU   c                     | j         S rN   r  r   s     rT   r   zMergedSequenceNode.infer_typeI#  rX	  rU   c                     fd| j         D             }t          |          dk    r|d         j        | j        u r|d         S | j        t          t          t
          fv sJ || _         | S )Nc                     g | ]=}|                                                                                 d           >S )z2argument after * must be an iterable, not NoneTyper)  r6  s     rT   r   z4MergedSequenceNode.analyse_types.<locals>.<listcomp>M#  s\     
 
 
  c""55c::LLDF F
 
 
rU   r(   r   )r   r   r   r   r   r   )rY   rs   r   s    ` rT   r<  z MergedSequenceNode.analyse_typesL#  s    
 
 
 
 y	
 
 
 t99>>d1gldi777NyXy*=====	rU   c                     dS rw  rW   rX   s    rT   r?  zMergedSequenceNode.may_be_none]#  rn  rU   c                 \	   |                     | j                   |                     |           | j        t          u }t          | j                  }t          |          }|                    |           |r|j	        s|sj|j
        rc|j        t          u rU|                    |                                 d|                                d           |                    |           n|                    |                                 d|rdn|j        r|j        t"          t          fv rdndd|                                d|                    |                                 | j                             |                     |           |                    |           |                    |           t-                      }|rd}d	}nd
}d}|D ]}|r|j	        s|j
        s|j
        r|j        s|s|j        r|                    d           |j        D ]}|                    |           |                    |j        |d|                                 d|                                d           |                    |           |                    |           |r|                    d           n|                    d           |                    |           |                    |j        |d|                                 d|                                d           |                    |           |                    |           | j        t4          u r|                    d           |                    dt6          j        d|                                 d           |                    |                                 t"                     |                    |                                 dt6          j        d|                    |                                 | j                             |                     |           |                    d           t=          |          D ](}	|j                             tC          j"        |	            )d S )Nr  r  	PySet_Newr	  r	  r
  rc  rn	  __Pyx_PySet_Updaterm	  __Pyx_PyList_Extend)rk	  rl	  r  r`  )PySet_Updatez
Builtins.c)
ListExtendrl	  r  z
PyObject *z = PyList_AsTuple(r  rW  r   )#r  r   r  r   r   r  r   r  r  rX  r   r   r   r  r   r  r   r   r   r  r  r  r  r   r  r<  r   r   r  r  rt  r   r   r	   r   )
rY   r   is_setr   r   r4  add_funcextend_funcr>  r5  s
             rT   r  z+MergedSequenceNode.generate_evaluation_code`#  s   dh!!$'''h&DIDzz%%d+++ 	.t* 	.	.#;	.@D	Y@V@VJJT[[]]]]DNN4D4D4D4DEFFF..t4444JJ% +;?< +DIZhjsYtLtLt77*+ +     ''tx@@@B C C C   &&&''---%% 	0"H.KK.H/K 	" 	"D D/ 43O 1:>:J B$) BKK @AAA9 ) )C00666))#' 4) * * * ..t444NN4(((( ::;;;;8999))$///!!$(    -" # # # ''---OOD!!!!9
""JJsOOOJJJ'''       OODKKMM>:::JJ'''''tx@@@B C C C   &&&JJsOOOWoo 	P 	PF--k.Ev.NOOOO	P 	PrU   c                 D    | j         D ]}|                    |           d S rN   )r   r  r7  s      rT   r  zMergedSequenceNode.annotate#  s2    I 	  	 DMM$	  	 rU   N)r[   r\   r]   r  r   r   re  r  r(  r2  rO  r   r<  r?  r  r  rW   rU   rT   r  r  #  s          xHG2K; ; ;& & &*  .      "  KP KP KPZ         rU   r  c                   B    e Zd ZdZdgZeZdZdZd Z	d Z
d Zd Zd	 Zd
S )SetNodez
    Set constructor.
    r   TzConstructing Python setc                     t          t          | j                            D ]A}| j        |         }|                    |          }|                    |          | j        |<   Bt
          | _        d| _        | S rl  )r  r   r   r<  r   r   r   r   )rY   rs   rT  r>  s       rT   r<  zSetNode.analyse_types#  sm    s49~~&& 	7 	7A)A,C##C((C11#66DIaLL	rU   c                     dS rw  rW   rX   s    rT   r?  zSetNode.may_be_none#  rn  rU   c                 2    d | j         D             | _        d S )Nc                     h | ]	}|j         
S rW   r  rs  s     rT   r   z4SetNode.calculate_constant_result.<locals>.<setcomp>#  s    III 3IIIrU   )r   r   rX   s    rT   r(  z!SetNode.calculate_constant_result#  s     IItyIIIrU   c                     fd| j         D             }	 t          |          S # t          $ r }|                     |           Y d }~d S d }~ww xY w)Nc                 :    g | ]}|                               S rW   rX  rY  s     rT   r   z.SetNode.compile_time_value.<locals>.<listcomp>#  s'    DDD3#((..DDDrU   )r   r  r  r6  r8	  s    `  rT   r2  zSetNode.compile_time_value#  st    DDDD$)DDD	-v;; 	- 	- 	-))!,,,,,,,,,	-   % 
AA

Ac           	      :   | j         D ]}|                    |           |                     |           |                    |                                 d|                    |                                 | j                             |                     |           | j         D ]r}|                    | j        d|                                 d|	                                d           |
                    |           |                    |           sd S )Nz = PySet_New(0); z
PySet_Add(r  r`  )r   r  r  r   r  r   r   r  r<  r   r  r  r	  s      rT   r  z SetNode.generate_evaluation_code#  s*   9 	/ 	/C((....!!$'''

''tx@@@B	C 	C 	C 	T"""9 	! 	!C!!'+{{}}}}cmmooooFH H H &&t,,,NN4    	! 	!rU   N)r[   r\   r]   r  r   r   r   rX  re  r<  r?  r(  r2  r  rW   rU   rT   r	  r	  #  s          xHDN+K    J J J- - -! ! ! ! !rU   r	  c                        e Zd ZdgZdZdZeZdZdZ	g Z
ed             Zd Zd Zd Zd	 Zd
 Zd Z fdZd ZdZd Zd Zd Z xZS )rM  rL  r(   FTc                 6     | fd|D                       S )Nc                 :    g | ]\  }}t          ||           S rG  r   )rK  )rc   krB  r   s      rT   r   z'DictNode.from_pairs.<locals>.<listcomp>#  s?     )E )E )E6:aSaq111)E )E )ErU   rL  rW   )rR   r   pairss    ` rT   
from_pairszDictNode.from_pairs#  sO    s3 )E )E )E )E>C)E )E )E F F F 	FrU   c                 L    t          d | j        D                       | _        d S )Nc                     g | ]	}|j         
S rW   r  rq  s     rT   r   z6DictNode.calculate_constant_result.<locals>.<listcomp>#  s.     %G %G %G)-$%G %G %GrU   )r  rL  r   rX   s    rT   r(  z"DictNode.calculate_constant_result#  s@    # %G %G151E%G %G %G  H  HrU   c                     fd| j         D             }	 t          |          S # t          $ r }|                     |           Y d }~d S d }~ww xY w)Nc                 x    g | ]6}|j                                       |j                                      f7S rW   )rG  r2  r   )rc   r   r1  s     rT   r   z/DictNode.compile_time_value.<locals>.<listcomp>#  sO     . . . (--d33TZ5R5RSW5X5XY . . .rU   )rL  r  r  r6  )rY   r1  r	  r5  s    `  rT   r2  zDictNode.compile_time_value#  s    . . . .,. . .	-;; 	- 	- 	-))!,,,,,,,,,	-r	  c                     dS rw  rW   r   s     rT   rO  zDictNode.type_dependencies$  r$  rU   c                     t           S rN   r&  r   s     rT   r   zDictNode.infer_type$  r?	  rU   c                     t          d          5 }fd| j        D             | _        d d d            n# 1 swxY w Y   || _        | S )NTr  c                 :    g | ]}|                               S rW   rA  r   s     rT   r   z*DictNode.analyse_types.<locals>.<listcomp>$  s7     $ $ $ ""3''$ $ $rU   )r   rL  rC	  )rY   rs   rD	  s    ` rT   r<  zDictNode.analyse_types$  s    &&& 	&$ $ $ $ 0$ $ $D 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 &,"s   7;;c                     dS rw  rW   rX   s    rT   r?  zDictNode.may_be_none$  rn  rU   c           	         |j         r|                                  | j        j        rSt	          j        |          st          | j        d|z             t          | j        fd| j	        D                       S | j                            |          st          | j        d|z             n|j        r|| _        |j
        s1t          | j	                  dk    rt          | j        d|z             nO|j
        rHt          | j	                  t          |j        j                  k     rt          | j        d|z  d           | j	        D ]}t          |j        t"                    r|j        j        |_        |j        j        s;t          |j        j        d           t)          |j        j        d	
          |_        ut+          |j        j                  }|j                            |          }|s"t          |j        j        d|d|d           |j        }t          |t"                    r|j        }|                    |j                  |_        n)t3          t          |                               |          S | S )Nz-Cannot interpret struct as non-dict type '%s'c           	          g | ]I}t          |j        |j                                      |j                                                 JS r	  )rK  r   rG  r   r   r   s     rT   r   z&DictNode.coerce_to.<locals>.<listcomp>$  sf     ;6 ;6 ;6  !tx/J/J3/O/O'+z'D'DS'I'IK K K;6 ;6 ;6rU   r	  z"Cannot interpret dict as type '%s'r(   z<Exactly one field must be specified to convert to union '%s'z%Not all members given for struct '%s'zInvalid struct field identifierr  rr  zstruct 'z' has no field 'r  )rq   release_errorsr   r:  r   r   r   r   rM  rL  r{  r   r,  rs  r   r   rG  r  r>  rY  rC  rx   r   r  r  rP   )rY   r	  rs   r   rG  rO  r   rS   s     `    rT   r  zDictNode.coerce_to$  s    "	B!!!y+ 7 +H55 `$($SV^$^___ ;6 ;6 ;6 ;6 !% 4;6 ;6 ;6 7 7 7 7 9''11 Qdh Dx OPPP( 	B DI% Y#d.B*C*Cq*H*Hdh ^ai ijjjj# YD,@(A(ACHbDcDc(c(c"IH"TVWXXX, G Gdh(:;; ,#x|DHx1 G$(,(IJJJ)$(,iHHHDHHdhn--C%^77<<F! GdhllxxxY\Y\Y\,]^^^^ $
%e-?@@ .$)IE%*__V[#%F%F

G" 4((228SAAArU   c                 F    | j         D ]}t          |           g | _         d S rN   )rC	  r   )rY   rt   s     rT   r	  zDictNode.release_errors=$  s3    - 	 	C%'"""rU   r+  c                 d   |                     | j                   |                     |           | j        j        }|r|                                  |                    d|                                 t          | j	                  |
                    |                                 | j                  fz             |                     |           t                      }d }d}| j	        D ]}|                    |           |r| j        r/|                    d|j                                        z             |j        }| j        r|z|j        sd }np|j        |v rd }nd|t          |j                  ur4|/t          |j                  }|                    |j                   nd }n|                    |j                   ||                    d|                                 d|                                d           d}|                    d|                                d	|                    |j                             |                    d
           |                    | j        d|                                 d|j                                        d|j                                        d           | j        r||                    d           | j        r|                    d           n|j        j        j        rm|                    d|                                 d|j        j        d|j                                        d|j                                        d	           nQ|                    |                                 d|j        j        d|j                                        d           |                    |           |                    |           |r/|j                            t9          j        dd                     d S d S )Nz%%s = __Pyx_PyDict_NewPresized(%d); %sFr  r-  r  r  Tr/  rc  r  r0  r`  r   zmemcpy(r   r6  r  r  r  r.  r3  )r  r   r  r   rq   r	  r   r  r   rL  r   r  r  r  exclude_null_valuesr   r   rG  r  rY  r  r   r<  rT  r  r  r   r   r	   r   )rY   r   is_dict	keys_seenkey_typeneeds_error_helperr   rG  s           rT   r  z!DictNode.generate_evaluation_codeD$  sJ    	dh!!$''')' 	'!!!JJ7KKMM,--++DKKMM48DD;F FG G G
   &&&EE	"( 7	" 7	"D))$/// 32+ EJJ{TZ-A-A-C-CCDDDh) / ,"4 5(,II Y)33(,II%T#)__<<'/+/	?? )ci 8 8 8 8 -1		%MM#)444 (


 KKMMMM3==????$< = = = .2*


MMOOOO OODH555$7 8 8 8 

:...%%dhhKKMMMMH&&((((J((****1, - - - ) $i.?JJsOOO+ $JJsOOO:?+ 
2JJJ KKMMMM HNNN J--//// J--////	 1 2 2 2 2 JJ KKMMMM HNNN J--//// 1 2 2 2 ''---OOD!!!! 	W--'(=?TUUW W W W W	W 	WrU   c                 D    | j         D ]}|                    |           d S rN   )rL  r  r7  s      rT   r  zDictNode.annotate$  s3    ( 	  	 DMM$	  	 rU   c                 >    t          d | j        D                       S )Nc                 &    g | ]\  }}|j         |fS rW   rr  r  s      rT   r   z+DictNode.as_python_dict.<locals>.<listcomp>$  s#    OOOJCci'OOOrU   )r  rL  rX   s    rT   as_python_dictzDictNode.as_python_dict$  s$     OO$:NOOOPPPrU   )r[   r\   r]   r   r   r	  r   r   rW  r  rC	  rd  r	  r(  r2  rO  r   r<  r?  r  r	  re  r  r  r	  r^   r_   s   @rT   rM  rM  #  s.        ""HGDOF F [FH H H- - -        $ $ $ $ $L( ( (
 -KOW OW OWb     Q Q Q Q Q Q QrU   rM  c                   >    e Zd ZddgZdZd Zd Zd Zd Zd Z	d	 Z
dS )
rK  rG  r   Nc                 @    | j         j        | j        j        f| _        d S rN   )rG  r   r   rX   s    rT   r(  z&DictItemNode.calculate_constant_result$  s"    H$dj&@ BrU   c                     | j                             |          | _         | j                            |          | _        | j                             |          | _         | j                            |          | _        | S rN   )rG  r<  r   r   r   s     rT   r<  zDictItemNode.analyse_types$  sc    8))#..Z--c22
8..s33Z22377
rU   c                 n    | j                             |           | j                            |           d S rN   )rG  r  r   r  s     rT   r  z%DictItemNode.generate_evaluation_code$  s4    ))$///
++D11111rU   c                 n    | j                             |           | j                            |           d S rN   )rG  r  r   r  s     rT   r  z#DictItemNode.generate_disposal_code$  s4    ''---
))$/////rU   c                 n    | j                             |           | j                            |           d S rN   )rG  r  r   r  s     rT   r  zDictItemNode.free_temps$  s4    D!!!
d#####rU   c                 8    t          | j        | j        g          S rN   )r  rG  r   rX   s    rT   __iter__zDictItemNode.__iter__$  s    TXtz*+++rU   )r[   r\   r]   r   rs  r(  r<  r  r  r  r	  rW   rU   rT   rK  rK  $  s        
 wHKB B B  2 2 20 0 0$ $ $, , , , ,rU   rK  c                   0    e Zd ZdgZdZd Zd Zd Zd ZdS )SortedDictKeysNoder>  Tc                 l    t                               | |j        |           t          j        | _        d S )N)r>  )r   r  r   r   r   r   )rY   r>  s     rT   r  zSortedDictKeysNode.__init__$  s-    $S111%			rU   c                     | j                             |          }|j        t          j        u r|                    d          }|| _         | S r  )r>  r<  r   r   r   rG  r  s      rT   r<  z SortedDictKeysNode.analyse_types$  sK    h$$S))8w(((''35 5CrU   c                     dS rw  rW   rX   s    rT   r?  zSortedDictKeysNode.may_be_none$  rn  rU   c                    | j                                         }| j         j        t          j        u rq|                    |                                 d|d|                    |                                 | j                             | 	                    |           n|j
                            t          j        dd                     |                    t          j        d                    }|                    |                                 d|d|d|                    |                                 | j                             | 	                    |           |                    d|                                 z             |                     |d	|                                 z             |                    |                    |                                 | j                             | 	                    |           |                    d
           |                    | j        d|                                 z             d S )Nz = PyDict_Keys(rc  PyObjectCallMethod0r  keysz = __Pyx_PyObject_CallMethod0(r  z"if (unlikely(!PyList_Check(%s))) {zPySequence_List(%s)r   zPyList_Sort(%s))r>  r   r   r   r   r   r  r   r   r  r   r   r	   r   r  r   r0  r  r<  )rY   r   dict_result
keys_cnames       rT   r  z'SortedDictKeysNode.generate_result_code$  s    h((**8=G---JJ{{{''tx@@@B C C C   &&&& --k.E%'9/; /; < < <//0LV0T0TUUJJJ{{{JJJ''tx@@@B C C C   &&&JJ;dkkmmKLLL$$T+@4;;==+PQQQJJt..t{{}}dhGGHHH  &&&JJsOOOH'$..*:*::	< 	< 	< 	< 	<rU   N)	r[   r\   r]   r   r   r  r<  r?  r  rW   rU   rT   r	  r	  $  s\        wHG& & &    < < < < <rU   r	  c                       e Zd Zd Zd ZdS )ModuleNameMixinc                 :    |                     | j        d          S NT)rL  )r  rD  r  s     rT   get_py_mod_namezModuleNameMixin.get_py_mod_name$  s'    '' ( / / 	/rU   c                 :    |                     | j        d          S r	  )r  qualnamer  s     rT   get_py_qualified_namez%ModuleNameMixin.get_py_qualified_name$  s&    ''Md ( , , 	,rU   N)r[   r\   r]   r	  r	  rW   rU   rT   r	  r	  $  s2        / / /, , , , ,rU   r	  c                   >    e Zd ZdgZeZdZd Zd Zd Z	d Z
dZd Zd	S )
	ClassNodedocTc                     d S rN   rW   r   s     rT   r   zClassNode.analyse_annotations	%  r   rU   c                     t           S rN   r  r   s     rT   r   zClassNode.infer_type%      rU   c                     | j         r>| j                             |          | _         | j                             |          | _         |                    t	          j        dd                     | S )NCreateClassr  )r	  r<  r   r   r	   r   r   s     rT   r<  zClassNode.analyse_types%  sa    8 	8x--c22DHx22377DH[4]DVWWXXXrU   c                     dS ry  rW   rX   s    rT   r?  zClassNode.may_be_none%  rB  rU   Constructing Python classc                    | j         }|                    | j                  }| j        rx|                    | j        d|j                                        d|                    t          j	        d                    d| j                                        d           | 
                    |          }|                     |          }|                    |                                 d|j                                        d|j                                        d|d|d|d|                    |                                 | j                             |                     |           d S )Nr0  r  r  r`  z = __Pyx_CreateClass(rc  )class_def_noder  rr   r	  r<  r   r  r   r   r0  r	  r	  r   r  basesr   r  )rY   r   r	  r   py_mod_namer	  s         rT   r  zClassNode.generate_result_code%  s   ,&&ty118 	+!!$(("'113333**&4Y??A A A AH&&((((	*+ + + **400--d33

$..0000#--////''tx@@@B	C 	C 	C 	T"""""rU   N)r[   r\   r]   r   r   r   r   r   r   r<  r?  re  r  rW   rU   rT   r	  r	  $  sy         wHDG         .K# # # # #rU   r	  c                   @    e Zd Zg ZeZdZdZd Zd Z	d Z
dZd Zd Zd	S )
Py3ClassNodeFTc                     t           S rN   r  r   s     rT   r   zPy3ClassNode.infer_typeF%  r	  rU   c                     | S rN   rW   r   s     rT   r<  zPy3ClassNode.analyse_typesJ%  rp  rU   c                     dS ry  rW   rX   s    rT   r?  zPy3ClassNode.may_be_noneM%  rB  rU   r	  c                    ddl m} | j        j        }d |j                                        D             }|rt          ||          }t          |t          j	        d                    }|
                    |j                  p |                    |j        t          |          |_        t          |||          }|                    |           | j        j        j                            d|           d S d S )	Nr(   AnnotationWriterc           	          g | ]C}|j         	t          |j        t          |j        |j                   |j         j                  DS rr  r	  )rT  rK  r   r   rr   stringrc   r   s     rT   r   z4Py3ClassNode.analyse_annotations.<locals>.<listcomp>U%  sc     
 
 
 1A
	(%*EEE&-  
 
 
rU   r	  __annotations__r  )r  r   r   )AutoDocTransformsr	  r	  r   ru  r?  rM  r  r   r0  r  rr   r  r   r   r-   rg  bodyr  insert)rY   rs   r	  position
dict_itemsannotations_dictr  r   s           rT   r   z Py3ClassNode.analyse_annotationsR%  s   777777&*
 
 ++--
 
 

  	;'*MMM8.*FGY*Z*Z[[[C11cS__SXyZb5c5cCI'c?OPPPD%%c***$*11!T:::::	; 	;rU   c                    |j                             t          j        dd                     |                    | j                  }| j        }|j        r|j                                        nd}|j	        r|j	                                        }n| j
        rd}nd}|                    d|                                 |||j                                        |j                                        || j        | j        |                    |                                 | j                  f	z             |                     |           d S )NPy3ClassCreater  r  z((PyObject*)&PyType_Type)z$((PyObject*)&__Pyx_DefaultClassType)z9%s = __Pyx_Py3ClassCreate(%s, %s, %s, %s, %s, %d, %d); %s)r   r   r	   r   r  rr   r	  mkwr   	metaclass
force_typer   r  r	  r  calculate_metaclassallow_py2_metaclassr   r   r  )rY   r   r   r	  r
  r
  s         rT   r  z!Py3ClassNode.generate_result_codef%  sC   ))+*ABRTf*g*ghhh&&ty11,0>0BNn **,,,# 	?&0::<<II_ 	?3II>I

G$..00#--//((''tx@@	KB 	B
	C 
	C 
	C 	T"""""rU   N)r[   r\   r]   r   r   r   r
  r   r   r<  r?  re  r   r  rW   rU   rT   r	  r	  5%  s|         HDJG       .K; ; ;(# # # # #rU   r	  c                   $    e Zd Zg Zd Zd Zd ZdS )PyClassMetaclassNodec                 ,    t           | _        d| _        | S ry  )r   r   r   r   s     rT   r<  z"PyClassMetaclassNode.analyse_types%  s    "	rU   c                     dS ry  rW   rX   s    rT   r?  z PyClassMetaclassNode.may_be_none%  rB  rU   c           
      V   | j         j        }| j         j        }|r[|j                            t          j        dd                     d|                                d|                                d}nD|j                            t          j        dd                     d|                                z  }|                    |                                 d|d	|	                    |                                 | j
                             |                     |           d S )
NPy3MetaclassGetr  z__Pyx_Py3MetaclassGet(r  r`  CalculateMetaclassz"__Pyx_CalculateMetaclass(NULL, %s)r  rW  )r	  r	  r
  r   r   r	   r   r  r   r   r   r  )rY   r   r	  r
  calls        rT   r  z)PyClassMetaclassNode.generate_result_code%  s6   #)!% 
	 --'(9;MNNP P P P 

DD --'(<>PQQS S S7 D

ttt''tx@@@B	C 	C 	C 	T"""""rU   Nr[   r\   r]   r   r<  r?  r  rW   rU   rT   r
  r
  %  sH        
 H  
  # # # # #rU   r
  c                   &    e Zd ZdgZd Zd Zd ZdS )PyClassNamespaceNoder	  c                     | j         r2| j                             |                              |          | _         t          | _        d| _        | S rl  )r	  r<  r   r   r   r   r   s     rT   r<  z"PyClassNamespaceNode.analyse_types%  sE    8 	Kx--c22EEcJJDH"	rU   c                     dS ry  rW   rX   s    rT   r?  z PyClassNamespaceNode.may_be_none%  rB  rU   c                    |                     | j                  }|                     |          }|                     |          }| j        }d}| j        r| j                                        n|}|j        r|j                                        n|}|j	        r|j	                                        n|}	|
                    |                                 d|	d|j                                        d|d|d|d|d|d|                    |                                 | j                             |                     |           d S )Nz(PyObject *) NULLz = __Pyx_Py3MetaclassPrepare(r  rc  )r  rr   r	  r	  r	  r	  r  r
  r   r
  r   r	  r   r   r  )
rY   r   r   r	  r	  r	  nulldoc_coder
  r
  s
             rT   r  z)PyClassNamespaceNode.generate_result_code%  sV   &&ty11**400--d33,"(,:48??$$$d0>0BLn **,,,<J<T^N,66888Z^	

		$++----''tx@@@	B
	C 
	C 
	C 	T"""""rU   Nr
  rW   rU   rT   r
  r
  %  sJ         wH    # # # # #rU   r
  c                   0    e Zd ZdZeZg ZdZd Zd Z	d Z
dS )ClassCellInjectorNodeTFc                     | S rN   rW   r   s     rT   rB  z)ClassCellInjectorNode.analyse_expressions%  rp  rU   c                     | j         sJ |                    |                                 d|                    |                                 | j                             |                     |           d S )Nz = PyList_New(0); )	is_activer   r  r   r   r  r  s     rT   r  z*ClassCellInjectorNode.generate_result_code%  sz    ~

''tx@@@B	C 	C 	C 	T"""""rU   c                     | j         sJ |j                            t          j        dd                     |                    | j        d|                                 d|d           d S )NCyFunctionClassCellCythonFunction.cz__Pyx_CyFunction_InitClassCell(r  r`  )r
  r   r   r	   r   r<  r   r  )rY   r   classobj_cnames      rT   generate_injection_codez-ClassCellInjectorNode.generate_injection_code%  s    ~))#$9;MNN	P 	P 	PdhhKKMMMM>>>)+ 	, 	, 	, 	, 	,rU   N)r[   r\   r]   r   r   r   r   r
  rB  r  r#
  rW   rU   rT   r
  r
  %  sU        GDHI  # # #, , , , ,rU   r
  c                   *    e Zd Zg ZdZdZeZd Zd Z	dS )ClassCellNodeTFc                     | S rN   rW   r   s     rT   r<  zClassCellNode.analyse_types%  rp  rU   c                    | j         s8|                    |                                 dt          j        d           n7|                    |                                 dt          j        d           |                    d|                                 d|                    | j                  d           |                    |                                 t                     d S )Nz  = __Pyx_CyFunction_GetClassObj(r  z =  z->classobj;zif (!zI) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); r+  )
is_generatorr   r  r   
self_cnamegenerator_cnamer   r   r  r   r  s     rT   r  z"ClassCellNode.generate_result_code%  s      	8JJ!!!# $ $ $ $ JJv5557 8 8 8


 ))))+	, 	, 	,
 	~66666rU   N)
r[   r\   r]   r   r   r(
  r   r   r<  r  rW   rU   rT   r%
  r%
  %  sF        HGLD  7 7 7 7 7rU   r%
  c                       e Zd Zg dZdZdZdZdZdZdZ	dZ
dZdZ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d ZdS )PyCFunctionNode)code_objectdefaults_tupledefaults_kwdictr
  NFr   r(   c           
      t     | |j         ||j        j        |p|j        |j        t	          |                    S )N)r  pymethdef_cnamebindingspecialized_cpdefsr-
  )r   r   r1
  r3
  CodeObjectNode)rR   r   r2
  s      rT   from_defnodezPyCFunctionNode.from_defnode&  sF    s48 #':#="=d&=&*&=-d335 5 5 	5rU   c                 >    | j         r|                     |           | S rN   )r2
  analyse_default_argsr   s     rT   r<  zPyCFunctionNode.analyse_types(&  s%    < 	+%%c***rU   c                    g }g }g }g }g }|j         p| j        j        o|j        }| j        j        D ]V}|j        r|s|j        j        rQt          |j        |j                  |_        |j        j	        r%|j        
                    |j	        |          |_        n>d|_        |j	        j        r|                    |           n|                    |           |j        j	        rQ|j        j	                            |          r2|j        r|                    |           n|                    |           |j        rK|j                            |          |_        |                    |j        |j        |j        j        f           X| j        j        | j        j        fD ]V}|rR|j        rK|j                            |          |_        |                    |j        |j        |j        j        f           W| j        j        }	|	rS|	                    |          | j        _        |                    |	j        t/          j        d          |	j        f           |s|r|                                }
|
                    t6          j                  }t;          j        |          }g | _        |D ]d}|j	        }|j         r|j!        }|"                    |j        |dt6          j#        |j        z   d          }| j                            ||f           e|D ]U}|"                    |j        |j	        dt6          j#        |j        z   dd          }| j                            ||f           V|
$                    dd|dd|	          }|| _%        tM          |          | _'        | j        D ] \  }}t6          j(        d
|j)        |_*        !| j%        j        | j        _%        |s|r| j%        |rMtW          | j        d |D                       }|                    |          ,                    |          | _-        |r:t]          | j        d |D                       }|                    |          | _/        nO| j0        sG|rtc          | j        || j%                  }nte          | j                  }|rtg          | j        || j%                  }nte          | j                  }ti          j5        | j        g ddti          j6        | j        tn          tW          | j        ||g                    dt/          j        d                    }|                                }
|8                    |
           |9                    |
          }|j:        9                    |j;                  |_:        d|_<        d|_=        || j        _>        |r<t]          | j        d |D                       }|                    |          | _?        dS dS )zB
        Handle non-literal function's default arguments.
        TreturnN)allow_pyobjectF)r:
  allow_memoryviewstructr(   r8  r  c                     g | ]	}|j         
S rW   )rh   rs  s     rT   r   z8PyCFunctionNode.analyse_default_args.<locals>.<listcomp>}&  s'     ?= ?= ?=(+?= ?= ?=rU   rL  c           	      x    g | ]7}t          |j        t          |j        |j                   |j                  8S r	  )rK  r   r   rr   rh   rs  s     rT   r   z8PyCFunctionNode.analyse_default_args.<locals>.<listcomp>&  s]     J3 J3 J3
  	 %G 4SWCH M M M"%+/ / /J3 J3 J3rU   r	  )r  r   __defaults__)r   r  r  r	  
decoratorsrr   c           	      X    g | ]'\  }}}t          |t          ||           |          (S r	  )rK  r   )rc   r   rr   r   s       rT   r   z8PyCFunctionNode.analyse_default_args.<locals>.<listcomp>&  s[     C5 C5 C5 %Cu 1#TBBB! ! !C5 C5 C5rU   )@r  r  
is_wrapperr  r   rh   r   DefaultLiteralArgNoder   r   r  
is_dynamicrq   r  r  kw_onlyrT  r<  rr   r	  r  r  return_type_annotationr   r0  r  next_idr   defaults_struct_prefixr   StructOrUnionScopedefaultsr  rZ  r  
arg_prefixdeclare_struct_or_uniondefaults_structr   defaults_pyobjectsdynamic_args_cnamer   r  rO  r   r.
  rM  r/
  r3
  DefaultsTupleNoder  DefaultsKwDictNoder   DefNodeReturnStatNoder   rg  rB  r	  local_scopepy_wrapper_requiredpymethdef_requireddefaults_getterr
  )rY   rs   nonliteral_objectsnonliteral_otherdefault_argsdefault_kwargsannotationsmust_use_constantsr>  rT  rY  r   r,  r  r   r.
  r/
  rW
  r
  s                      rT   r7
  z$PyCFunctionNode.analyse_default_args-&  s      !1gdm6N6fSVSf=% 	O 	OC{ 1) 
9{- 	9&;CGS[&Q&Q;+ O*-+*?*?#*N*NCK)-8/ 9.55c::::,33C888;# 1(8(O(OPS(T(T 1{ 1&--c2222$++C000~ O!$!=!=c!B!B""CGSXs~7L#MNNNM*DM,FG 	O 	OC Os~ O!$!=!=c!B!B""CGSXs~7L#MNNN]9
 	43=3K3KC3P3PDM0
0LX0V0V * 1 3 4 4 4  	F!1 	F++--L (()FGGE-e44EDM) 3 3? '!JE))#(E4*0*;ch*F9= * ? ? $$c5\2222' 3 3))#(CHd*0*;ch*F9>QU * W W $$c5\2222 88hq$e 9 = =E#(D &)*<&=&=D#"m < <
U---u{{%<!!,0,@,EDM) +	@> +	@#+ d%.tx ?= ?=/;?= ?= ?= &> &> &>N*8*F*Fs*K*K*^*^_b*c*cD'! N&.tx J3 J3
 $2J3 J3 J3 '4 '4 '4O ,;+H+H+M+MD(, @ 8%6,0D&F &FNN &.dh%7%7N! 9&8.$2F'H 'HOO '/tx&8&8O"'-H24-n' HNO+LN N NO O O  $'5nEE#G #G #G  #//1144\BBB"1"E"El"S"S'6';'O'O#/(1 (1$6;35:20?- 	H' C5 C5 )4	C5 C5 C5  6  6  6
 %5$B$B3$G$GD!!!	H 	HrU   c                     dS rw  rW   rX   s    rT   r?  zPyCFunctionNode.may_be_none&  rn  rU   zConstructing Python functionc                     dS )Nr  rW   rX   s    rT   closure_result_codez#PyCFunctionNode.closure_result_code&  s    vrU   c                 l    | j         r|                     |           d S |                     |           d S rN   )r2
  generate_cyfunction_codegenerate_pycfunction_coder  s     rT   r  z$PyCFunctionNode.generate_result_code&  s@    < 	1))$/////**400000rU   c                 H   |                      |          }|                    |                                 d| j        d|                                 d|d|                    |                                 | j                  	           |                     |           d S )Nz = PyCFunction_NewEx(&r  rc  )r	  r   r  r1
  r`
  r   r   r  )rY   r   r	  s      rT   rc
  z)PyCFunctionNode.generate_pycfunction_code&  s    **400

$$$((****''tx@@@B	C 	C 	C 	T"""""rU   c                 V	   | j         r| j         d         }n| j        }| j         s| j        r0|j                            t          j        dd                     d}n/|j                            t          j        dd                     d}| j        r| j                                        }nd}g }|j	        r|
                    d           n|j        r|
                    d	           |j        j        j        r!|j        j        s|
                    d
           |j        r|
                    d           |rd                    |          }nd}|                    |                                 d|d| j        d|d|                     |          d|                                 d|                     |          dt2          j        d|d|                    |                                 | j                             |                     |           |j        r|j        s
J d            |j        d         }|                     |                                 tB                     |                    d|j"                                        d|                                 d           | #                    |           | j$        r|                    d|                                 | j%        j&        | j'        |(                    | j                  fz             d| j%        j&        d|                                 d}| j$        D ]&\  }}	|)                    ||d|	j*                   '| j+        rE|                    d|                                 d| j+                                        d           | j         s| j,        rE|                    d|                                 d| j,                                        d           |j-        r=|                    d|                                 d|j-        j        j.        d           | j/        rI|                    d|                                 d| j/                                        d           d S d S d S )Nr   FusedFunctionr!
  __pyx_FusedFunction_NewCythonFunction__Pyx_CyFunction_Newr  __Pyx_CYFUNCTION_STATICMETHOD__Pyx_CYFUNCTION_CLASSMETHOD__Pyx_CYFUNCTION_CCLASS__Pyx_CYFUNCTION_COROUTINEz | r  r  z(&r  rc  zpyclass_stack is emptyrI  zPyList_Append(r  z:if (!__Pyx_CyFunction_InitDefaults(%s, sizeof(%s), %d)) %s__Pyx_CyFunction_Defaults(r`  r  rL  z"__Pyx_CyFunction_SetDefaultsTuple(z#__Pyx_CyFunction_SetDefaultsKwDict(z#__Pyx_CyFunction_SetDefaultsGetter(z$__Pyx_CyFunction_SetAnnotationsDict()0r3
  r  is_specializationr   r   r	   r   r-
  r   is_staticmethodr  is_classmethodrT
  rc  r  r   is_anonymousis_coroutiner  r   r  r1
  r	  r`
  r	  r   r  r   r   r  requires_classobjpyclass_stackr  r   
class_cellr  rJ
  rM
  rr   rN
  r   r  r   r.
  r/
  rW
  r  r
  )
rY   r   r  rm  code_object_resultflags
class_noderJ
  r>  r   s
             rT   rb
  z(PyCFunctionNode.generate_cyfunction_code&  sG   " 	%.q1HH}H" 	1d&< 	1--'9KLLN N N3KK--'(8:LMMO O O0K 	(!%!1!;!;!=!=!'# 	9LL89999$ 	9LL7888,= 	4hnFa 	4LL2333  	7LL5666 	JJu%%EEE

$$$**40000((****$$T****$$$"""''tx@@@
B	C 	C 	C 	T"""% 	(%??'????+B/JOODNN,,n===JJJ)002222KKMMMM#$ $ $ !!$'''= 		,JJLKKMM4#7#<+T__TX-F-FPH HI I I I
 $)))4;;====:H"m , ,
U,,THHekk;+, , , , ,  	AJJJt2<<>>>>@ A A A& 	G # F


KKMMMM4#7#A#A#C#C#C#CE F F F' Q


KKMMMM8#;#A#N#N#NP Q Q Q$ G


KKMMMM4#8#B#B#D#D#D#DF G G G G G	G 	GG GrU   )r[   r\   r]   r   r-
  r2
  r  rJ
  rM
  rN
  r.
  r/
  r
  r   r   r   r3
  ro
  rd  r5
  r<  r7
  r?  re  r`
  r  rc
  rb
  rW   rU   rT   r,
  r,
  &  s       $ $ $H KGHHONODG5 5 [5  
H H HB   1K  1 1 1
# 
# 
#XG XG XG XG XGrU   r,
  c                       e Zd ZdZdZd ZdS )InnerFunctionNodeTc                 2    | j         rdt          j        z  S dS )Nz((PyObject*)%s)r  )needs_closure_coder   cur_scope_cnamerX   s    rT   r`
  z%InnerFunctionNode.closure_result_code)'  s     " 	>$v'===vrU   N)r[   r\   r]   r2
  r}
  r`
  rW   rU   rT   r{
  r{
  #'  s0         G    rU   r{
  c                   6    e Zd ZdgZdZdZd Zd ZddZd Z	dS )	r4
  varnamesFNc                     t                               | |j        |           t          |j                  }d |j        j        D             }t          |j        d ||z   D             dd          | _        d S )N)r  c                      g | ]}|j         	|S rW   r  rs  s     rT   r   z+CodeObjectNode.__init__.<locals>.<listcomp>='  s    RRRcRcRRRrU   c                 D    g | ]}t          |j        |j                   S )rr  )r   r   rr   rs  s     rT   r   z+CodeObjectNode.__init__.<locals>.<listcomp>@'  s9     0 0 0 'swch??? 0 0 0rU   r   r(   )r   r   r   )	r   r  r   r  r   rT
  rs  rO  r
  )rY   r  r   
local_varss       rT   r  zCodeObjectNode.__init__9'  s    $x@@@HM""RRX%9%ERRR
!L0 0!J.0 0 0  rU   c                     dS rw  rW   rX   s    rT   r?  zCodeObjectNode.may_be_noneE'  rn  rU   c                 b    | j         "|                    t          dd          | _         | j         S )Ncodeobjr5   r)  )r  r8  r   r  s     rT   r  z$CodeObjectNode.calculate_result_codeH'  s2    ##00Z[0\\DrU   c                     | j         "|                    t          dd          | _         |                    | j                   }|d S |                    | j                   | j        }|                    |j        dd|j                  }t          j
        |j        d                                                             d          d          }|                    |dd	          }d
dg}| j        j        r|                    d           | j        j        r|                    d           | j        j        r|                    d           nC| j        j        r|                    d           n!| j        j        r|                    d           |                    d| j         t)          |j                  |j        z
  |j        |j        t)          | j        j                  d                    |          pdt4          j        t4          j        t4          j        | j                                        t4          j        t4          j        ||| j        d         t4          j        |                    | j         | j                  fz             d S )Nr
  r5   r
  TFrK  r   utf8)rL  rM  CO_OPTIMIZEDCO_NEWLOCALS
CO_VARARGSCO_VARKEYWORDSCO_ASYNC_GENERATORCO_COROUTINECO_GENERATORzc%s = (PyObject*)__Pyx_PyCode_New(%d, %d, %d, %d, 0, %s, %s, %s, %s, %s, %s, %s, %s, %s, %d, %s); %s|r  r(   )r  r8  r   r;  r  r   r  r  rr   r   r	  get_filenametable_entryr:  r  r  r  is_asyncgenrs
  r(
  r   r   r   r  num_posonly_argsr
  r  r   empty_bytesr4	  r  r   )rY   r   r  	func_name	file_pathfile_path_constrx
  s          rT   r  z#CodeObjectNode.generate_result_codeM'  s^   ##00Z[0\\D//0@AA<Fdh},,I$uDI - O O	 #0!1T1T1V1V1]1]^d1e1egmnn	229W[2\\  0=! 	'LL&&&=% 	+LL)***=$ 	)LL-....]' 	)LL((((]' 	)LL(((

x	NNT11! "##HHUOO"sM  ""HQK##D$4dh??#|  	 	 	 	 	rU   rN   )
r[   r\   r]   r   r   r  r  r?  r  r  rW   rU   rT   r4
  r4
  /'  sh         |HGK
 
 
         
/ / / / /rU   r4
  c                   B     e Zd Zg ZdZdZ fdZd Zd Zd Z	d Z
 xZS )rC
  TFc                     t          t          |                               |           || _        |j        | _        | j        j        | _        d| _        d S rw  )rP   rC
  r  r>  r   r   	evaluated)rY   r   r>  rS   s      rT   r  zDefaultLiteralArgNode.__init__'  sJ    #T**33C888"2HM	rU   c                     | S rN   rW   r   s     rT   r<  z#DefaultLiteralArgNode.analyse_types'  rp  rU   c                     d S rN   rW   r  s     rT   r  z*DefaultLiteralArgNode.generate_result_code'  r   rU   c                 Z    | j         s#| j                            |           d| _         d S d S ry  )r
  r>  r  r  s     rT   r  z.DefaultLiteralArgNode.generate_evaluation_code'  s7    ~ 	"H--d333!DNNN	" 	"rU   c                 d    | j                             | j                                                  S rN   )r   r  r>  r  rX   s    rT   r  zDefaultLiteralArgNode.result'  s$    y""48??#4#4555rU   )r[   r\   r]   r   r   r   r  r<  r  r  r  r^   r_   s   @rT   rC
  rC
  '  s        
 HJG        " " "
6 6 6 6 6 6 6rU   rC
  c                   4     e Zd Zg Z fdZd Zd Zd Z xZS )DefaultNonLiteralArgNodec                 t    t          t          |                               |           || _        || _        d S rN   )rP   r
  r  r>  rM
  )rY   r   r>  rM
  rS   s       rT   r  z!DefaultNonLiteralArgNode.__init__'  s7    &--66s;;;.rU   c                 6    | j         j        | _        d| _        | S rw  )r>  r   r   r   s     rT   r<  z&DefaultNonLiteralArgNode.analyse_types'  s    HM	rU   c                     d S rN   rW   r  s     rT   r  z-DefaultNonLiteralArgNode.generate_result_code'  r   rU   c                     d| j         j        dt          j        d| j                             | j        j                  j        S )Nrn
  r  r  )rM
  rr   r   r)
  r-  r>  r   rX   s    rT   r  zDefaultNonLiteralArgNode.result'  sF      %%%v'8'8'8 ''66<<> 	>rU   )	r[   r\   r]   r   r  r<  r  r  r^   r_   s   @rT   r
  r
  '  sl         H/ / / / /
  
  > > > > > > >rU   r
  c                   *     e Zd Z fdZd fd	Z xZS )rP
  c                     g }|D ]<}|j         j        st          |||          }n|j         }|                    |           =t	          t
          |                               ||           d S )NrL  )rh   r   r
  r  rP   rP
  r  )rY   r   rJ
  rM
  r   r>  rS   s         rT   r  zDefaultsTupleNode.__init__'  s}     	 	C;) ".sCIIkKK&&//$/?????rU   Fc                 |    t          t          |                               ||                              |          S rN   )rP   rP
  r<  r   )rY   rs   r  rS   s      rT   r<  zDefaultsTupleNode.analyse_types'  s3    &--;;COObbcfgggrU   rP  r[   r\   r]   r  r<  r^   r_   s   @rT   rP
  rP
  '  se        @ @ @ @ @h h h h h h h h h hrU   rP
  c                        e Zd Z fdZ xZS )rQ
  c                 >   g }|D ]l}t          |j        |j                  }|j        j        st          |||          }n|j        }|                    t          |j        ||                     mt          t          |           
                    ||           d S )Nrr  r	  r	  )r   r   rr   rh   r   r
  r  rK  rP   rQ
  r  )rY   r   rJ
  rM
  rv  r>  rr   rS   s          rT   r  zDefaultsKwDictNode.__init__'  s     	E 	EC'sx@@@D;) ".sCIIkLLcg4sCCCDDDD $''00e0LLLLLrU   )r[   r\   r]   r  r^   r_   s   @rT   rQ
  rQ
  '  sA        	M 	M 	M 	M 	M 	M 	M 	M 	MrU   rQ
  c                   T     e Zd ZdgZ ej        d          Zd Z fdZ fdZ	 xZ
S )
LambdaNoder  z<lambda>c                 R   t          | d          rd S |                    d          x| _        | j        _        d| j        _        d| j        _        d| j        _        | j                            |           | j        j        j	        | _	        |
                    | j                   d S )Nlambda_namelambdaT)r  rG
  r
  r  no_assignment_synthesisrV
  is_cyfunctionrg  r   r1
  add_lambda_defr   s     rT   rg  zLambdaNode.analyse_declarations'  s    4'' 	F7:{{87L7LL4=404-+/(&*#**3///#}2B4=)))))rU   c                     | j                             |          | _         t          t          |                               |          S rN   )r  rB  rP   r
  r<  r  s     rT   r<  zLambdaNode.analyse_types'  s8    99#>>Z&&44S999rU   c                     | j                             |           t          t          |                               |           d S rN   )r  rc	  rP   r
  r  rY   r   rS   s     rT   r  zLambdaNode.generate_result_code'  s=    --d333j$44T:::::rU   )r[   r\   r]   r   r   r0  rr   rg  r<  r  r^   r_   s   @rT   r
  r
  '  s{         ,K'>'
33D
* 
* 
*: : : : :; ; ; ; ; ; ; ; ;rU   r
  c                   ~     e Zd Z ej        d          ZdZej        dgz   Zej	        dgz   Z	 fdZ
 fdZd Z xZS )GeneratorExpressionNodegenexprFcall_parametersc                 ^     t          t          |           j        |g|R i | g | _        d S rN   )rP   r
  r  r
  )rY   r   r   r  rS   s       rT   r  z GeneratorExpressionNode.__init__(  s?    5%t,,5cIDIIIDIII!rU   c                 4   t          | d          rd S |                    d          | _        t          t          |                               |           d| j        _        d| j        _        d| j        _	        t          j        | j        j        _        t          | j        t           j                  rCt          | j        j        t&                    sJ | j        j                            d |           d S t          | j        t           j                  sJ d S )Ngenexpr_namer
  F)r  rG
  r
  rP   r
  rg  r  rV
  rU
  r
  r1   pyfunction_noargsr   r  r   rV	  r   rZ	  r  r_  re  r[	  r  s     rT   rg  z,GeneratorExpressionNode.analyse_declarations(  s    4(( 	FKK	22%t,,AA#FFF+0(,1)&+#(1(C%di!566 	@di0.AAAAAI))$44444di)>???????rU   c                    |                                  gd | j        D             z   }d                    |          }|                    |                                 d| j        j        j        d|d|                    |                                 | j	                             | 
                    |           d S )Nc                 6    g | ]}|                                 S rW   r  )rc   cps     rT   r   z@GeneratorExpressionNode.generate_result_code.<locals>.<listcomp>!(  s     FFF""))++FFFrU   r  r  r
  rc  )r`
  r
  r  r   r  r  r   r  r   r   r  )rY   r   args_to_calls      rT   r  z,GeneratorExpressionNode.generate_result_code(  s    11334FF0DFFFGyy..

#000''tx@@@	B	C 	C 	C 	T"""""rU   )r[   r\   r]   r   r0  rr   r2
  r
  r   r   r  rg  r  r^   r_   s   @rT   r
  r
  '  s         (>'	22DG(,=+>>K"&7%88H" " " " "@ @ @ @ @&
# 
# 
# 
# 
# 
# 
#rU   r
  c                   J    e Zd ZdgZeZdZdZdZdZ	dZ
d Zd Zd Zd Zd	 Zd
S )YieldExprNoder>  r   Fyieldc                    | j         r| j        r$| j        rt          | j        d| j        z             d| _        | j        E| j                            |          | _        | j        j	        j
        s|                     |           | S )Nz'%s' not supported herer(   )	label_numis_yield_fromin_async_genr   r   expr_keywordr   r>  r<  r   rq   coerce_yield_argumentr   s     rT   r<  zYieldExprNode.analyse_types;(  s    ~ 	K$"4 	K9J 	K$(58IIJJJ8x--c22DH8=, 0**3///rU   c                 D    | j                             |          | _         d S rN   r>  r   r   s     rT   r
  z#YieldExprNode.coerce_yield_argumentE(  s    8..s33rU   c                    | j         r| j                             |           | j                             |           |                    t          j        d| j                             t                    d           | j                             |           | j         	                    |           n%|
                    t          j        t                     |                     |           d S Nr  r  )r>  r  r  r   r   r	  r  r   r  r  put_init_to_py_nonegenerate_yield_coder  s     rT   r  z&YieldExprNode.generate_evaluation_codeH(  s    8 
	JH--d333H))$///JJ'''H&&~666689 9 9 H224888H%%%%$$V%8.III  &&&&&rU   c           	         |                     | j                            dd                    \  }}|                    |           g }|j        j                                         |j                                        D ]\  }}}|j        j                            |          }|	                    |||f           |j
        r3|j                            t          j        dd                     d|z  }n|                    ||           |                    t"          j        d|d|d           |                    t"          j        t(                     |j        j        d	         }	|j        j        d
         }
|	s|
r,|                    t"          j        |j        j                    |                                 |j        j        #|                    dt"          j        z             n"|                    dt"          j        z             |                    d| j        rdndd| j        rdndd           |                    dt"          j        |fz             | j        r*| j        s#|                    dt"          j        z             n"|                    dt"          j        z             |                    |           |D ]\  }}}t"          j        d|}|j
        rd|z  }|                    |d|d           |j        r/|                    d|z             |                    ||           t|j         r|                    |d|d           | !                    |t"          j"                   | j#        r{| $                    |           |%                    | &                                dt"          j"        d           |'                    | &                                t(                     dS dS )z
        Generate the code to return the argument in 'Naming.retval_cname'
        and to continue at the yield label.
        r*  r  r  r  z__PYX_STD_MOVE_IF_SUPPORTED(%s)r  r  r  profile	linetrace)r   Nz"__Pyx_Coroutine_SwapException(%s);z+__Pyx_Coroutine_ResetAndClearException(%s);z/* return from zasync r  zgenerator, awaitr
  zing value */z%s->resume_label = %d;z,return __Pyx__PyAsyncGenValueWrapperNew(%s);z
return %s;r  z.memview = NULL; z.data = NULL;rW  )(new_yield_labelr
  replace	use_labelr  closure_tempsresettemps_in_user  r  r  r   r   r	   r   r  r   r   r~
  r	  r   rk   put_trace_returnr  put_finish_refcount_contextcurrent_exceptr*
  r
  is_awaitr  rq   r  r   !generate_sent_value_handling_codesent_value_cnamer  r  r  r  r  )rY   r   r
  
label_namesavedr   r   r  
save_cnamer
  r
  s              rT   r
  z!YieldExprNode.generate_yield_codeV(  s@   
 !% 4 4%%c3//!1 !1	:z"""$**,,,'+~'B'B'D'D 		U 		U#E45CCDIIJLL%T2333  / 11+,=?OPPR R R9EA!!%...JJ)?)?)?UUUSTTTT&-~>>>"-i8$/<	 	Fi 	F!!&"5,0N,D(D " F F F((***>(4JJ;f>TTUUUU JJDvG]]^^^


)1HHr11}1GG'113 	4 	4 	4 	

+"I// / 	0 	0 	0 	;T] 	;JJEH[[\\\\JJ|f&99:::z"""', 		\ 		\#E:t%+%;%;%;ZZHJ  L>K
JJUUUJJJ7888 \

9z1222  ----( \

:::zzzZ[[[..tV5LMMM 	;%%d+++HHDKKMMMM63J3J3JKLLLOODKKMM>:::::	; 	;rU   c                 b    |                     |                    || j                             d S rN   )r   r   r   rY   r   value_cnames      rT   r
  z/YieldExprNode.generate_sent_value_handling_code(  s,    

4**;AABBBBBrU   N)r[   r\   r]   r   r   r   r
  r
  r
  r
  r
  r<  r
  r  r
  r
  rW   rU   rT   r
  r
  ,(  s         wHDIMHLL  4 4 4' ' '?; ?; ?;BC C C C CrU   r
  c                   (    e Zd Zd ZddZd Zd ZdS )_YieldDelegationExprNodec                     t                      rN   )NotImplementedErrorr  s     rT   yield_from_funcz(_YieldDelegationExprNode.yield_from_func(  s    !###rU   NFc           
         || j                             |           |                    t          j        d|                     |          dt          j        d|| j                                         n|d           |5| j                             |           | j         	                    |           n|r|
                    |t                     |                    t          j        t                     |                    dt          j        z             |                     |           |                    d           | j        r|                     |           n|                     |           |                    d           d S )Nr  r
  r  r  r  r  r   )r>  r  r   r   r	  r
  r*
  r   r  r  r  r   r  r
  r  fetch_iteration_resulthandle_iteration_exception)rY   r   r  r  s       rT   r  z1_YieldDelegationExprNode.generate_evaluation_code(  s   H--d333

  &&&&"""$0$8DH   lJJ	L 	M 	M 	M
 H++D111H%%%% 	@!!,???,n===

&)<<===  &&&

: 	2''----++D111

3rU   c                     |                     d|                                 z             |                    | j        d|                                 z             |                     |           d S )Nr  z(__Pyx_PyGen_FetchStopIterationValue(&%s))r   r  r<  r   r  r  s     rT   r
  z/_YieldDelegationExprNode.fetch_iteration_result(  sf    

<$++--/000dh(RUYU`U`UbUb(bcccT"""""rU   c                    |                     d           |                     d           |                     d           |                     d|                    | j                  z             |                     d           d S )N8PyObject* exc_type = __Pyx_PyErr_CurrentExceptionType();r  zif (likely(exc_type == PyExc_StopIteration || (exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))) PyErr_Clear();r  r   )r   r   r   r  s     rT   r
  z3_YieldDelegationExprNode.handle_iteration_exception(  s    

MNNN

$%%%

 i 	j 	j 	j

9ttx888999

3rU   rw  )r[   r\   r]   r
  r  r
  r
  rW   rU   rT   r
  r
  (  sU        $ $ $   2# # #    rU   r
  c                   "    e Zd ZdZdZd Zd ZdS )YieldFromExprNodeTz
yield fromc                     | j         j        j        st          | j        d           | j                             |          | _         d S )Nz-yielding from non-Python object not supported)r>  r   r  r   r   r   r   s     rT   r
  z'YieldFromExprNode.coerce_yield_argument(  s@    x}& 	M$(KLLL8..s33rU   c                 `    |j                             t          j        dd                     dS )NGeneratorYieldFromr  __Pyx_Generator_Yield_Fromr   r   r	   r   r  s     rT   r
  z!YieldFromExprNode.yield_from_func(  .    ))+*ABVXe*f*fggg++rU   N)r[   r\   r]   r
  r
  r
  r
  rW   rU   rT   r
  r
  (  s<        ML4 4 4, , , , ,rU   r
  c                   "    e Zd ZdZdZd Zd ZdS )AwaitExprNodeTr
  c                 V    | j         !| j                             |          | _         d S d S rN   r
  r   s     rT   r
  z#AwaitExprNode.coerce_yield_argument(  s-    8x22377DHHH  rU   c                 `    |j                             t          j        dd                     dS )NCoroutineYieldFromr  __Pyx_Coroutine_Yield_Fromr
  r  s     rT   r
  zAwaitExprNode.yield_from_func(  r
  rU   N)r[   r\   r]   r
  r
  r
  r
  rW   rU   rT   r
  r
  (  s>         HL8 8 8
, , , , ,rU   r
  c                   *     e Zd Zd Z fdZd Z xZS )AwaitIterNextExprNodec                 2   |j                             t          j        dd                     |                    d           |                    d           |                    d           |                    d           |                    d           d S )NStopAsyncIterationr  r
  zif (unlikely(exc_type && (exc_type == __Pyx_PyExc_StopAsyncIteration || ( exc_type != PyExc_StopIteration && exc_type != PyExc_GeneratorExit && __Pyx_PyErr_GivenExceptionMatches(exc_type, __Pyx_PyExc_StopAsyncIteration))))) {r  r  r   )r   r   r	   r   r   r  s     rT   _generate_breakz%AwaitIterNextExprNode._generate_break(  s    ))+*ABVXe*f*fggg

MNNN

 h 	i 	i 	i 	

#$$$

8

3rU   c                     |j         s
J d            |                     |           t          t          |                               |           d S )N1AwaitIterNextExprNode outside of 'async for' loop)break_labelr  rP   r  r
  r
  s     rT   r
  z,AwaitIterNextExprNode.fetch_iteration_result(  sT    TT!TTTTT"""#T**AA$GGGGGrU   c                    |j         s
J d            |                    d|z             |                     |           |                    |                    | j                             |                    d           d S )Nr  r  r   )r	  r   r  r   r   r
  s      rT   r
  z7AwaitIterNextExprNode.generate_sent_value_handling_code(  sy    TT!TTTT

)K7888T"""

4??48,,---

3rU   )r[   r\   r]   r  r
  r
  r^   r_   s   @rT   r  r  (  s[        
  H H H H H
      rU   r  c                   ,    e Zd ZeZdZd ZdZd Zd Z	dS )GlobalsExprNoder(   c                 D    |                     t          j                   | S rN   )r   r   globals_utility_coder   s     rT   r<  zGlobalsExprNode.analyse_types)  s    W9:::rU   zConstructing globals dictc                     dS rw  rW   rX   s    rT   r?  zGlobalsExprNode.may_be_none)  rn  rU   c                     |                     |                                 d|                    |                                 | j                             |                     |           d S )Nz = __Pyx_Globals(); )r   r  r   r   r  r  s     rT   r  z$GlobalsExprNode.generate_result_code)  sh    

KKMMMM##DKKMM48<<<> 	? 	? 	? 	T"""""rU   N)
r[   r\   r]   r   r   r   r<  re  r?  r  rW   rU   rT   r  r  )  sR        DG   .K  # # # # #rU   r  c                       e Zd Zd ZdS )LocalsDictItemNodec                 L   | j                             |          | _         | j                            |          | _        | j                             |          | _         | j        j                            |          r | j                            |          | _        nd | _        | S rN   )rG  r<  r   r   r   r  r   s     rT   r<  z LocalsDictItemNode.analyse_types)  s    8))#..Z--c22
8..s33:?11#66 	66s;;DJJDJrU   N)r[   r\   r]   r<  rW   rU   rT   r  r  )  s#            rU   r  c                   $     e Zd Zd Z fdZ xZS )FuncLocalsExprNodec                     t          d |j                                        D                       }fd|D             }t                              | |d           d S )Nc                 *    g | ]}|j         	|j         S rW   r  r	  s     rT   r   z/FuncLocalsExprNode.__init__.<locals>.<listcomp>))  s8     H H H EJHJH H HrU   c                 r    g | ]3}t          t          |           t          |d                    4S )rr  T)rr   r  r	  )r  r   r  )rc   r  r   s     rT   r   z/FuncLocalsExprNode.__init__.<locals>.<listcomp>+)  s_     ( ( (  $)#S9993ST:::< < < ( ( (rU   T)rL  r	  )rt  ru  r?  rM  r  )rY   r   rs   r
  rv  s    `   rT   r  zFuncLocalsExprNode.__init__()  s     H H$'K$6$6$8$8H H H I I
( ( ( ( '( ( ( 	$U.2 	 	4 	4 	4 	4 	4rU   c                     t          t          |                               |          }d |j        D             |_        |S )Nc                      g | ]}|j         	|S rN   rr  )rc   rT  s     rT   r   z4FuncLocalsExprNode.analyse_types.<locals>.<listcomp>4)  s)      :  :  :q$%G$7 "#$7$7$7rU   )rP   r  r<  rL  )rY   rs   r   rS   s      rT   r<  z FuncLocalsExprNode.analyse_types2)  sI    '..<<SAA :  :D,@  :  :  :rU   r
  r_   s   @rT   r  r  ')  sG        4 4 4        rU   r  c                   ,    e Zd Zd Zd Zd Zd Zd ZdS )PyClassLocalsExprNodec                 J    t                               | |           || _        d S rN   )rf  r  pyclass_dict)rY   r   r  s      rT   r  zPyClassLocalsExprNode.__init__:)  s&    c***(rU   c                 6    | j         j        | _        d| _        | S rw  )r  r   r   r   s     rT   r<  z#PyClassLocalsExprNode.analyse_types>)  s    %*	rU   c                     dS rw  rW   rX   s    rT   r?  z!PyClassLocalsExprNode.may_be_noneC)  rn  rU   c                 4    | j                                         S rN   )r  r  rX   s    rT   r  zPyClassLocalsExprNode.resultF)  s     '')))rU   c                     d S rN   rW   r  s     rT   r  z*PyClassLocalsExprNode.generate_result_codeI)  r   rU   N)r[   r\   r]   r  r<  r?  r  r  rW   rU   rT   r  r  9)  s_        ) ) )  
  * * *    rU   r  c                     |j         rt          |           S |j        rt          | |j                  S t          | |          S rN   )r  r  r  r  r  r  )r   
scope_noders   s      rT   LocalsExprNoder%  M)  sH    
 $s###
 ;$S*/:::c3'''rU   )not~r  r   c                   ~    e Zd Z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dZdS )UnopNoderb  TFc                 ^    t           | j                 } || j        j                  | _        d S rN   )compile_time_unary_operatorsr   rb  r   rY   r  s     rT   r(  z"UnopNode.calculate_constant_resultr)  s+    +DM:#tDL$@AArU   c                 $   t                               | j                  }|st          | j        d| j        z             | j                            |          }	  ||          S # t          $ r }|                     |           Y d }~d S d }~ww xY w)Nz3Unary '%s' not supported in compile-time expression)	r+  rj   r   r   r   rb  r2  r  r6  )rY   r1  r  rb  r5  s        rT   r2  zUnopNode.compile_time_valuev)  s    +//>> 	%$(Em$% % % ,11$77	-4==  	- 	- 	-))!,,,,,,,,,	-s   
A% %
B/B

Bc                     | j                             |          }|j        s|j        r|                    | j                  }||S |                     ||          S rN   )rb  r   r  r  find_cpp_operation_typer   infer_unop_type)rY   rs   operand_typecpp_types       rT   r   zUnopNode.infer_type)  sb    |..s33$ 	 (; 	 #;;DMJJH###C666rU   c                 "    |j         rt          S |S rN   )rq   r   rY   rs   r1  s      rT   r0  zUnopNode.infer_unop_type)  s    # 	 !!rU   c                     | j         j        r&| j         j        j        r| j         j        t          urdS t                              |           S rw  )rb  r   r|  r   r   r?  rX   s    rT   r?  zUnopNode.may_be_none)  sG    < 	!2!B 	| 	11u##D)))rU   c                    | j                             |          | _         |                     |          r9t          t	          | j        | j         j                            | _        d| _        n||                                 r)| 	                    |           t          | _        d| _        n?|                                 r|                     |           n|                     |           | S rl  )rb  r<  is_pythran_operationrH   r?   r   r   r   is_py_operationcoerce_operand_to_pyobjectr   is_cpp_operationanalyse_cpp_operationanalyse_c_operationr   s     rT   r<  zUnopNode.analyse_types)  s    |11#66$$S)) 
	*#$8HY$Z$Z[[DIDLL!!## 	*++C000&DIDLL""$$ 	*&&s++++$$S)))rU   c                 4    | j                                         S rN   rb  r=  rX   s    rT   r=  zUnopNode.check_const)      |'')))rU   c                 F    | j         j        j        p| j         j        j        S rN   )rb  r   rq   r1  rX   s    rT   r8  zUnopNode.is_py_operation)  s    | ,K0A0KKrU   c                 X    t          |          }| j        j        }|o|j        p|j        S rN   )r@   rb  r   r  r<   )rY   rs   
np_pythranop_types       rT   r7  zUnopNode.is_pythran_operation)  s/    #C((
,#Lw0KG4KLrU   c                 Z    |                                  r|                                  d S d S rN   r8  rr  r   s     rT   rs  zUnopNode.nogil_check)  6    !! 	NN	 	rU   c                 (    | j         j        }|j        S rN   )rb  r   r  r!  s     rT   r:  zUnopNode.is_cpp_operation)  s    |   rU   c                 D    | j                             |          | _         d S rN   )rb  r   r   s     rT   r9  z#UnopNode.coerce_operand_to_pyobject)  s    |66s;;rU   c           
         | j         j        r|                    d           |                    d|                                 z             |                    d|                                 d|                                 d| j        | j                                        d           d S | j        j         j        r|                     |           d S | j	        r| 
                                r| j        dk    r|t          || j        |                                 d| j        d	| j                                        d
| j         j        r|                                 nd | j        | j                   d S |                    |                                 d| j        d	| j                                        d
           d S d S )Nz// Pythran unaryoprl  r  r  r  r  r   r  r*  r  )r   r<   r   r  r   rb  r  rq   generate_py_operation_coder   r:  r   r   r   r   r  r  s     rT   r  zUnopNode.generate_result_code)  s   9$ 	bJJ+,,,JJ3dkkmmCDDDJJJ++----	/ 0 0 0 0 0
 \* 		b++D11111\ 	b$$&& b4+?3+F+F'dh%)[[]]]]DMMM4<CVCVCXCXCXCXY%)Y%:DDKKMMM($*?A A A A A
 

DKKMMMM4===$,J]J]J_J_J_J_`aaaaa	b 	brU   c                 B   |                      |          }|                    |                                 d|d| j                                        d|                    |                                 | j                             |                     |           d S )Nr  r
  rc  )py_operation_functionr   r  rb  r   r   r   r  rp	  s      rT   rJ  z#UnopNode.generate_py_operation_code)  s    --d33

&&((((''tx@@@	B	C 	C 	C 	T"""""rU   c                     | j         j        j        s+t          | j        d| j        d| j         j        d           t          j        | _        d S )NzInvalid operand type for '' (r`  )rb  r   r  r   r   r   r   r/   rX   s    rT   
type_errorzUnopNode.type_error)  sS    | ) 	4$(( 1 1 13 4 4 4)			rU   c                 :   | j         j        g}| j        r&| j        s|                    t
          j                   |                    | j        | j	        |          }|r|s| 
                                 d S |rl|j        j        | _        |j        j        | _        | j        dk    r>d| _        t          |           r(|                    t!          j        dd                     nd| _        d| _        | j        r8| j        s1| j         j                            | j	        t
          j                  }n$| j         j                            | j	                  }|r=|;t'          | j        d| j	        dt                     | 
                                 d S || _        d S )	Nr   Tr  r  r  )r1  r  z' operator not defined for )rb  r   is_inc_dec_op	is_prefixr  r   r  r  r   r   rO  r   r   r   r   r   r	   r   r/  r   )rY   rs   overload_checkoperand_typesr   r2  s         rT   r;  zUnopNode.analyse_cpp_operation)  s   *+ 	8dn 	8  !6777--dh}UU 	% 	OOF 		&#(:#=D #(:#=D #s**#1$77 n(()@AY[k)l)lmmm#%D #%D  	Pdn 	P|(@@J,A A  HH |(@@OOH 	h.$((tt% & & &OOF			rU   Nr>  )r[   r\   r]   r   infixrQ  r(  r2  r   r0  r?  r<  r=  r8  r7  rs  r:  r9  r  rJ  rO  r;  rW   rU   rT   r)  r)  b)  s(        {HEMB B B
- 
- 
-7 7 7     * * *  * * *L L LM M M
  ! ! !< < <b b b(# # #* * *     rU   r)  c                   >    e Zd ZdZej        Zd Zd Zd Z	d Z
d ZdS )NotNode!c                 *    | j         j         | _        d S rN   )rb  r   rX   s    rT   r(  z!NotNode.calculate_constant_result*  s    #'<#??rU   c                     | j                             |          }	 | S # t          $ r }|                     |           Y d }~d S d }~ww xY wrN   )rb  r2  r  r6  )rY   r1  rb  r5  s       rT   r2  zNotNode.compile_time_value
*  si    ,11$77	-; 	- 	- 	-))!,,,,,,,,,	-s    
A	AA	c                     t           j        S rN   )r   r)  r4  s      rT   r0  zNotNode.infer_unop_type*  s    %%rU   c                     | j                             |          | _         | j         j        }|j        r|                     |           n| j                             |          | _         | S rN   )rb  r<  r   r  r;  rG  r4  s      rT   r<  zNotNode.analyse_types*  sa    |11#66|($ 	?&&s++++<99#>>DLrU   c                 :    d| j                                         z  S )Nz(!%s)rb  r  rX   s    rT   r  zNotNode.calculate_result_code*      ,,....rU   N)r[   r\   r]   r   r   r)  r   r(  r2  r0  r<  r  rW   rU   rT   rW  rW  )  sq         H!D@ @ @- - -& & &  / / / / /rU   rW  c                   $    e Zd ZdZd Zd Zd ZdS )UnaryPlusNoder   c                 b    t          j        | j        j        t           j                  | _        d S rN   )r   r  rb  r   r  r   s     rT   r<  z!UnaryPlusNode.analyse_c_operation&*  s'    2Lz46 6			rU   c                     dS )NPyNumber_PositiverW   r  s     rT   rL  z#UnaryPlusNode.py_operation_function**      ""rU   c                     |                                  rd| j                                        z  S | j                                        S )Nz(+%s))r:  rb  r  rX   s    rT   r  z#UnaryPlusNode.calculate_result_code-*  sC      "" 	)T\002222<&&(((rU   N)r[   r\   r]   r   r<  rL  r  rW   rU   rT   ra  ra  !*  sH         H6 6 6# # #) ) ) ) )rU   ra  c                   *    e Zd ZdZd Zd Zd Zd ZdS )UnaryMinusNoder  c                    | j         j        j        r/t          j        | j         j        t          j                  | _        n7| j         j        j        rt          j        | _        n|                                  | j        j        r	d| _	        d S d S rw  )
rb  r   r  r   r  r  r(  rO  r  rU  r   s     rT   r<  z"UnaryMinusNode.analyse_c_operation9*  s    <' 	"6!:#8: :DII\& 	"-DIIOO9 	DJJJ	 	rU   c                     dS )NPyNumber_NegativerW   r  s     rT   rL  z$UnaryMinusNode.py_operation_functionD*  re  rU   c                     | j         rd| j                                        z  S | j        j                            d          d| j                                        dS )N(-%s)r  r
  r`  )rU  rb  r  r   unary_oprX   s    rT   r  z$UnaryMinusNode.calculate_result_codeG*  s^    : 	WT\002222#|099#>>>>@S@S@U@U@U@UVVrU   c                 F    | j                                         }|rd|z  S d S )Nrm  )rb  r&  )rY   r   s     rT   r&  z)UnaryMinusNode.get_constant_c_result_codeM*  s1    7799 	#U?"	# 	#rU   N)r[   r\   r]   r   r<  rL  r  r&  rW   rU   rT   rh  rh  4*  sZ         H	 	 	# # #W W W# # # # #rU   rh  c                        e Zd Zd Zd Zd ZdS )	TildeNodec                     | j         j        j        r0t          j        | j         j        t          j                  | _        d S | j         j        j        rt          j        | _        d S |                                  d S rN   )rb  r   r  r   r  r  r(  rO  r   s     rT   r<  zTildeNode.analyse_c_operationU*  sk    <# 	"6!:#8: :DIII\& 	"-DIIIOOrU   c                     dS )NPyNumber_InvertrW   r  s     rT   rL  zTildeNode.py_operation_function^*  s      rU   c                 :    d| j                                         z  S )Nz(~%s)r^  rX   s    rT   r  zTildeNode.calculate_result_codea*  r_  rU   N)r[   r\   r]   r<  rL  r  rW   rU   rT   rq  rq  R*  sA          ! ! !/ / / / /rU   rq  c                       e Zd Zd ZdS )	CUnopNodec                     dS rw  rW   rX   s    rT   r8  zCUnopNode.is_py_operationg*  rn  rU   N)r[   r\   r]   r8  rW   rU   rT   rw  rw  e*  s#            rU   rw  c                   $    e Zd ZdZd Zd Zd ZdS )DereferenceNoder   c                 6    |j         r|j        S t          j        S rN   )r  r  r   r/   r4  s      rT   r0  zDereferenceNode.infer_unop_typeo*  s     	)))((rU   c                     | j         j        j        rI|j        r*t	          j        | j         j        j                  | _        d S | j         j        j        | _        d S |                                  d S rN   )rb  r   r  is_cppr   r  r  rO  r   s     rT   r<  z#DereferenceNode.analyse_c_operationu*  sc    <# 	z 8&5dl6G6QRR			 L-7			OOrU   c                 :    d| j                                         z  S rR  r^  rX   s    rT   r  z%DereferenceNode.calculate_result_code~*  r_  rU   N)r[   r\   r]   r   r0  r<  r  rW   rU   rT   rz  rz  j*  sH         H) ) )  / / / / /rU   rz  c                   $    e Zd ZdZd Zd Zd ZdS )DecrementIncrementNodeTc           
         | j         j        j        sf| j        r,t	          | j        d| j        d| j         j        d           n3t	          | j        d| j        d| j        d| j         j        d           t          j        | _        d S )NzNo match for 'operatorz' (operand type is 'z')zNo 'operatorz(int)' declared for postfix ')	rb  r   r  rR  r   r   r   r   r/   rX   s    rT   rO  z!DecrementIncrementNode.type_error*  s    | ) 	G~ Gdhh]]]DL$5$5$5!7 8 8 8 8 dhh]]]DMMM4<3D3D3D!F G G G)			rU   c                     | j         j        j        r0t          j        | j         j        t          j                  | _        d S | j         j        j        r| j         j        | _        d S |                                  d S rN   )rb  r   r  r   r  r  r  rO  r   s     rT   r<  z*DecrementIncrementNode.analyse_c_operation*  sm    <' 	"6!:#8: :DIII\% 	)DIIIOOrU   c                     | j         r$d| j        | j                                        dS d| j                                        | j        dS )Nr
  r`  )rR  r   rb  r  rX   s    rT   r  z,DecrementIncrementNode.calculate_result_code*  s`    > 	E 	E#}}dl.A.A.C.C.C.CDD	E  $|22444dmmmDDrU   N)r[   r\   r]   rQ  rO  r<  r  rW   rU   rT   r  r  *  sK        M* * *  E E E E ErU   r  c                       fdS )Nc                 $    t          | fd|S )NrR  r   )r  )r   r  rR  r   s     rT   <lambda>z%inc_dec_constructor.<locals>.<lambda>*  s!    5cjYYajjeijj rU   rW   r  s   ``rT   inc_dec_constructorr  *  s    jjjjjjrU   c                   6    e Zd ZdZd Zd Zd Zd Zd Zd Z	dS )	AmpersandNoder  c                 *    t          j        |          S rN   )r   
c_ptr_typer4  s      rT   r0  zAmpersandNode.infer_unop_type*  s    $\222rU   c                 P   | j                             |          | _         | j         j        }|j        r|                     |d           |j        sW|j        sP| j                                         s7|j        r| 	                    d           n| 	                    d|z             | S |j
        rP| 	                    d| j         j        rd| j         j        z  n| j         j        rd| j         j        z  ndz             | S |j        r| j        st          j        |          | _        | S )	NF)rS  z'Cannot take address of memoryview slicez&Taking address of non-lvalue (type %s)z Cannot take address of Python %szvariable '%s'zobject attribute '%s'r  )rb  r<  r   r  r;  rU  r  r   r   r   rq   r   rr   rZ  r$  r   r  )rY   rs   argtypes      rT   r<  zAmpersandNode.analyse_types*  sH   |11#66,# 	B&&s5&AAA$ 	(< 	@[@[@]@] 	) O

DEEEE

CgMNNNK 	JJ97;|7K $,"333DHLD] '$,*@@@    K# 	749 	7"-g66DIrU   c                 4    | j                                         S rN   )rb  r|  rX   s    rT   r=  zAmpersandNode.check_const*  s    |,,...rU   c                 `    t          | j        |           t          j        | _        d| _        d S Nr  r   r   r   r/   r   r  rY   messs     rT   r   zAmpersandNode.error*  ,    dh)	$rU   c                 :    d| j                                         z  S )Nz(&%s)r^  rX   s    rT   r  z#AmpersandNode.calculate_result_code*  r_  rU   c           
      :   | j         j        j        r| j        dk    r~t	          || j        |                                 d| j        d| j                                         d| j        j        r|                                 nd | j	        | j
                   d S d S d S )Nr   r  r*  r  )rb  r   r  r   r   r   r  r   rq   r   r  r  s     rT   r  z"AmpersandNode.generate_result_code*  s    L* 	=t/Cs/J/J#D$(!%t|?R?R?T?T?T?TU!%!6@D$d&;= = = = =	= 	=/J/JrU   N)
r[   r\   r]   r   r0  r<  r=  r   r  r  rW   rU   rT   r  r  *  su         H3 3 3  */ / /% % %
/ / /= = = = =rU   r  )r   r  r'  c                 v   t          |t                    rM|dk    rGt          |j        t          t	          j        |j                             |j        |j                  S t          |t                    r+|j
        |cxk    rdv rn nt          | d|fdz  z  d           t          |         | ||          S )Nr  )r   r   r  r  z+-zAPython has no increment/decrement operator: %s%sx == %s(%sx) == x      )r   rb  )r   r]  r   rx   r   r  r   r  r  r)  r   r   unop_node_classes)r   r   rb  s      rT   	unop_noder  *  s     '7## oCW[#u7J7=7Y7Y6Y2Z2Z ' 07;KM M M 	M	GX	&	& o7+;x+O+O+O+O4+O+O+O+O+OX]e\ghi\ijlmnnnX&s   rU   c                   p    e Zd ZdgZdxZxZZd Zd Zd Z	d Z
d Zd Zd	 Zd
 Zd ZddZd Zd Zd ZdS )rG	  rb  Nc                     dS rw  rW   r   s     rT   rO  zTypecastNode.type_dependencies*  r$  rU   c                     | j         =| j                            |          }| j                            ||          \  }| _         | j         S rN   )r   r  r  
declarator)rY   rs   r  r  s       rT   r   zTypecastNode.infer_type*  sD    9..s33I?229cBBLAtyyrU   c                 	   | j         =| j                            |          }| j                            ||          \  }| _         | j                                        r|                                  | j         j        r&t          | j	        d           t          j        | _         | j                            |          | _        | j         t          j        u r| j                            |          S | j         j        }| j        j         j        }|rH|sF| j                                        r-| j         j        s!| j         j        st          | j	        d           |r(|s%| j         t&          u r&| j        j         j        rt+          | j        |          S | j        j                             |          r3t.          | _        | j                            | j         |          | _        n6| j        j         j        rB| j        j         j        j        s+| j        j         j        j        st          | j	        d           n+t;          | j	        d| j        j         d| j         d           | j                            |          | _        n|r|s| j                             |          r'| j                            | j         |          | _        nR| j         j        r9| j         j        j        s&| j         j        j        st          | j	        d           nt;          | j	        d| j         d| j        j         d           n|rl|rj| j         r#tC          | j        | j         |d	          | _        ntE          | j        tF                    r%| j                            | j         |          | _        ns| j         j$        r1| j        j         j$        r | j                            |          | _        n6| j        j         j%        r%| j                            | j         |          | _        | j         j        r`| j         j        j        rO| j         j        j&        r>| j        j         }|j        r|j        }|j        r|j&        st;          | j	        d
d           | S )NzCannot cast to a function typez>Casting temporary Python object to non-numeric non-Python typez>Python objects cannot be cast from pointers of primitive typeszNo conversion from z to z, python object pointer used.z<Python objects cannot be cast to pointers of primitive typesT)notnonezQCasting a GIL-requiring function into a nogil function circumvents GIL validationr(   )'r   r  r  r  rb  r   r(  rU  r   r   r   r/   r<  r)  rG  rq   r   r  r  r   r  r  r  r   r$  r  r  r  r{  r   rK  create_from_py_utility_code	typecheckr  r   r  r  rg  r   )rY   rs   r  r  to_pyfrom_pyrC  s          rT   r<  zTypecastNode.analyse_types*  sg   9..s33I?229cBBLAty<++-- 	-**,,,9! 	.$(02 2 2"-DI|11#669
...<11#666	%,#/ 	b5 	bT\%>%>%@%@ 	b9' b	0F bdh `aaa !	B !	ByJ&&4<+<+C&+DL#>>>"99#>> B$2!#|55diEE<$+ 7 L-7? j4<CTC^Ch jdh(hiii DHH)))4999'6 7 7 7#|<<SAA 	BU 	By44S99 3#|55diEE! 3	+3 dty7J7T d$($bcccIIIt|000#2 3 3 3 3 		B 		B~ F-dlDIsTXYYYDL.99 F#|55diEEY! 	Bdl&7&B 	B<88==DLL\' 	B<11$)SAADL9 	p	 3 @ 	pTYEXE^ 	pl'G~ ,!+# pGM pkmnp p prU   c                 4    | j                                         S rN   )rb  r;  rX   s    rT   r;  zTypecastNode.is_simple>+  s    |%%'''rU   c                 4    | j                                         S rN   )rb  r   rX   s    rT   r   zTypecastNode.is_ephemeralB+  s    |((***rU   c                 B    | j         p| j                                        S rN   )r   rb  rV  rX   s    rT   rV  z!TypecastNode.nonlocally_immutableF+  s    |Bt|@@BBBrU   c                 n    | j         r)| j         j        r| j        r|                                  d S d S d S d S rN   )r   rq   r   rr  r   s     rT   rs  zTypecastNode.nogil_checkI+  sU    9 	. 	4< 	NN	 	 	 	 	 	rU   c                 4    | j                                         S rN   r>  rX   s    rT   r=  zTypecastNode.check_constM+  r?  rU   c                 N    |                      | j        j                  | _        d S rN   )r  rb  r   rX   s    rT   r(  z&TypecastNode.calculate_constant_resultP+  s#    #99$,:VWWrU   c                 6   || j                                         }| j        j        r| j                                         }| j         j        j        ry| j        j                            | j         j                            |                    }| j        j                            | j         j                            |                    }n!| j        j                            |          }d}| j        j        d|d|dS | j                            |          S Nr  r
  r  r`  )	rb  r  r   r  	real_typer  	real_code	imag_codera  )rY   operand_result	real_part	imag_parts       rT   r  z"TypecastNode.calculate_result_codeS+  s   !!\0022N9 	7!\0022N| +   I/99L%//??A A	 I/99L%//??A A		 !I/99.II		I(((IIII 
 9&&~666rU   c                 p    | j                                         }|r| j                            |          S d S rN   )rb  r&  r   r  )rY   r  s     rT   r&  z'TypecastNode.get_constant_c_result_codeg+  s=    @@BB 	79&&~666	7 	7rU   c                     | j         j        r!| j        s| j                            |          S t
                              | |          S rN   )r   rq   r   rb  r  r   r!  s     rT   r  zTypecastNode.result_asl+  sD    9  	2 	2<))$///%%dD111rU   c                    | j         r|                    |                                 d| j                                        d           |                    |                                 |                                            d S d S )Nz = (PyObject *)r  )r   r   r  rb  r  r   r  s     rT   r  z!TypecastNode.generate_result_codes+  s    < 	9JJKKMMMML''))))+, , , OODKKMM4::<<88888	9 	9rU   rN   )r[   r\   r]   r   r  r  r   rO  r   r<  r;  r   rV  rs  r=  r(  r  r&  r  r  rW   rU   rT   rG	  rG	  *  s         {H$((I(
T    > > >@( ( (+ + +C C C  * * *X X X7 7 7 7(7 7 7
2 2 29 9 9 9 9rU   rG	  zStart may not be givenz'Stop must be provided to indicate shapezVStrides may only be given to indicate contiguity. Consider slicing it after conversionz2Can only create cython.array from pointer or arrayz7Pointer base type does not match cython.array base typec                   l    e Zd ZdZddgZdZdZdZdZe	j
        Zd Zd Zd	 Zd
 Zd Zed             ZdS )r  an  
    Used when a pointer of base_type is cast to a memoryviewslice with that
    base type. i.e.

        <int[:M:1, :N]> p

    creates a fortran-contiguous cython.array.

    We leave the type set to object so coercions to object are more efficient
    and less work. Acquiring a memoryviewslice from this will be just as
    efficient. ExprNode.coerce_to() will do the additional typecheck on
    self.compile_time_type

    This also handles <int[:, :]> my_c_array


    operand             ExprNode                 the thing we're casting
    base_type_node      MemoryViewSliceTypeNode  the cast expression node
    rb  shapesNTcc                 	   ddl m} | j                            |          | _        | j        r| j        }n| j        j                            |          }| j        j        }t          | _	        g | _
        t          |          }| j        j	        }| j        j	        j        s2| j        j	        j        s!t          | j        j        t                      | S g }|j        r0|j        r(|                    |j                   |j        }|j        (n)|j        r|j        }nt          | j        d|z             | S |                    |          s(|j        s!t          | j        j        t,                     | S | j        j	        j        rAt          |          |k    r.t          | j        j        d|t          |          fz             | S t/          |          D ]\  }}	|	j        j        s#t          |	j        j        t4                     | c S |	j        j        r]|r=||         }
t9          | j        t;          |
          |
t<          j                  |	_        nt          |	j        t@                     | c S |	j                            |          |	_        |	j        !                    | j"        |          }|j#        s|$                    |           | j
                            |           |d|dz
  fv }|	j%        j        s|r|	j%                            |          |	_%        |	j%        j	        j&        s;|	j%        j#        r/|	j%        j	        j'        st          |	j%        j        d           | c S |	j%        (                    |          dk    r#t          |	j%        j        tR                     | c S |dk    rd| _*        |	j%        j        s%|s#t          |	j%        j        tR                     | c S | j        j+        s| j        $                    |          | _        d	gt          |          z  }| j*        dk    rd
|d<   nd
|d<   t=          j,        ||          | _-        | j-        .                    | j                   | /                    |          | _	        |0                    |           |1                    |j2                   | S )Nr(   r  zunexpected base type %s foundz/Expected %d dimensions, array has %d dimensionsrX  r   zExpected an integer literalfortran)rw  follow)rw  contigrI  )3r  r  rb  r<  array_dtypebase_type_noder  r  r/   r   r  r   r  rT  r   r   ERR_NOT_POINTERr  r8  r  r  r  ERR_BASE_TYPErL  r   r  	ERR_STARTr   r]  rx   r   r  ERR_NOT_STOPr  
shape_typer   r9  r   r  r  r2  	ERR_STEPSmoder   r  r  validate_memslice_dtypeget_cython_array_typeuse_cython_array_utility_coder   typeinfo_to_format_code)rY   rs   r  r  r  r  r  array_dimension_sizesaxis_noaxisdimsizeshapefirst_or_lasts                rT   r<  zCythonArrayNode.analyse_types+  s         |11#66 	J*KK-<DDSIIK"'	4yy L%	| ' 	0A0J 	$,"O444K !# 	$ 0%,,Y^<<<%/	 $ 0  	!+II$(;iGHHHK!!+.. 	)2C 	$,"M222K\' 	C0E,F,F$,N,N$,"C-137L3M3M,NOP P P K
 't__ )	 )	MGT:% djni000y   (  3G<G 'G8?-7-B!D !D !DDII $(L111KKK	//44DII''==E# *$$S)))Ku%%%#4!8}4M9$   I33C88		-  $)2F  	/ $)-)FGGGKKK9//4499$)-333KKKa<< )DIY& } dimY///|# 	<<66s;;DL$%D		19	!!*DGG+DH';KNN2248<<<..s33	00555Z?@@@rU   c                 |    | j         rt          d          |j                            | j        d          | _         d S )Nztemp allocated multiple timesT)r  r  r  r  r   r  s     rT   r  z$CythonArrayNode.allocate_temp_result
,  s;    > 	@>???55diFFrU   c                 ,    |                      |          S rN   )r  r   s     rT   r   zCythonArrayNode.infer_type,  s    ))#...rU   c                     |                                 j        j        }|                                 |j                            d          j        S )Narray)r  r  cython_scopeload_cythonscope	viewscoper-  r   )rY   rs   r  s      rT   r  z%CythonArrayNode.get_cython_array_type,  sE    ''))1>%%'''%,,W55::rU   c                 ^    ddl m}  fd j        D             } j        j        }j                            t          d          }j                            t          d          }d|                                z  }|	                    |          } j
        j        j        r                    d j
                                        z                                 d                                                    j
        j                                                 d                               |d	|d
                    | j                                                 |t                     dt'          |          z  }	                    |d|	dd                    |          d
                    | j                                                 |t                                                                          d|d|d|d j        d j
                                        d
                                                      j                                                             fd}
 |
|            |
|           d S )Nr(   r  c                 h    g | ].}j                             |                                          /S rW   )r  r  r  )rc   r  rY   s     rT   r   z8CythonArrayNode.generate_result_code.<locals>.<listcomp>,  sA     0 0 0 /++ELLNN;; 0 0 0rU   Tr  z
if (!%s) {zQPyErr_SetString(PyExc_ValueError,"Cannot create cython.array from NULL pointer");r   z = __pyx_format_from_typeinfo(&rc  z __PYX_BUILD_PY_SSIZE_T z = Py_BuildValue((char*) "(" z ")", r  z = __pyx_array_new(z, PyBytes_AS_STRING(z), (char *) "z", (char *) c                 r                         | t                     j                            |            d S rN   )r  r   r  r  )rt  r   s    rT   disposez5CythonArrayNode.generate_result_code.<locals>.disposeC,  s5    !!$777N''-----rU   )r  r  r  r  r  r  r  r   rr  get_type_information_cnamerb  r   r  r   r  r   r   r   r  r   r  r  r  )rY   r   r  r  r  shapes_tempformat_tempitemsize	type_infobuildvalue_fmtr  s   ``         rT   r  z$CythonArrayNode.generate_result_code,  s   0 0 0 0#';0 0 0"(n22>4HHn22>4HH%">">"@"@@55dEBB	<# 	JJ|dl&9&9&;&;;<<<JJ S T T TJJtt|'788999JJsOOO

KKII##K:::
 	 	 	
 	^4443c&kkA

KKNNIIf##K:::	
 	 	 	 	^444

KKMMMMKK;;;			4<;N;N;P;P;P;P##DKKMM48<<<
 	 	 	
 	T"""	. 	. 	. 	. 	. 	rU   c                 r   |j         }|j        }t          |          }g }|j        r4|                    t          ||||                     |j        }|j        4t          |dd          |d         _        t          j
        |||          }t          ||||          }|                    |          }|S )z@
        Given a C array type, return a CythonArrayNode
        r  r  T)r   r  rI  )r  r  )r  rb  r  )r   r   r  rT  r  r  r  r]  r   r   MemoryViewSliceTypeNoder  r<  )	rR   src_noders   r   r  r  r  memslicenoder  s	            rT   r  zCythonArrayNode.from_carrayJ,  s    
 lM	SMM	  	,KK	#YY,57 7 7 8 8 8!+I   	,  3TBBBR4StDMO O O \)1yJ J J%%c**rU   )r[   r\   r]   r  r   r  r   r  r  r   r^  r  r<  r  r   r  r  rd  r  rW   rU   rT   r  r  +  s         ( 8$HFGDK-Jf f fPG G G/ / /; ; ;
0 0 0d   [  rU   r  c                   (    e Zd Zej        Zd Zd ZdS )
SizeofNodec                     dS ry  rW   rX   s    rT   r=  zSizeofNode.check_constg,  rB  rU   c                     d S rN   rW   r  s     rT   r  zSizeofNode.generate_result_codej,  r   rU   N)r[   r\   r]   r   rZ  r   r=  r  rW   rU   rT   r  r  b,  s<         #D      rU   r  c                   (    e Zd Zg ZdZd Zd Zd ZdS )r  Nc                     	 | j
        ?| j                             |          }| j                            ||          \  }}	|	| _
        |                                  | S rN   )r  module_pathr-  r  r  r   r/  rr   SizeofVarNoder<  r  r  r  
check_type)
rY   rs   r  r#  rb  r  r   r  r  r  s
             rT   r<  zSizeofTypeNode.analyse_typesw,  s]    		 = ..s33I/11)SAAKAx$DMrU   c                     | j         }|sd S |j        r|j        st          | j        d           d S |j        rt          | j        d           d S |                                st          | j        d|z             d S d S )Nz Cannot take sizeof Python objectzCannot take sizeof voidz'Cannot take sizeof incomplete type '%s')r  rq   r{  r   r   r  is_complete)rY   r  s     rT   r  zSizeofTypeNode.check_type,  s    = 	F 	R(B 	R$(>????? 	R$(566666%%'' 	R$(EPQQQQQ	R 	RrU   c                     | j         j        r| j                             dd          }n| j                                         }d|z  S )Nr  r(   )deref(sizeof(%s)))r  r{  r   rr  )rY   r  s     rT   r  z$SizeofTypeNode.calculate_result_code,  sK    =* 	> }55b5BBHH};;==H((rU   )r[   r\   r]   r   r  r<  r  r  rW   rU   rT   r  r  n,  sP         HH  (	R 	R 	R) ) ) ) )rU   r  c                   &    e Zd ZdgZd Zd Zd ZdS )r  rb  c                    | j                             |          }|r|| _        | j        j        rP	 | j                            |j                  | _        n*# t          $ r t          | j         j        d           Y nw xY wt          | _
        |                                  n| j                             |          | _         | S )NzLType cannot be specialized since it is not a fused argument to this function)rb  re  r  rg  ri  rh  r)   r   r   r  rS   r  r<  )rY   rs   operand_as_types      rT   r<  zSizeofVarNode.analyse_types,  s     ,66s;; 	;+DM}% jj$(M$<$<S=R$S$SDMM' j j j$,*hj j j j jj ,DNOO<55c::DLs   $A $A=<A=c                 :    d| j                                         z  S )Nr  r^  rX   s    rT   r  z#SizeofVarNode.calculate_result_code,  s     3 3 5 555rU   c                     d S rN   rW   r  s     rT   r  z"SizeofVarNode.generate_result_code,  r   rU   N)r[   r\   r]   r   r<  r  r  rW   rU   rT   r  r  ,  sJ        
 {H  $6 6 6    rU   r  c                   H    e Zd ZdgZdZdZdZd ZdZd Z	d Z
d Zd	 Zd
 ZdS )
TypeidNoderb  Nr(   c                     |}|j         s|j        }|j         |                    d| j                  }|                    d          }t          j        t          j        |j                            S )Nzlibcpp.typeinfor  )	r  rd  find_moduler   r-  r   r  c_const_typer   )rY   rs   
env_moduletypeinfo_moduletypeinfo_entrys        rT   get_type_info_typezTypeidNode.get_type_info_type,  sq    
, 	0#/J , 	0$001BDHMM(//<<,Z-D^EX-Y-YZZZrU   ztypeid operatorc                    | j         st          j        | _         |                     |           |                     |          }|s|                     d           | S | j        | S || _         | j                            |          }|r|| _        d| _	        d | _        n| j        
                    |          | _        d| _	        d | _        | j        j         j        r|                     d           | S | j        j         j        r|                     d           | S | j        j                                         s$|                     d| j        j         z             | S |                    t          j        dd                     | S )	NzKThe 'libcpp.typeinfo' module must be cimported to use the typeid() operatorTFz$Cannot use typeid on a Python objectzCannot use typeid on voidz)Cannot use typeid on incomplete type '%s'r  r  )r   r   r/   rj  r  r   rb  rk  r  r  r<  rq   r  r  r   r	   r   )rY   rs   r  as_types       rT   r<  zTypeidNode.analyse_types,  s{   y 	."-DIs++C00	 	JJdeeeK<K	,::3?? 	#DMDLDLL L66s;;DM DLDL}!- 

ABBB#+ 

6777]'3355 

FI[[\\\[45MO_``aaarU   c                 `    t          | j        |           t          j        | _        d| _        d S r  r  r  s     rT   r   zTypeidNode.error,  r  rU   c                     dS ry  rW   rX   s    rT   r=  zTypeidNode.check_const,  rB  rU   c                     | j         S rN   r  rX   s    rT   r  z TypeidNode.calculate_result_code,  r  rU   c                     | j         r| j                                        }n| j                                        }t	          || j        | j        d|dd d | j                   d S )Nz
 = typeid(r  )r  r  rr  r  r   r   r  r  )rY   r   r  s      rT   r  zTypeidNode.generate_result_code-  sr    < 	.};;==HH}++--Hdh"&...(((;$-	/ 	/ 	/ 	/ 	/rU   )r[   r\   r]   r   r  r  r   r  cpp_messager<  r   r=  r  r  rW   rU   rT   r  r  ,  s         {HHKG[ [ [ $K  @% % %
    / / / / /rU   r  c                   :    e Zd ZdZeZdgZd Zd Zd Z	d Z
d ZdS )
TypeofNodeNr  c                 $   | j                             |          | _         t          j        t	          | j         j                            }t          | j        |          }|                    |          }|                    |          | _	        | S )Nrr  )
rb  r<  r   r0  rx   r   rC  r   r   r  )rY   rs   r   r  s       rT   r<  zTypeofNode.analyse_types-  sw    |11#66,S1B-C-CDDTXU333'',,11#66rU   c                 X    | j                             |          | _         | j         j        S rN   )rb  r<  r   r   s     rT   re  zTypeofNode.analyse_as_type-  s$    |11#66|  rU   c                     dS rw  rW   rX   s    rT   r?  zTypeofNode.may_be_none"-  rn  rU   c                 :    | j                             |           d S rN   )r  r  r  s     rT   r  z#TypeofNode.generate_evaluation_code%-  s    --d33333rU   c                 4    | j                                         S rN   )r  r  rX   s    rT   r  z TypeofNode.calculate_result_code(-  s    |11333rU   )r[   r\   r]   r  r   r   r   r<  re  r?  r  r  rW   rU   rT   r  r  -  sr         GD{H  ! ! !  4 4 44 4 4 4 4rU   r  c                 Z    	 | j         }n# t          $ r
 |j        }Y nw xY w || |          S rN   )
__matmul__r   __rmatmul__)ra  br  s      rT   matmul_operatorr  4-  sF    	!<DD 	! 	! 	!=DDD	!tAqzzs   
 r
  <===r  >=r  r  is_notr   r  ///<<%r   r
  **c                 
    | |v S rN   rW   xseqs     rT   r  r  Q-  s
    c rU   c                 
    | |vS rN   rW   r   s     rT   r  r  R-  s
    Qc\ rU   )>>r  ^@innot_inc                     t                               | j                  }|st          | j        d| j        z             |S )Nz4Binary '%s' not supported in compile-time expression)compile_time_binary_operatorsrj   r   r   r   )r   r  s     rT   get_compile_time_binopr+  U-  sI    (,,T];;D !dhB- 	! 	! 	! KrU   c                        e Zd Z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 fdZd Zd Z xZS )	BinopNoder  r  Fc                 t    t           | j                 } || j        j        | j        j                  | _        d S rN   )r*  r   r  r   r  r,  s     rT   r(  z#BinopNode.calculate_constant_resultn-  s8    ,T];#tM)M) +  +rU   c                     t          |           }| j                            |          }| j                            |          }	  |||          S # t          $ r }|                     |           Y d }~d S d }~ww xY wrN   )r+  r  r2  r  r  r6  )rY   r1  r  r  r  r5  s         rT   r2  zBinopNode.compile_time_valuet-  s    %d++=33D99=33D99	-4(+++ 	- 	- 	-))!,,,,,,,,,	-s   A 
A;A66A;c                     |                      | j                            |          | j                            |          |          S rN   )r>  r  r   r  r   s     rT   r   zBinopNode.infer_type}-  sD     8 8 = = $ 8 8 = =sD D 	DrU   c                     | j                             |          | _         | j                            |          | _        |                     |           | S rN   )r  r<  r  r}  r   s     rT   r<  zBinopNode.analyse_types-  sI    33C8833C88s###rU   c                    |                      |          rG|                     | j        j        | j        j        |          | _        | j        j        sJ d| _        d S |                                 r\|                     |           |                     | j        j        | j        j        |          | _        | j        j	        sJ d| _        d S | 
                                r|                     |           d S |                     |           d S rl  )r7  r>  r  r   r  r<   r   r8  coerce_operands_to_pyobjectsrq   r:  r;  r<  r   s     rT   r}  zBinopNode.analyse_operation-  s   $$S)) 	*(();)-);SB BDI9,,,,DLLL!!## 		*--c222(();)-);SB BDI9((((DLLL""$$ 	*&&s+++++$$S)))))rU   c                 V    |                      | j        j        | j        j                  S rN   )is_py_operation_typesr  r   r  rX   s    rT   r8  zBinopNode.is_py_operation-  s"    ))$-*<dm>PQQQrU   c                 :    |j         p|j         p|j        p|j        S rN   )rq   r1  rY   type1type2s      rT   r5  zBinopNode.is_py_operation_types-  s!     [E$5[[EO[rU   c                 X    |                      | j        j        | j        j        |          S rN   )is_pythran_operation_typesr  r   r  r   s     rT   r7  zBinopNode.is_pythran_operation-  s%    ..t}/A4=CUWZ[[[rU   c                     t          |          o;t          |          ot          |          ot          |          pt          |          S rN   )r@   r;   r<   )rY   r8  r9  rs   s       rT   r;  z$BinopNode.is_pythran_operation_types-  sQ    c"" B3E::i?bch?i?iB&&@/%*@*@	BrU   c                 F    | j         j        j        p| j        j        j        S rN   r  r   r  r  rX   s    rT   r:  zBinopNode.is_cpp_operation-  s"    "/ /}!.	0rU   c                    |                     | j        | j        | j        g          }|s|                                  d S |j        }|j        | _        |j        | _        | j        dk    r>d| _        t          |           r(|
                    t          j        dd                     |j        r|j        }t          |j                  dk    r1| j                            |j        d         j        |          | _        n`| j                            |j        d         j        |          | _        | j                            |j        d         j        |          | _        |j        | _        d S )Nr   r(   r  r  r   )r  r   r  r  rO  r   r   r   r   r   r   r	   r   r  r  r   r   r  r  )rY   rs   r   r  s       rT   r;  zBinopNode.analyse_cpp_operation-  sH   ##DMDM4=3QRR 	OOFJ	(8(83&& DL-d33 j$$[%<=UWg%h%hiii 	,!+Iy~!## M33IN14E4JCPPDMM M33IN14E4JCPPDM M33IN14E4JCPPDM)			rU   c                    |                      |||          r#t          t          | j        ||                    S |                     ||          r|j        rt          j        }n|j        rt          j	        }|j        rt          j        }n|j        rt          j	        }|j
        s|j
        r)||u r| j        dv r|S |                     ||          }||S t          S |j        s|j        rt          j        S |                     ||          S )Nz**%+|&^)r;  rH   r>   r   r5  r  r   r   r  r   r|  infer_builtin_types_operationr   r  r   r/   compute_c_result_type)rY   r8  r9  rs   r>  s        rT   r>  zBinopNode.result_type-  s(   **5%== 	P1$-NNOOO%%eU33 	< -*' -, -*' -,$ '(= 'E>>dmy&@&@ L"@@NN*&&!!^ 	<u~ 	<((--eU;;;rU   c                     d S rN   rW   r7  s      rT   rA  z'BinopNode.infer_builtin_types_operation-  rB  rU   c                 Z    |                                  r|                                  d S d S rN   rE  r   s     rT   rs  zBinopNode.nogil_check-  rF  rU   c                     | j                             |          | _         | j                            |          | _        d S rN   )r  r   r  r   s     rT   r3  z&BinopNode.coerce_operands_to_pyobjects-  s4    88==88==rU   c                 f    | j                                         o| j                                        S rN   r  r=  r  rX   s    rT   r=  zBinopNode.check_const-  )    }((**Jt}/H/H/J/JJrU   c                     t          t          |                                           p1| j                                        p| j                                        S rN   )rP   r-  r   r  r  )rY   rS   s    rT   r   zBinopNode.is_ephemeral-  sP    i&&3355 M**,,M040J0J0L0L	NrU   c                    | j         j        }| j        j        }| j        j        r>|                    d           |                    d|                                 z             | j        dk    rv|                    d|                                 d|                                 d| j                                         d| j                                        d	           d S |                    d|                                 d|                                 d	| j                                         d
| j        d
| j                                        d           d S |j        s|j        r| 	                    |          }| j        dk    rdnd}|j        r| j         
                                n| j                                         }|j        r| j        
                                n| j                                        }|                    |                                 d|d|d||d|                    |                                 | j                  
           |                     |           d S | j        r|                                 rz| j        dk    rot#          || j        |                                 d|                                 d| j        j        r|                                 nd | j        | j                   d S |                    |                                 d|                                 d           d S d S )Nz// Pythran binoprl  r  r  r  z$){pythonic::numpy::functor::power{}(r  r  r  r*  r  z	, Py_Noner  r  r
  rc  r   r  )r  r   r  r<   r   r  r   r  rq   rL  r   r   r   r  r   r:  r   r   r  r   r  )rY   r   r8  r9  r&  
extra_args
op1_result
op2_results           rT   r  zBinopNode.generate_result_code-  s`   ""9$ '	WJJ)***JJ3dkkmmCDDD}$$


KKMMMMKKMMMMM002222M002222	4 5 5 5 5 5 


KKMMMMKKMMMMM002222MMMM0022224 5 5 5 5 5  	W%"3 	W11$77H(,(=(=2J6;6Gc00222T]MaMaMcMcJ6;6Gc00222T]MaMaMcMcJJJKKMMMMHHJJJJJ++DKKMM48DDDFG G G   &&&&&\ 		W $$&& W4+?3+F+F'dh6:kkmmmmTE_E_EaEaEaEa(b9=9N(XTX(,(<d>SU U U U U
 

8R8R8T8T8T8TUVVVVV		W 		WrU   c           
          | j         j        j        sI| j        j        j        s8t	          | j        d| j        d| j         j        d| j        j        d           t          j        | _        d S )NzInvalid operand types for 'rN  rW  r`  )	r  r   r  r  r   r   r   r   r/   rX   s    rT   rO  zBinopNode.type_error.  ss    "+ 	)=%.	)$(( 2 2 2M&&&( ) ) ) )			rU   )r[   r\   r]   r   r  r(  r2  r   r<  r}  r8  r5  r7  r;  r:  r;  r>  rA  rs  r3  r=  r   r  rO  r^   r_   s   @rT   r-  r-  ^-  sr        J'HG+ + +- - -D D D  * * *"R R R\ \ \\ \ \B B B0 0 0* * *.< < <2    > > >K K KN N N N N*W *W *WX* * * * * * *rU   r-  c                   &    e Zd Zd Zd Zd Zd ZdS )
CBinopNodec                     t                               | |          }|                                rt          j        |_        |S rN   )r-  r<  r8  r   r/   r   r>  s      rT   r<  zCBinopNode.analyse_types$.  s:    &&tS11!! 	."-DIrU   c                     dS r  rW   r  s     rT   rL  z CBinopNode.py_operation_function*.  r$  rU   c                     d| j                                         d| j        d| j                                        dS Nr
  r*  r`  )r  r  r   r  rX   s    rT   r  z CBinopNode.calculate_result_code-.  sE     M  """"MMMM  """"$ 	$rU   c                     d }|j         s|j        r|                    | j        |          }|)|j         s|j        r|                    | j        |          }|S rN   )r  r  r/  r   )rY   r8  r9  r2  s       rT   rB  z CBinopNode.compute_c_result_type3.  se     	K 	K44T]EJJH!3u|44T]EJJHrU   N)r[   r\   r]   r<  rL  r  rB  rW   rU   rT   rP  rP  ".  sP            $ $ $    rU   rP  c                       fd}|S )Nc                 "    t          | fdi|S )Nr   )rP  )r   r  r   s     rT   make_binop_nodez,c_binop_constructor.<locals>.make_binop_node>.  s    #===H===rU   rW   )r   rX  s   ` rT   c_binop_constructorrY  =.  s"    > > > > >rU   c                        e Zd ZdZdZdZd Zd Z fdZd Z	d Z
 fd	Zd
 Zd Zd ZddddddddddddddZdddddZ xZS ) NumBinopNodeTFNc                 Z   | j         j        }| j        j        }|                     ||          | _        | j        s|                                  d S | j        j        rd| _        | j        j        r|j        d         r| j	        | j
        v r| j	        dv rK| j                                         r2| j                                        s| j        | j         c| _         | _        d| _        |j        d         | _        | j                            | j
        | j	                 || j                                                  | _        d| _        | j        r|j        rS|j        rN| j                             | j        |          | _         | j                            | j        |          | _        d S d S d S )NFrz  )r   r   Tzoverflowcheck.fold)	const_rhs)r  r   r  rB  rO  r  rU  r  rk   r   overflow_op_namesr   overflow_checkoverflow_foldoverflow_check_binopr  r   r  r  rY   rs   r8  r9  s       rT   r<  z NumBinopNode.analyse_c_operationI.  s   ""..ue<<	y 	OOF9 	DJI 	 N?3	 MT%;;;++99;; , M==?? , 04}dm,t}"&D!$0D!ED	66&t}5 M==?? 7 A ADI  DLz 	De. 	D53C 	D M33DIsCCDM M33DIsCCDMMM	D 	D 	D 	DrU   c                     |                      ||          rZt          j        ||          }|t          j        u r| j        dvrt          j        }nt          j        |t          j                  }|S d S )Nz|^&)c_types_okayr   r  r)  r   r  rY   r8  r9  widest_types       rT   rB  z"NumBinopNode.compute_c_result_typed.  su    UE** 	$8FFKj444=--","7K(<!68 84rU   c                     | j         r| j         j        rdS | j        j         }| j        j         }|r|j        r|r	|j        rdS t	          t
          |                                           S rw  )r   r|  r  r  rP   r[  r?  rY   r8  r9  rS   s      rT   r?  zNumBinopNode.may_be_noner.  sx    9 	2 	5"" 	U* 	u 	9N 	 5\4((44666rU   c                     | j                                         }| j                                        }|r|rd|d| j        d|dS d S rT  )r  r&  r  r   )rY   value1value2s      rT   r&  z'NumBinopNode.get_constant_c_result_code.  s\    99;;99;; 	f 	 	#)664===&&&AA4rU   c                 :    |j         s|j        o|j         p|j        S rN   )r  r(  r7  s      rT   rd  zNumBinopNode.c_types_okay.  s&     1EM 4!2U]	4rU   c                 <   | j         rO| | _        |j                            t          j        d          | _        |                    d| j        z             t          t          |           
                    |           | j         r|                    d| j        z             |                    d           |                    |                    | j                             |                    d           |j                            | j                   d S d S )NFr  r  r5  z8PyErr_SetString(PyExc_OverflowError, "value too large");r   )r_  overflow_bit_noder  r  r   r  overflow_bitr   rP   r[  r  r   r   r  r
  s     rT   r  z%NumBinopNode.generate_evaluation_code.  s     	6%)D" $ < <Z=R_d < e eDJJy4#44555lD!!::4@@@ 	;JJ,t/@@AAAJJQRRRJJttx00111JJsOOON''(9:::::	; 	;rU   c                    | j         K| j        d| j                                        d| j                                        d| j         j        dS | j        j        s| j        rt          | j                  r3| j        
                                | j        
                                }}n2| j                                        | j                                        }}d|d| j        d|dS | j                            | j                  }|%t          | j        d| j        d| j                   |d| j                                        d| j                                        dS )Nr
  r  z, &r`  r*  zbinary operator z not supported for )rn  r  r  r  r  ro  r   r  rU  r<   r  r   	binary_opr   r   )rY   result1result2r  s       rT   r  z"NumBinopNode.calculate_result_code.  so   !-			$$&&&&$$&&&&&333	5 5
 Y# 	(tz 	(ty)) R#'=#?#?#A#A4=C_C_CaCa#'=#7#7#9#94=;O;O;Q;Q#*77DMMM777CC9&&t}55D|dhhT]]]\`\e\e fggg$$&&&&$$&&&&( (rU   c                 V    |j         p"|j         pt                              | ||          S rN   )r  r-  r5  r7  s      rT   r5  z"NumBinopNode.is_py_operation_types.  s5    % D%D//eUCC	ErU   c                 d    | j         | j                 }| j        r|                    dd          }|S )N	PyNumber_PyNumber_InPlace)py_functionsr   r  r
  )rY   r   r  s      rT   rL  z"NumBinopNode.py_operation_function.  s8    )$-8< 	S)11+?QRRMrU   PyNumber_OrPyNumber_XorPyNumber_AndPyNumber_LshiftPyNumber_RshiftPyNumber_AddPyNumber_SubtractPyNumber_Multiply__Pyx_PyNumber_MatrixMultiply__Pyx_PyNumber_DividePyNumber_FloorDividePyNumber_RemainderPyNumber_Power)r
  r%  r  r  r$  r   r  r   r&  r  r  r  r  r  r  mullshift)r   r  r   r  )r[   r\   r]   rU  r_  rn  r<  rB  r?  r&  rd  r  r  r5  rL  rx  r^  r^   r_   s   @rT   r[  r[  B.  s        END D D6  7 7 7 7 7  4 4 4
; ; ; ; ;( ( (,E E E
   """%%"''3+*($ L" 	 rU   r[  c                       e Zd Zd ZdS )IntBinopNodec                 :    |j         s|j        o|j         p|j        S rN   )r  r(  r7  s      rT   rd  zIntBinopNode.c_types_okay.  s$    - 0.	0rU   N)r[   r\   r]   rd  rW   rU   rT   r  r  .  s#        0 0 0 0 0rU   r  c                   0     e Zd Zd Zd Zd Z fdZ xZS )AddNodec                 v    |j         r|j         s|j        r	|j        rdS t                              | ||          S rl  )r  r  r[  r5  r7  s      rT   r5  zAddNode.is_py_operation_types.  sJ    ? 	Ju 	J%2H 	JUMc 	J155dE5IIIrU   c                     t           t          t          t          t          f}||v r@||v r<|t          |                    |          |                    |                             S d S rN   )r   r"   r   r2   r   rN  r[  )rY   r8  r9  string_typess       rT   rA  z%AddNode.infer_builtin_types_operation.  sj     #NHo|\L  Ul%:%:L$6$6u$=$=$0$6$6u$=$=!? !? @ @trU   c                     |j         s|j        r|j        s|j        r|S |j         s|j        r|j        s|j        r|S t                              | ||          S rN   )r  rT  r  r(  r[  rB  r7  s      rT   rB  zAddNode.compute_c_result_type.  su    L 	$EN 	$ 	$ 	$Ll 	$en 	$5< 	$5= 	$L55eU$ $ $rU   c                    | j         j        | j        j        }}d }|t          u s	|t          u r|t          t          fv r|t          t          fv rd}n9t          | j         t                    st          | j        t                    rd}nd}|rB| j        s| j         j        r-|j	        
                    t          j        dd                     d}nA|t          u r8|t          u r/|j	        
                    t          j        dd                     d}|rQ| j        s| j         j        r|dz  }| j                                         s| j                                        r|d	z  }|S t          t          |                               |          S )
NTFUnicodeConcatInPlacer  __Pyx_PyUnicode_ConcatStrConcatInPlace__Pyx_PyStr_ConcatInPlaceSafe)r  r   r  r   r   r   rO  r  r   r   r   r	   r   r?  rP   r  rL  )rY   r   r8  r9  r  is_unicode_concatrS   s         rT   rL  zAddNode.py_operation_function.  s   })4=+=uL  E\$9$9x000U|X>V5V5V$(!!DM+=>> **T]\nBoBo *$(!! %*!  0< ]4=#8 ]$55#/0FHZ[[] ] ]/h5H#4#4--+,>@RSSU U U'D 	| "t}4 "	!}((** dm.G.G.I.I KWd##99$???rU   )r[   r\   r]   r5  rA  rB  rL  r^   r_   s   @rT   r  r  .  sq        J J J  $ $ $@ @ @ @ @ @ @ @ @rU   r  c                       e Zd Zd ZdS )SubNodec                     |j         s|j        r|j        s|j        r|S |j         s|j        r|j         s|j        rt          j        S t                              | ||          S rN   )r  rT  r  r(  r   c_ptrdiff_t_typer[  rB  r7  s      rT   rB  zSubNode.compute_c_result_type/  sy    L 	$EN 	$ 	$ 	$Ll 	$en 	$5< 	$5> 	$..55eU$ $ $rU   N)r[   r\   r]   rB  rW   rU   rT   r  r  /  s#        $ $ $ $ $rU   r  c                   d     e Zd ZdZd Zed             Zd Zd Z fdZ	 fdZ
 fdZd	 Z xZS )
MulNodeFc                    | j                             |          | _         | j                            |          | _        |                                 | _        | j        rX| j         }| j        }|j        r|j        |                     |||          S |j        r|j        |                     |||          S |                     |           | S rN   )	r  r<  r  calculate_is_sequence_mulis_sequence_mulr   r   analyse_sequence_mulr}  rY   rs   r  r  s       rT   r<  zMulNode.analyse_types*/  s    33C8833C88#==??  	J}H}H/ JH4H4P00hIII1 Jh6J6R00hIIIs###rU   c                 4    | j         o| t          v o| t          uS rN   )r|  r%   r$   r  s    rT   is_builtin_seqmul_typezMulNode.is_builtin_seqmul_type;/  s!    #f0F(Ff4WfKffrU   c                     | j         j        }| j        j        }|t          u s|j        r||}}|t          u s|j        r'|j        s|j        rdS |                     |          rdS dS r  )r  r   r  r3   r  r  r1  r  r7  s      rT   r  z!MulNode.calculate_is_sequence_mul?/  s{    ""I %5EI %/ t**511 turU   c                 v    |j         J |                    |          }||_         |                    |          S rN   )r   r   r<  )rY   rs   r"  mults       rT   r  zMulNode.analyse_sequence_mulL/  s>    &&&$$S))  %%%rU   c                 ,   | j         rc| j        j        j        r | j                            |          | _        n0| j        j        j        r| j                            |          | _        d S t          t          |                               |           d S rN   )	r  r  r   r1  r   r  rP   r  r3  r  s     rT   r3  z$MulNode.coerce_operands_to_pyobjectsR/  s     	}!+ F $ @ @ E E#- F $ @ @ E EFgt99#>>>>>rU   c                 d    | j         p(t          t          |                               ||          S rN   )r  rP   r  r5  rh  s      rT   r5  zMulNode.is_py_operation_types\/  s-    #_uWd';';'Q'QRWY^'_'__rU   c                     | j         rB|j                            t          j        dd                     | j        j        j        rdndS t          t          |           
                    |          S )Nr:	  r  __Pyx_PySequence_Multiply__Pyx_PySequence_Multiply_Left)r  r   r   r	   r   r  r   rq   rP   r  rL  r
  s     rT   rL  zMulNode.py_operation_function_/  sw     	w--'(<>PQQS S S26-2D2Pv..VvvWd##99$???rU   c                     |j         r5|j         r.|                     |          r|S |                     |          r|S |j        r|S |j        r|S d S rN   )r|  r  r  r7  s      rT   rA  z%MulNode.infer_builtin_types_operationf/  st       	U%: 	**511 **511  < 	L< 	LtrU   )r[   r\   r]   r  r<  staticmethodr  r  r  r3  r5  rL  rA  r^   r_   s   @rT   r  r  &/  s        O  " g g \g  & & &? ? ? ? ?` ` ` ` `@ @ @ @ @      rU   r  c                   $     e Zd Zd Z fdZ xZS )MatMultNodec                     dS ry  rW   r7  s      rT   r5  z!MatMultNode.is_py_operation_typesz/  rB  rU   c                     |j                             t          j        dd                     t	          t
          |                               |           d S )NMatrixMultiplyr  )r   r   r	   r   rP   r  r  r
  s     rT   r  z$MatMultNode.generate_evaluation_code}/  sM    ))+*ABRTf*g*ghhhk4  99$?????rU   )r[   r\   r]   r5  r  r^   r_   s   @rT   r  r  w/  sP          @ @ @ @ @ @ @ @ @rU   r  c                   d    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d
 Zd Zd Zd ZdS )DivNodeNFc                     t           | j                 }| j        dk    r>| j        7t          |t                    r"t          |t                    rt           d         }|S )Nr  r  )r*  r   truedivisionr   r&   rY   op1op2r  s       rT   !find_compile_time_binary_operatorz)DivNode.find_compile_time_binary_operator/  sU    ,T];=CD$5$=#}-- ;*S-2P2P ;4T:rU   c                     | j         j        }| j        j        }|                     ||          } || j         j        | j        j                  | _        d S rN   )r  r   r  r  r  s       rT   r(  z!DivNode.calculate_constant_result/  sU    m+m+55c3??#tM)M) +  +rU   c                 
   | j                             |          }| j                            |          }	 |                     ||          } |||          S # t          $ r }|                     |           Y d }~d S d }~ww xY wrN   )r  r2  r  r  r  r6  )rY   r1  r  r  r  r5  s         rT   r2  zDivNode.compile_time_value/  s    =33D99=33D99	-99($ $D4(+++ 	- 	- 	-))!,,,,,,,,,	-s   !A 
B"A==Bc                 X    | j         s|j        d         r	d| _        d S | j        | _        d S )N	cdivisionF)r  rk   ctruedivisionr  r   s     rT   _check_truedivisionzDivNode._check_truedivision/  s9    > 	3S^K8 	3!&D!%!2DrU   c                     |                      |           |                     | j                            |          | j                            |          |          S rN   )r  r>  r  r   r  r   s     rT   r   zDivNode.infer_type/  sV      %%%M$$S))M$$S))30 0 	0rU   c                    |                      |           t                              | |           |                                 rd| _        | j        j        s| j        d u o7|j        d          o)| j        	                                 p| j        j
        dk    | _        | j        s|j        d         rB| j                            |          | _        | j                            |          | _        d S d S d S )NTr  r   cdivision_warnings)r  r[  r}  r:  r  r   rq   rk   r  r   r   zerodivision_checkr  rK  r   s     rT   r}  zDivNode.analyse_operation/  s     %%%&&tS111  "" 	"!DNy$ 	D$& 9s~k/J+J 9::<<< 8]2a7 # & D#.9M*N D $ > >s C C $ > >s C C	D 	D
D DrU   c                    | j         dk    rY| j        rR|j        sK|j        sD|j        s=|j        s6t	          j        |t          j                  }t	          j        ||          }|S t                              | ||          S )Nr  )	r   r  r  r*  r   r  r  r[  rB  re  s       rT   rB  zDivNode.compute_c_result_type/  s    =CD$6u?QZ_Zl> #%. #(<UJD\]](<UKPP""11$uEEErU   c                 "    | j         j        rdS dS )N"integer division or modulo by zerozfloat divisionr  rX   s    rT   zero_division_messagezDivNode.zero_division_message/      9 	$77##rU   c                    | j         j        s| j         j        s| j        H|j        j        d         p0| j         j        p$| j         j        s| j         j        o| j         j	         | _        | j        sE|j        
                    t          j        dd                              | j                              t                              | |           |                     |           d S )Nr  DivIntCMath.c)r   rq   r  r  r   rk   r*  r  r(  r  r   r	   r   ri  r[  r  generate_div_warning_coder  s     rT   r  z DivNode.generate_evaluation_code/  s    y$ 		XTY-A 		X~%$/< ^y)^-B1B\DIL\H\ 
 > X 11+Hi@@KKDIVVX X X--dD999&&t,,,,,rU   c           	         | j         }| j        j        sd| j        r| j        s8| j                            d          d| j                                        d}nd| j                                        z  }|                    d|z             |r|	                                 |                    d| 
                                z             |r|                                 |                    |                    | j                             |                    d           | j        j        r| j        j        r|| j        dk    rp|j                            t'          j        d	d
                     | j        j        j        dk    rd| j                                        z  }nA| j        j                                        }d|d| j                                        d|d}|                    d| j                                        d|d| j                                        d           |r|	                                 |                    d           |r|                                 |                    |                    | j                             |                    d           |j        j        d         r| j        dk    r|j                            t'          j        dd                     |                    d| j                                        d| j                                        d           dt0          j        t0          j        dz  }|rd}|                    d |z             |	                                 |                    |                    | j        d!"                     |                    |d#|d$           |                                 n1|}|                    |                    | j        d!"                     |                    d%|z             |                    |j                   |                    d           d S d S d S d S )&Nzeror
  r`  z%s == 0r5  z/PyErr_SetString(PyExc_ZeroDivisionError, "%s");r   r  UnaryNegOverflowsr  r5   zunlikely(%s == -1)z(!(((z)-1) > 0)) && unlikely(z == (z)-1)zelse if (sizeof(z) == sizeof(long) && z-  && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(r  zLPyErr_SetString(PyExc_OverflowError, "value too large to perform division");r  r  CDivisionWarningr  r  z	 < 0) ^ (z	 < 0))) {z1__Pyx_cdivision_warning(%(FILENAME)s, %(LINENO)s))FILENAMELINENOr  zint %s;T)r  r  r  zif (unlikely(%s)) )r  r   rq   r  rU  rn  r  r  r   r   r  r   r   r   r  r  r   r   r   r	   r   rr  r  rk   r   filename_cnamelineno_cnameset_error_infor  r{  r|  )rY   r   in_nogil	zero_testminus1_checktype_of_op2warning_coder  s           rT   r  z!DivNode.generate_div_warning_code/  s{   (y$ ;	 & !$z C,0I,>,>v,F,F,F,FH\H\H^H^H^H^ _II )DM,@,@,B,B BI

09<=== *'')))

LtOiOiOkOkklll 300222

4??4844555

39# $	(8 $T]c=Q=Q$55k6MNaco6p6pqqq})0A55';dm>R>R>T>T'T&*m&8&O&O&Q&Q'KK)=)=)?)?)?)?(NJJJ#y??AAAA+||#}335555	 7 8 8 8
   .++---JJmnnn 744666JJttx88999JJsOOO*+?@  T]VYEYEY 11+,>	JJL L L


 $ 4 4 6 6 6 6 $ 4 4 6 6 6 68 9 9 9  S & 5%2V V  
  	I"*KJJy;6777'')))JJt2248$2GGHHHJJ[[[,,,GHHH002222".KJJt2248$2GGHHH-;<<<d.///

3w;	  ;	 F   EYEYrU   c                    | j         j        s|                                 rt                              |           S | j         j        rB| j        dk    r7d| j                                        d| j	                                        dS | j
        s| j        r| j                                        }| j	                                        }| j
        r^| j         | j        j         k    r| j                             |          }| j         | j	        j         k    r| j                             |          }d|d|dS d| j                                         d| j                                        d| j	                                        dS )Nr  zfloor(z / r`  r
  
__Pyx_div_r  )r   r  r:  r[  r  r*  r   r  r  r  r  r  r  specialization_name)rY   r  r  s      rT   r  zDivNode.calculate_result_code0  s   9 	(4#8#8#:#: 	(55d;;;Y 	(DMT$9$9$9$$&&&&$$&&&&( (  	($. 	(-&&((C-&&((C  39 222)--c22C9 222)--c22C"%##sss++	( 	--////$$&&&&$$&&&&( (rU   )r[   r\   r]   r  r  r  r  r  r  r(  r2  r  r   r}  rB  r  r  r  r  rW   rU   rT   r  r  /  s         ILM  + + +- - -3 3 30 0 0D D DF F F$ $ $- - -=  =  = ~( ( ( ( (rU   r  s'   %(?:%|(?:\([^)]+\))?[-+#,0-9 ]*([a-z]))>      E   F   G   X   a   b   c   d   e   f   g   i   o   u   xc                   B     e Zd Zd Zd Zd Zd Zd Zd Z fdZ	 xZ
S )ModNodec                 V    |j         p"|j         pt                              | ||          S rN   )r  r[  r5  r7  s      rT   r5  zModNode.is_py_operation_typesC0  s3     J?J55dE5II	KrU   c                    |t           u r#|j        s| j                                        s|S n|t          t
          t          fv r|t           u r|S |j        r|S | j        j        rJ|t
          u s	|t          u r1t          t          | j        j                            t          k    r|S t          S |t          u r	|j        sd S t          S d S rN   )r   r|  r  r?  r   r   r2   r  rY  r  _find_formatting_typesr   _safe_bytes_formatsr7  s      rT   rA  z%ModNode.infer_builtin_types_operationH0  s    L  $ DM,E,E,G,G z8_===$$! 
'0 'H$$(;(;1$-2EFFGGK^^^$&&*$$U-B$t&&trU   c                 "    | j         j        rdS dS )Nr  zfloat divmod()r  rX   s    rT   r  zModNode.zero_division_message^0  r  rU   c                 (   t                               | |           | j        j        sd| j        |j        d         p| j        j         | _        | j        s9| j        j        s/| j        j        s%t          | j
        d| j        z             d S d S d S d S d S )Nr  z(mod operator not supported for type '%s')r  r}  r   rq   r  rk   r  r  r*  r   r   r   s     rT   r}  zModNode.analyse_operationd0  s    !!$,,,y$ 	X~%!$!<!TDIDT@T> X$)*: X49CU Xdh JTY VWWWWW		X 	XX X X X X XrU   c                    | j         j        s| j        s| j         j        rF|j                            t          j        dd                              | j                              nQ|j                            t          j        dd                              | j         | j         j	                             t                              | |           |                     |           d S )NModIntr  ModFloat)math_h_modifier)r   rq   r  r  r   r   r	   r   ri  r  r[  r  r  r  s     rT   r  z ModNode.generate_evaluation_codel0  s    y$ 	OT^ 	Oy O 11+Hi@@KKDIVVX X X X  11+J	BBMM	493L N N NO O O 	--dD999&&t,,,,,rU   c                    | j         r| j        j        rDd| j        j        d| j                                        d| j                                        dS d| j                                        d| j                                        dS d| j                                        d| j                                        d| j                                        dS )Nfmodr
  r  r`  z % 
__Pyx_mod_)r  r   r*  r  r  r  r  r  rX   s    rT   r  zModNode.calculate_result_codey0  s    > 	,y! , ,I---M((****M((****, ,, M((****M((****, ,	, I113333M((****M((****, ,rU   c                    | j         j        | j        j        }}|t          u r\| j                                         s?|j        r|                    |          s#|t          u rt          | j        t                    sdS dS |t          u r\| j                                         s?|j        r|                    |          s#|t          u rt          | j        t                    sdS dS t          t          |                               |          S )N__Pyx_PyUnicode_FormatSafePyUnicode_Format__Pyx_PyString_FormatSafe__Pyx_PyString_Format)r  r   r  r   r?  r{  r   r   r   r  r   rP   r  rL  )rY   r   r8  r9  rS   s       rT   rL  zModNode.py_operation_function0  s
   })4=+=uL  }((** *+*050@0@0G0G*^++Jt}N`4a4a+33))h}((** /+/050@0@0G0G/^++Jt}N`4a4a+22..Wd##99$???rU   )r[   r\   r]   r5  rA  r  r}  r  r  rL  r^   r_   s   @rT   r  r  @0  s        K K K
  ,$ $ $X X X- - -, , ,"@ @ @ @ @ @ @ @ @rU   r  c                   `     e Zd ZdZdZd Z fdZ fdZd Z fdZ	d Z
 fd	Z fd
Z xZS )PowNodeNFc                 <    | j         d S |j        d         | _         d S )Ncpow)is_cpowrk   r   s     rT   _check_cpowzPowNode._check_cpow0  s!    <#F~f-rU   c                 ~    |                      |           t          t          |                               |          S rN   )r	  rP   r  r   r  s     rT   r   zPowNode.infer_type0  s5    Wd##..s333rU   c                 ~    |                      |           t          t          |                               |          S rN   )r	  rP   r  r<  r  s     rT   r<  zPowNode.analyse_types0  s5    Wd##11#666rU   c                    t                               | |           | j        j        r| j        j        j        rk| j                            | j        |          | _        | j                            | j        |          | _        | j        	                    d          | _
        d S t          | j        d           d| _
        d S | j        j        rd| j        j        z   | _
        d S | j        j        rd| j                                                            dd          z  | _
        |                    t%          j        dd	                              | j
        | j                                        | j        j        rd
pd                     d S | j        j        s1t          | j        d| j        j        d| j        j                   d S d S )Nr  z complex int powers not supportedr  powz__Pyx_pow_%sr*  r  IntPowr  r(   r   )r
  r   r  z+got unexpected types for C power operator: r  )r[  r<  r   r  r  r*  r  r  r  rq  pow_funcr   r   r  r  rr  r
  r   r	   r   ri  r  r  r   s     rT   r<  zPowNode.analyse_c_operation0  s   ((s3339 	Fy"+ * $ 7 7	3 G G $ 7 7	3 G G $	 3 3D 9 9dh BCCC )Y 	F!DI$==DMMMY 		F*TY-M-M-O-O-W-WX[]`-a-aaDM  ')<<GG"m99;;9+16Q H 8 89 9 9 9 9
 # 	F$((!]///1C1CE F F F F F	F 	FrU   c                    ddl m} d }| j                                        o| j        j        dk    p|j        o
|j        dk    }|j        pY| j                                        o@t          | j        j        |          o&t          | j        j                  | j        j        k    }d}| j
        rrt          t          |                               ||          }| j                                        s/t          | j        j        t                    o| j        j        dk     }n|s|rt          t          |                               ||          }| j                                        s|j        o|j        }|rd| _        nYt          | j        j        t                    o| j        j        dk     }n)|                     ||          rt"          j        }d| _        |rt#          j        |t"          j                  }|S )Nr   )RealFT)numbersr  r  r   r   r  r  r  r   r  r  rP   r  rB  r&   type_was_inferredrd  r   r  r  r  )	rY   r8  r9  r  c_result_typeop1_is_definitely_positivetype2_is_intneeds_wideningrS   s	           rT   rB  zPowNode.compute_c_result_type0  s         M--// 3-2&
 L.U\Q.	 	# | 
M--// Pt}4d;;P-..$-2OO 	
 < 	*!'400FFueTTM=4466 t}<mLLrQUQ^QnqrQr  ( 	*< 	*!'400FFueTTM=4466 !&!>%,! 2-1D* t}<mLLrQUQ^QnqrQr  ue,, 	* '8M%)D" 	d&:=*JbccMrU   c                 f      fd} j         d | j                  d | j                  dS )Nc                     j         | j         k    r|                                 S j                             |                                           S rN   )r   r  r  )rb  rY   s    rT   r.   z/PowNode.calculate_result_code.<locals>.typecast0  sB    yGL((~~'''y**7>>+;+;<<<rU   r
  r  r`  )r  r  r  )rY   r.   s   ` rT   r  zPowNode.calculate_result_code0  s[    	= 	= 	= 	= 	= MMMHT]####HT]####% 	%rU   c                 `   | j         j        rz| j        j        dk    rjt	          | j        j        t
                    rK| j        j         t          u r8|j        	                    t          j        dd                     | j        rdS dS t          t          |                               |          S )Nr5   PyNumberPow2rl	  __Pyx_PyNumber_InPlacePowerOf2__Pyx_PyNumber_PowerOf2)r   rq   r  r   r   r&   r  r   r   r   r	   r   r  rP   r  rL  r
  s     rT   rL  zPowNode.py_operation_function0  s    I! 	1-224=8-HH 3"n44--k.EnVb.c.cddd| 17700Wd##99$???rU   c                    	 || j         k    r| S | j        | j        r|j        s|j        r| j         t
          j        u r	d	fd		d}n|j        rd 	d}nd 	 	| j                  \  }} 	| j                  \  }}|rg|ret          | j
        d|z             d| _        || _        || _        |                     |          }|j         |k    r|                    ||          }|S t          t          |                               ||          S )	NTc                     | j         j        s| j         j        rd| fS |r.t          | t                    r | j        d          | j        fS dS )NTF)recurserS  )r   r*  r  r   r  r>  )rb  r   check_typess     rT   r!  z&PowNode.coerce_to.<locals>.check_types1  se    |, -0C -#W}, T:g7J#K#K T*{7;FFFSS&;rU   za non-complex C numeric typec                 &    | j         j        rd| fS dS )NTrS  r  rb  s    rT   r!  z&PowNode.coerce_to.<locals>.check_types1  s     |* +#W},  +{rU   zan integer C numeric typec                     dS )NrS  rW   r#  s    rT   r!  z&PowNode.coerce_to.<locals>.check_types%1  s    &;rU   zTreating '**' as if 'cython.cpow(True)' since it is directly assigned to a %s. This is likely to be fragile and we recommend setting 'cython.cpow' explicitly.r>  )r   r  r  r*  r  r   r  r  r  r   r   r<  r  rP   r  )rY   r	  rs   
msg_detail	check_op1r  	check_op2r  r  r!  rS   s            @rT   r  zPowNode.coerce_to1  st   ty  KL T%; " !&.o ! yJ888' ' ' ' ' ' <

 
'+ + + 9

' ' '([77NIs([77NIs Y  #0 3=#= > > >  $ # #++C00;(**#--h<<FWd##--h<<<rU   )r[   r\   r]   r  r  r	  r   r<  r<  rB  r  rL  r  r^   r_   s   @rT   r  r  0  s         G. . .
4 4 4 4 47 7 7 7 7F F F.( ( ( ( (T
% 
% 
%
@ 
@ 
@ 
@ 
@*= *= *= *= *= *= *= *= *=rU   r  c                       e Zd ZdZ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d ZdS )BoolBinopNodeag  
    Short-circuiting boolean operation.

    Note that this node provides the same code generation method as
    BoolBinopResultNode to simplify expression nesting.

    operator  string                              "and"/"or"
    operand1  BoolBinopNode/BoolBinopResultNode   left operand
    operand2  BoolBinopNode/BoolBinopResultNode   right operand
    r  r  TNc                     | j                             |          }| j                            |          }t          j        ||          S rN   )r  r   r  r   independent_spanning_typerb  s       rT   r   zBoolBinopNode.infer_typeI1  s?    ((--((--3E5AAArU   c                     | j         dk    r| j                                        S | j                                        p| j                                        S )Nor)r   r  r?  r  rX   s    rT   r?  zBoolBinopNode.may_be_noneN1  sJ    =D  =,,...=,,..M$-2K2K2M2MMrU   c                 t    | j         j        }| j        j        }| j        dk    r|o|| _        d S |p|| _        d S Nand)r  r   r  r   )rY   r  r  s      rT   r(  z'BoolBinopNode.calculate_constant_resultT1  sI    =0=0=E!!#+#8D   #+#7xD   rU   c                     | j                             |          }| j                            |          }| j        dk    r|o|S |p|S r/  )r  r2  r  r   )rY   r1  r  r  s       rT   r2  z BoolBinopNode.compile_time_value\1  sO    =33D99=33D99=E!!(('x'rU   c                 f    | j                                         p| j                                        S rN   )r  r   r  rX   s    rT   r   zBoolBinopNode.is_ephemerald1  s)    }))++Kt}/I/I/K/KKrU   c                 "   | j                             |          }| j                            |          }t          j        |j        |j                  | _        |                     ||          | _         |                     ||          | _        | S rN   )r  r<  r  r   r+  r   _wrap_operandr  s       rT   r<  zBoolBinopNode.analyse_typesg1  s~     =..s33=..s338M8=* *	**8S99**8S99rU   c                 j    t          |t          t          f          st          || j        |          }|S rN   )r   r)  BoolBinopResultNoder   )rY   rb  rs   s      rT   r4  zBoolBinopNode._wrap_operands1  s3    'M3F#GHH 	C)'49cBBGrU   c                     |                      | j        |          | _        |                      | j        |          | _        dS )z
        Must get called by transforms that want to create a correct BoolBinopNode
        after the type analysis phase.
        N)r4  r  r  r   s     rT   wrap_operandszBoolBinopNode.wrap_operandsx1  s:    
 **4=#>>**4=#>>rU   c                 B    |                      t          j        |          S rN   r  r   r)  r   s     rT   rG  zBoolBinopNode.coerce_to_boolean1      ~~j4c:::rU   c                     | j                             ||          }| j                            ||          }t                              | || j        ||          S )N)r   r   r  r  )r  r  r  r)  rM  r   )rY   r	  rs   r  r  s        rT   r  zBoolBinopNode.coerce_to1  s\    =**8S99=**8S99&&x] ' 2 2 	2rU   c           	      j   |                     | j                   ||f}| j        dk    r|                    d          x}	}n|                    d          x}	}| j                            |||||||	           |\  }}|                    |	           | j                            |||||||           d S )Nr0  next_andnext_or)r  r   r   rz  r  generate_bool_evaluation_coder  r  )
rY   r   final_result_tempfinal_result_type	and_labelor_label	end_labelfall_throughouter_labelsmy_labels
             rT   r@  z+BoolBinopNode.generate_bool_evaluation_code1  s    dh!8,=E!!#'>>*#=#==Hyy"&..";";;Hx33#%6	8YX`	b 	b 	b +	8x   33#%6	8YXd	f 	f 	f 	f 	frU   c           	      $   |                      |           | j        j        rt          j        n| j        }d x}}|                    d          }|                     ||                                 |||||           |                    |           d S )Nbool_binop_done)	r  r   rq   r   r   rz  r@  r  r  )rY   r   r>  rD  rC  rE  s         rT   r  z&BoolBinopNode.generate_evaluation_code1  s    !!$'''3793HWj//di##9NN#455	**4YX`bkmvwwwy!!!!!rU   Truth-testing Python objectc                 f    | j                                         o| j                                        S rN   rG  rX   s    rT   r=  zBoolBinopNode.check_const1  rH  rU   c                     d S rN   rW   r  s     rT   r  z,BoolBinopNode.generate_subexpr_disposal_code1  r   rU   c                     d S rN   rW   r  s     rT   r  z BoolBinopNode.free_subexpr_temps1  r   rU   c           
      P   | j         j        rt|j                            t          j        d          }|                    |d| j                                        d|	                    || j
                             n| j                                        }|| j         j        fS NFr  r  rc  )r   rq   r  r  r   r)  r   r  r   r  r   r  rY   r   test_results      rT   generate_operand1_testz$BoolBinopNode.generate_operand1_test1  s    9  		1.66&5 7 : :KJJKKM++----**;AAACD D D D -..00KTY233rU   )r[   r\   r]   r  r   r   r   r  r  r   r?  r(  r2  r   r<  r4  r8  rG  r  r@  r  re  r=  r  r  rS  rW   rU   rT   r)  r)  81  sD       	 	 J'HGHHHB B B
N N N8 8 8( ( (L L L
 
 
  
? ? ?; ; ;2 2 2f f f"" " " 0KK K K    4 4 4 4 4rU   r)  c                   Z     e Zd ZdZddgZdZdZdZ fdZd Z	d Z
d	 Zd
 Zd Zd Z xZS )r6  a  
    Intermediate result of a short-circuiting and/or expression.
    Tests the result for 'truthiness' and takes care of coercing the final result
    of the overall expression to the target type.

    Note that this node provides the same code generation method as
    BoolBinopNode to simplify expression nesting.

    arg     ExprNode    the argument to test
    value   ExprNode    the coerced result value node
    r>  r   TNc           	          |                     |          }t          |          }t          t          |                               |j        ||t          |                              ||                     d S )N)r>  r   r   )rK  	ProxyNoderP   r6  r  r   r  r  )rY   r>  r>  rs   rS   s       rT   r  zBoolBinopResultNode.__init__1  su    ""3''nn!4((11G;C..**;<< 	2 	> 	> 	> 	> 	>rU   c                 B    |                      t          j        |          S rN   r:  r   s     rT   rG  z%BoolBinopResultNode.coerce_to_boolean1  r;  rU   c                     | j         j         }|t          j        u r|                    |          }t	          |||          S rN   )r>  r   r)  rG  r6  )rY   r	  rs   r>  s       rT   r  zBoolBinopResultNode.coerce_to1  s>    hlz---'',,C"3#666rU   c                     d S rN   rW   r   s     rT   rs  zBoolBinopResultNode.nogil_check1  rj  rU   c           
      d   | j         j        j        rt|j                            t
          j        d          }|                    |d| j                                         d|	                    || j
                             n| j                                         }|| j         j        j        fS rP  )r>  r   rq   r  r  r   r)  r   r   r  r   r  rQ  s      rT   generate_operand_testz)BoolBinopResultNode.generate_operand_test1  s    8=$ 		,.66&5 7 : :KJJKKH&&((((**;AAACD D D D (//++KTX]677rU   c                    |                     | j                   | j                            |           |s|r|                     |          \  }}	|	r|r|r| j                            |           |rdnd}
|                    d|
|d           |	r|j                            |           |	r|r|s| j                            |           |r||k    r|	                    |           |rN|r1|                    d           |	s| j                            |           ||k    r|	                    |           |r|s|s|r|                    d           | j
                            |           | j
                            |           |                    |d| j
                            |          d           | j
                            |           | j                            |           | j
                            |           ||k    r|	                    |           |s|r|                    d           | j                            |           d S )	NrX  r  r  z) {r  r  r  r   )r  r   r>  r  r[  r  r   r  r  r{  r   r  r  r  r  )rY   r   rA  rB  rC  rD  rE  rF  rR  	uses_tempsenses              rT   r@  z1BoolBinopResultNode.generate_bool_evaluation_code1  s   dh 	))$/// 	- 	-%)%?%?%E%E"K 6i 6H 6 //555#+CCEJJJ{{{;<<< 9++K888 6Y 68 6//555 (H44h''' - >JJz***$ >77===,,MM),,, 	) 	) 'H '

:&&&J//555J++D111JJ%6%6%6
8L8LM^8_8_8_8_`aaaJ44T:::H++D111J!!$'''L((i((( 	 	JJsOOOD!!!!!rU   c                     | S rN   rW   r   s     rT   r<  z!BoolBinopResultNode.analyse_types-2  rp  rU   )r[   r\   r]   r  r   r   r>  r   r  rG  r  rs  r[  r@  r<  r^   r_   s   @rT   r6  r6  1  s        
 
 wHG
CE> > > > >; ; ;7 7 7  8 8 85" 5" 5"n      rU   r6  c                        e Zd ZdZdZdZg dZd Zd Zd Z	d Z
d Zd	 Z fd
Z fdZd Zd Zd Zd Zd Zd Z xZS )r  NT)r  r  r  c                 l    | j                             |          | j                            |          z   S rN   )r  rO  r  r   s     rT   rO  zCondExprNode.type_dependencies>2  s.    }..s33dn6V6VWZ6[6[[[rU   c                     t          j        | j                            |          | j                            |                    S rN   )r   r+  r  r   r  r   s     rT   r   zCondExprNode.infer_typeA2  s=    3M$$S))N%%c**, , 	,rU   c                 f    | j         j        r| j        j        | _        d S | j        j        | _        d S rN   )r  r   r  r  rX   s    rT   r(  z&CondExprNode.calculate_constant_resultF2  s6    9$ 	B#'=#@D   #'>#AD   rU   c                 f    | j                                         p| j                                        S rN   )r  r   r  rX   s    rT   r   zCondExprNode.is_ephemeralL2  s)    }))++Lt~/J/J/L/LLrU   c                     | j                             |          | _         | j                            |          | _        | j                            |          | _        |                     |          S rN   )r  rL  r  r<  r  r  r   s     rT   r<  zCondExprNode.analyse_typesO2  s[    I==cBB	33C8855c::'',,,rU   c                    | j         j        }| j        j        }t          j        ||          | _        | j        j        r#t          j        | j        j                  | _        | j        j        rt          | _
        nG| j                                         s| j                                        rt          | j        d           |j        s|j        s| j        j        r`|| j        k    r%| j                             | j        |          | _         || j        k    r%| j                            | j        |          | _        | j        j        r|                                  | S )NzPUnsafe C derivative of temporary Python reference used in conditional expression)r  r   r  r   r+  r  r  r  rq   r   r$  r   r   r   r  r  rO  )rY   rs   true_val_typefalse_val_types       rT   r  z CondExprNode.analyse_result_typeU2  s>   *,8WW	9! 	O"5di6MNNDI9  	p .D]'')) 	pT^-H-H-J-J 	p$(nooo$ 	J(B 	JdiF[ 	J	)) $ 7 7	3 G G**!%!9!9$)S!I!I9 	OOrU   c                    | j         j        j        s| j                             |          | _         | j        j        j        s| j                            |          | _        d | _        |                     |          }|j        j        sB|| u r)t          t          |                              |          }n|                    |          }|S rN   )	r  r   r  r6  r  r$  r  rP   r  )rY   rs   outrS   s      rT   r6  zCondExprNode.coerce_to_integerk2  s    }!( 	A M;;C@@DM~") 	C!^==cBBDN &&s++x 	1d{{L#..@@EE ++C00
rU   c                    | j         j        |k    r | j                             ||          | _         | j        j        |k    r | j                            ||          | _        d | _        |                     |          }|j        |k    rD|| u r*t          t          |                              ||          }n|                    ||          }|S rN   )r  r   r  r  r$  r  rP   r  )rY   r	  rs   rj  rS   s       rT   r  zCondExprNode.coerce_to|2  s    =)) M33HcBBDM>(**!^55hDDDN &&s++8xd{{L#..883GG mmHc22
rU   c                     | j         j        j        sA| j        j        j        s0t	          | j        d| j         j        d| j        j        d           t          j        | _        d S )Nz.Incompatible types in conditional expression (rW  r`  )r  r   r  r  r   r   r   r/   rX   s    rT   rO  zCondExprNode.type_error2  sg    "+ 	;t~/B/K 	;$((###T^%8%8%8: ; ; ;)			rU   c                     | j                                         o1| j                                        o| j                                        S rN   )r  r=  r  r  rX   s    rT   r=  zCondExprNode.check_const2  sD    	%%'' -))++-**,,	.rU   c                    |                     | j                   |                     |           | j                            |           |                    d| j                                        z             |                     || j                   |                    d           |                     || j	                   |                    d           | j        
                    |           | j                            |           d S )Nr  r  r   )r  r   r  r  r  r   r  eval_and_getr  r  r  r  r  s     rT   r  z%CondExprNode.generate_evaluation_code2  s     	dh!!$'''	**4000

;!1!1!3!33444$...

:$///

3	((...	T"""""rU   c                    |                     |           | j        j        r|                    |           n|                    |           |                    |                                 d|                    |                                           d           |	                    |           |
                    |           d S r
  )r  r   r   r  r  r   r  r  r   r  r  )rY   r   r  s      rT   ro  zCondExprNode.eval_and_get2  s    %%d+++9' 	,++D1111%%d+++

tzz||0L0L0L0LMNNN**4000rU   c                     d S rN   rW   r  s     rT   r  z+CondExprNode.generate_subexpr_disposal_code2  r   rU   c                     d S rN   rW   r  s     rT   r  zCondExprNode.free_subexpr_temps2  r   rU   )r[   r\   r]   r  r  r   r   rO  r   r(  r   r<  r  r6  r  rO  r=  r  ro  r  r  r^   r_   s   @rT   r  r  12  s*        HIG000H\ \ \, , ,
B B BM M M- - -  ,    "    "* * *. . .
# # #          rU   r  Py_LTPy_LEPy_EQPy_NEPy_GTPy_GE)	r
  r  r  r  z<>r  r  r'  r(  c                   x    e Zd ZdZdZg Zd Zd Zd Zd Z	d Z
ddZd Zd	 Zd
 Zd Zd Zd ZddZd Zd ZdS )CmpNodeNc                     t           S rN   r  r   s     rT   r   zCmpNode.infer_type2  r	  rU   c                    t           | j                 }| j        j        }t	          |t
                    r7t	          |t
                    r"t          |          t          |          k    rd S | j        dv rt	          | j        t          t          t          f          r^| j        j
        s| j        dk    | _        d S t	          | j        t                    r%| j        s| j                                        | _        n8t	          | j        t                    r| j        j        s| j        dk    | _        d S  |||          | _        d S )Nr'  r(  r(  )r*  r   r  r   r   any_string_typer   r  rO  r	  r   cascaderJ	  rM  rL  )rY   operand1_resultr  operand2_results       rT   "calculate_cascaded_constant_resultz*CmpNode.calculate_cascaded_constant_result2  s(   ,T];-788 	?O<<	_%%o)>)>>>F=,,,$-(Iw)GHH 
}) =+/=H+DD(Fx88 = =$(M$:$:$<$<DMDM844 }4 +/=H+DD(F#tO_EErU   c                    t          |           }| j                            |          }	  |||          }n.# t          $ r!}|                     |           d }Y d }~nd }~ww xY w|r!| j        }|r|o|                    ||          }|S rN   )r+  r  r2  r  r6  r  cascaded_compile_time_value)rY   r  r1  r  r  r  r5  r  s           rT   r  z#CmpNode.cascaded_compile_time_value2  s    %d++=33D99	T(H--FF 	 	 	))!,,,FFFFFF	  	XlG XWG$G$GRV$W$Ws   8 
A#AA#c                 F    | j         j        j        p| j        j        j        S rN   r>  rX   s    rT   is_cpp_comparisonzCmpNode.is_cpp_comparison2  s    }!.Q$-2D2QQrU   c                 &   |j         }|j         }d}d}|j        r|                                rd}|j        r|                                rd}|j        r|r|S n8|j        r|r|S n,|r*|r(t          j        ||fv rt          j        S t          j        S d S r>  )	r   rY  r  r  r   r   r   rK  r  )	rY   rs   rn  r  r  r8  r9  type1_can_be_inttype2_can_be_ints	            rT   find_common_int_typezCmpNode.find_common_int_type2  s      % 	$(*M*M*O*O 	$#% 	$(*M*M*O*O 	$#< 	3 \ 	3  	3 3'E5>99%44%22trU   c                    | j         }|j        }|j        }d }|t          k    r|j        s2|t          t
          fv s"|t          k    r5|j        s|t          t
          fv rt          | j        d           t          }n|j	        s|j	        r|dvr9|j	        s|j
        r+|j	        s|j
        rt          | j        d           t          }n|j        r3|                    t          j                  rt          j        nt          }n|j        r3|                    t          j                  rt          j        nt          }n[t!          j        ||          }nE|j
        r|j
        rt!          j        ||          }n!||j        s|                     ||||          }|4|j        s|j        r	t          }n||k    r|}n|j        s|j        r|j
        s|j        r&|                    ||          rt          }nt          }n|j
        s|j        r&|                    ||          rt          }nt          }nt          j        |          rt          j        |          rt          }nm|                     |||           t          }nN|                    |          r|}n6|                    |          r|}n|                     |||           t          }|j        r1t/          |t0                    st/          |t0                    rt          }||j        r|}nt!          j        ||          }| j        r"| j                            || j        ||          }|S )NzFComparisons between bytes/unicode and str are not portable to Python 3r  r  zcomplex types are unordered)r  r   r   r  r   r   r   r   r/   r  r  rq   r   r   r^  r   r   r  r  r1  r  r  invalid_types_errorr   r  r  spanning_typer  find_common_typer   )	rY   rs   rn  r  common_typer  r8  r9  new_common_types	            rT   r  zCmpNode.find_common_type3  s   = X5?e
L?Y6Y6Y!!u!%JP\C]:]:]$(deee(OO  	U!1 	U,&&) '-2-= ') '-2-= ' dh =>>>"," O:?:J:J7K_:`:`"t'"6"6ft" O:?:J:J7K_:`:`"t'"6"6ft","@"N"N 	U%"2 	U(<UEJJOO (? "77R8TTO" -%/ -"0%"'" -e&7 -# 1u 188DD 9*4*8% 
1 
188DD 9*4*8#3E:: 1~?]^c?d?d 1&4OO ,,Xr8DDD&0OO&&u-- -"'&&u-- -"' ((2x@@@",$ 	)*Xy*I*I 	)*4Xy*I*I	) )O /":)KK
 %2;PPK< 	c,77T]HVabbKrU   c           
      X    t          | j        d|d|j        d|j        d           d S )NInvalid types for 'rN  r  r`  )r   r   r   )rY   r  rn  r  s       rT   r  zCmpNode.invalid_types_errorh3  s@    dhhrr8===(---1 	2 	2 	2 	2 	2rU   c                     |                                   oQ|                                  o<|                                 p(| j        o| j                                        p| j        dv S Nr}  )is_ptr_containsis_c_string_containshas_python_operandsr  is_python_comparisonr   rX   s    rT   r  zCmpNode.is_python_comparisonl3  sq    ((*** 7--///7))++ 6\Idl&G&G&I&I6M%55		8rU   c                     | j         }|j        |k    r|                    ||          | _         | j        r| j                            ||           d S d S rN   )r  r   r  r  coerce_operands_to)rY   r	  rs   r  s       rT   r  zCmpNode.coerce_operands_tos3  s_    ==H$$$..x==DM< 	;L++Hc:::::	; 	;rU   c                     |                                  r<| j        d u r3| j        dvr*|                                  r|                                  p| j        o| j                                        S )N)r  r  r'  r(  )r  special_bool_cmp_functionr   r  r  r  is_python_resultrX   s    rT   r  zCmpNode.is_python_resultz3  s    ))++ ,/47,&FF, ..000, ))+++	B
 @!>!>!@!@	CrU   c                     | j         dv oX| j        j        j        r$| j        j        j        p| j        j        t          u p#| j        j        j        o| j        j        t          u S r  )	r   r  r   r  r  r  r   r  r   rX   s    rT   r  zCmpNode.is_c_string_contains3  sd    } 00 :#* Xm(2Vdm6HJ6V9#3 8]'<7		:rU   c                 \    | j         dv r"| j        j        }|j        s|j        o|j         S d S r  )r   r  r   r  rT  r  )rY   container_types     rT   r  zCmpNode.is_ptr_contains3  sC    =,,,!]/N")D^-D 1&001 -,rU   Fc                    | j         dv rp|j        | j        j        }}|s|j        rQ|j        rI|t          j        u s|t          j        u r#t          j        dd          | _        d| _	        dS |t          j
        u s|t          j
        u r#t          j        dd          | _        d| _	        dS |t          j        u s|t          j        u r#t          j        dd          | _        d| _	        dS |t          j        u s|t          j        u r#t          j        dd          | _        d	| _	        dS |rKd
dlm}  || j         dk    rdnd| t          j        || j                  }|r|\  | _	        | _        | _        }dS nk| j         dv ra| j        j        t          j        u rB| j                            d          | _        t          j        dd          | _        d| _	        dS | j        j        t          j        u rB| j                            d          | _        t          j        dd          | _        d| _	        dS | j        j        t          j        u rB| j                            d          | _        t          j        dd          | _        d| _	        dS | j        j        j        s| j                            |          | _        t          j        dd          | _        d| _	        dS dS )Nr  UnicodeEqualsrJ  __Pyx_PyUnicode_EqualsTBytesEquals__Pyx_PyBytes_Equals	StrEquals__Pyx_PyString_Equalsr(   )optimise_numeric_binopr  EqNer}  r  PyDictContainsr  __Pyx_PyDict_ContainsTFPySetContains__Pyx_PySet_ContainsTFPyUnicodeContains__Pyx_PyUnicode_ContainsTFPySequenceContains__Pyx_PySequence_ContainsTFF)r   r   r  r|  r   r   r	   r   special_bool_cmp_utility_coder  r   r2   r   Optimizer  r   r)  special_bool_extra_argsr   rG  r   rq   r   )	rY   rs   r  result_is_boolr8  r9  r  r  r  s	            rT   "find_special_bool_compare_functionz*CmpNode.find_special_bool_compare_function3  s    =L((#=$-*<5E $%"7 $E<Q $G000EW=Q4Q4Q9D9PQ`bq9r9rD65MD24g000EW=O4O4O9D9PQ^`o9p9pD65KD24g555'BY9Y9Y9D9PQ`bq9r9rD65MD24g...%7;K2K2K9D9PQ\^m9n9nD65LD24# $@@@@@@33 $ 5 54".  F  $ %7;5#t]...}!W%666 $ ? ?@c d d5@5LM]_q5r5r21J.t#w'777 $ ? ?@c d d5@5L_^p5q5q21I.t#w';;; $ ? ?@c d d5@5LM`bq5r5r21M.t})5 J$(M$D$DS$I$IDM5@5LMacu5v5v21N.turU   c                 V   | j         j        rF|j        }d|z  }| j        r0|j                            t          j        dd                     d}nd}n|j        }d}d}| j        r	|j         j        r|	                                }	n|
                                }	|j         j        r|	                                }
n|
                                }
d                    d | j        D                       }| j        r|j                            | j                   |                    |d	|d
| j        d
|	d|
d| j        r|nt          |         d| ||| j                             d S |j         j        r|dvr|dvs
J |            | j         j        s| j         t"          j        u sJ |                    |d| j         j        rdndd
|	                                d|	                                dt          |         d| ||| j                             d S |j         j        rl|                    |d	|d
|dk    rdpd|j                             d          d
|
                                d|
                                d           d S |j         }|j         }|j        s|j        r|                    |          st.          }n|j        rt#          j        ||          }n|}|                    |          }|                    |          }|d	|d
|d|                     |          d|d
}|                                 r>| j        dk    r3t=          || j        || j         j        r|nd | j        | j                    d S |                    |           d S )Nz__Pyx_XGOTREF(%s); PyBoolOrNullFromLongr  __Pyx_PyBoolOrNull_FromLong__Pyx_PyBool_FromLongr  r  c                 6    g | ]}|                                 S rW   r  )rc   	extra_args     rT   r   z3CmpNode.generate_operation_code.<locals>.<listcomp>3  s1     8 8 8'0	  ""8 8 8rU   r  r
  z)); )r  r  r}  z = PyObject_RichCompareBoolrc  r  rX  eqr  r*  r  r   )!r   rq   r   r  r   r   r	   r   r  r   r  r  r  r  r   richcmp_constantsr   r   r)  r  rn  r{  r  r   r  r  r  
c_operatorr  r   r   r   r  )rY   r   r  r  rn  r  error_clausegot_refcoerce_resultrr  rs  special_bool_extra_args_resultr8  r9  r  code1code2	statements                     rT   r  zCmpNode.generate_operation_code3  s   9  	2L+k9G- 8 11+,BDVWWY Y Y = 71LGM) H	&}( ,",,.."//++}( ,",,.."//++-1YY 8 8484P8 8 8 . .* 1 V 11$2TUUUJJKK!MM222GGWWW6:6Rm22XijlXmmmG Ldh7779: : : : : ]& 0	&25E+E+E----r---9(ODI9O,O,O,O,OJJKK)/;BBV;;&&((((&&((((%b)))G Ldh7779 : : : : : ]% $	&JJd
"s(b(&&t,,,,!!!!!!!!# $ $ $ $ $ MEME' $5+B $!MM%00$,! $(<UEJJ#&&{33E&&{33E####I %%'' 	&D,@C,G,G'H#'9#8BKKd()+ + + + + 

9%%%%%rU   c                 &    |dk    rdS |dk    rdS |S )Nr  r  r  r  rW   )rY   rn  s     rT   r  zCmpNode.c_operator%4  s#    ::48^^4IrU   rN   rP  )r[   r\   r]   r  r  r  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  rW   rU   rT   rz  rz  2  s&        !%$(!   F F F0  R R R  6Q Q Q Qf2 2 28 8 8; ; ;C C C: : :1 1 1: : : :xX& X& X&t    rU   rz  c                       e Zd Zg 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S )r  )r  r  coerced_operand2r  r  NFc                 6   | j                             |          }| j                            |          }t          |          st          |          rAt	          |          r2t	          |          r#t          t          | j        ||                    S t          S rN   )	r  r   r  r<   r:   rH   r>   r   r   rb  s       rT   r   zPrimaryCmpNode.infer_typeB4  s    ((--((--5!! 	T_U%;%; 	T(// T4Me4T4T T"#5dmUE#R#RSSS rU   c                     dS rw  rW   r   s     rT   rO  z PrimaryCmpNode.type_dependenciesM4  r$  rU   c                 V    | j         rJ |                     | j        j                   d S rN   )r  r  r  r   rX   s    rT   r(  z(PrimaryCmpNode.calculate_constant_resultP4  s/    <//0MNNNNNrU   c                 b    | j                             |          }|                     ||          S rN   )r  r2  r  )rY   r1  r  s      rT   r2  z!PrimaryCmpNode.compile_time_valueT4  s-    =33D99//$???rU   c                 F    | j         }|r| j        |_        |j         }|d S d S rN   )r  r   )rY   cdrs     rT   unify_cascade_typez!PrimaryCmpNode.unify_cascade_typeX4  s?    l 	yCH+C  	 	 	 	 	rU   c                 	   | j                             |          | _         | j                            |          | _        |                                 r3|                     |           | j        rt          | j        d           | S | j         j        }| j        j        }t          |          st          |          rOt          |          r@t          |          r1t          t          | j        ||                    | _        d| _        | S |                     |          r| S | j        r| j                            |          | _        | j        dv r|                                 r&d| _        d }| j        rt          | j        d           | S | j        j        t"          u r)|                    t'          j        dd                     n| j         j        t*          j        u r*| j                             t*          j        |          | _         | j        j        t2          ur%| j                            t2          |          | _        |                    t'          j        dd                     | j                            d          | _        n)|                                 r/| j        rt          | j        d	           t*          j        | _        | S |                     || j                   r:| j         j        j        s| j                             |          | _         d }d| _        nt@          }d
| _        n|                     || j                   r:| j         j        j        s| j                             |          | _         d }d| _        n-| !                    || j        | j                   }|j        | _        |M|j"        sF| j         j        |k    r | j                             ||          | _         | #                    ||           | j        ri| j        $                    |          | _        | j        %                    |           | j        &                    | j        |          }|| j        ur|| _'        | (                                rt*          j         | _        nt*          j        | _        | )                                 | j        s| j        s| j*        rd| _+        | S )Nz5Cascading comparison not yet supported for cpp types.Fr}  z?Cascading comparison not yet supported for 'int_val in string'.PyUCS4InUnicoderJ  BytesContainsz+argument of type 'NoneType' is not iterablez?Cascading comparison not supported for 'val in sliced pointer'.Tr(   ),r  r<  r  r  analyse_cpp_comparisonr  r   r   r   r<   r:   rH   r>   r   is_pycmp"analyse_memoryviewslice_comparisonr  r   r   r	   r   r   r  r  r   r   rG  r  r)  r  rq   r   r   r  r  r  rK   coerce_cascaded_operands_to_tempoptimise_comparisonr  r  r  r  r   )rY   rs   r8  r9  r  r  s         rT   r<  zPrimaryCmpNode.analyse_types^4  s   33C8833C88!!## 	'',,,| Ydh WXXXK""5!! 	_U%;%; 	(// 4Me4T4T '(:4=%QV(W(WXX	 %22377 	K< 	;<55c::DL=,,,((** % %"<  $($efffK=%55(()@ARTc)d)deeee})Z-DDD(,(?(?
@VX[(\(\});;(,(?(?
C(P(P(()@Ra)b)bccc $ ? ?A!C !C%%'' %< g$($efff&2	88dmLL %})5 J$(M$D$DS$I$IDM" %, $44S$-HH 	4=%1 F $ @ @ E EK!DMM//T]DMRRK'3DM";+?"}![00 $ 7 7S I I##K555< 	1 M::3??DML99#>>>|77sKKHt},,(0%  "" 	/"1DII".DI!!!= 	DL 	D,J 	DLrU   c           
      h   | j         j        }| j        j        }d| _        |                    | j        | j         | j        g          }|>t          | j        d| j        d|d|d           t          j	        | _        d| _
        d S |j        }|j        r|j        }|j        | _        |j        | _        | j        dk    r>d| _        t!          |           r(|                    t%          j        d	d
                     t)          |j                  dk    r1| j                            |j        d         j        |          | _        n`| j                             |j        d         j        |          | _         | j                            |j        d         j        |          | _        |j        | _        d S )NFr  rN  r  r`  r  r   Tr  r  r(   r   )r  r   r  r  r  r   r   r   r   r/   r  r  r  r   r   r   r   r   r	   r   r   r   r  r  )rY   rs   r8  r9  r   r  s         rT   r  z%PrimaryCmpNode.analyse_cpp_comparison4  s   ""##DMDM4=3QRR=$((uuu. / / /"-DI(DFJ	 	,!+I(8(83&&DL-d33 j$$[%<=UWg%h%hiiiy~!## M33IN14E4JCPPDMM M33IN14E4JCPPDM M33IN14E4JCPPDM)			rU   c                     | j         j        p| j        j        }| j         j        j        p| j        j        j        }d}|r,|r*| j        |v r!d| _        t          j        | _        d| _	        dS dS )N)r  r  r  r  FT)
r  r  r  r   r   r   r  r   r)  is_memslice_nonecheck)rY   rs   	have_none
have_sliceopss        rT   r  z1PrimaryCmpNode.analyse_memoryviewslice_comparison4  sy    M)BT]-B	m(; <m(; 	* 	) 	(<(<!DM".DI)-D&4urU   c                 \   | j         r|                     || j        d          rnd| _         t          j        | _        d| _        | j        r2| j                            | j	        |d          }|| j	        ur|| _
        |                                  | S t                              | |          S )NT)r  Fr(   )r  r  r  r   r)  r   r   r  r  r  r  r  r   rG  )rY   rs   r  s      rT   rG  z PrimaryCmpNode.coerce_to_boolean4  s    = 	66t 7 = =  %&2	 < 9#|??s4  @  A  AHt}4408-'')))))$444rU   c                 F    | j         j        j        p| j        j        j        S rN   )r  r   rq   r  rX   s    rT   r  z"PrimaryCmpNode.has_python_operands4  s"    ". .}!-	/rU   c                     | j         r|                                  dS | j                                        o| j                                        S rw  )r  rx  r  r=  r  rX   s    rT   r=  zPrimaryCmpNode.check_const4  sI    < 	ONN5=,,..N4=3L3L3N3NNrU   c                 
   | j         | j        }}|j        j        rZ| j        dk    rd}nd}d||j                            d          d|                                d|                                dS |                                 rU|j        t          u rd}nd	}| j        d
k    rd}nd}d||d|                                d|                                dS t          | j                  r)|
                                |
                                }}nF|                                |                                }}| j        r|j        j        rd|z  }nd|z  }d|d|                     | j                  d|dS )Nr  rX  r  r
  r  r  z))__Pyx_UnicodeContainsUCS4__Pyx_BytesContainsr(  ((PyObject *) %s.memview)r*  r`  )r  r  r   r  r   rq  r  r  r   r<   r  r  r   r  )rY   r  r  negationmethodrr  rs  s          rT   r  z$PrimaryCmpNode.calculate_result_code4  s   !]DM(=# &	}$$''----!!!!!!!!	# #
 &&(( 	},,4.}((!!!!!!!!	# # ty)) H#+#:#:#<#<h>U>U>W>W#+??#4#4hoo6G6G- H}7 H"="G"="G .... rU   c                    | j                             |           | j                            |           | j        D ]}|                    |           | j        r|                     |           |                     ||                                 | j         | j        | j                   | j	        rC| j	                            ||                                 | j
        p| j        | j
        d u           | j                             |           | j                             |           | j                            |           | j                            |           d S d S )Nneeds_evaluation)r  r  r  r  r   r  r  r  r   r  r  r  r  )rY   r   r  s      rT   r  z'PrimaryCmpNode.generate_evaluation_code!5  sa   ..t444..t4445 	5 	5I..t4444< 	+%%d+++((t{{}}t}dm= = =| H55$++--)>)O$-%)%:$%F 6 H H H M00666M$$T***M00666M$$T*****	+ 	+rU   c                 n    | j                             |           | j                            |           d S rN   )r  r  r  r  s     rT   r  z-PrimaryCmpNode.generate_subexpr_disposal_code35  s6     	,,T222,,T22222rU   c                 n    | j                             |           | j                            |           d S rN   )r  r  r  r  s     rT   r  z!PrimaryCmpNode.free_subexpr_temps95  s6     	  &&&  &&&&&rU   c                     | j                             |           | j                            |           | j        r| j                            |           d S d S rN   )r  r  r  r  r  s     rT   r  zPrimaryCmpNode.annotate?5  s^    t$$$t$$$< 	(L!!$'''''	( 	(rU   )r[   r\   r]   r   r  r  r  r   rO  r(  r2  r  r<  r  r  rG  r  r=  r  r  r  r  r  rW   rU   rT   r  r  -4  s6       . . .K G!	 	 	  O O O@ @ @  R R Rh* * *6  5 5 5$/ / /O O O( ( (T+ + +$3 3 3' ' '( ( ( ( (rU   r  c                   h    e Zd Zg dZdZdZeZd Zd Z	d Z
d Zd Zd Zdd
Zd Zd ZddZd ZdS )CascadedCmpNode)r  r  r  r  Nc                     t           S rN   r  r   s     rT   r   zCascadedCmpNode.infer_typeW5  r	  rU   c                     dS rw  rW   r   s     rT   rO  z!CascadedCmpNode.type_dependencies[5  r$  rU   c                 :    | j         t          uo| j         t          uS rN   r*  rX   s    rT   r   z#CascadedCmpNode.has_constant_result^5  r-  rU   c                     | j                             |          | _         | j        r| j                            |          | _        | S rN   )r  r<  r  r   s     rT   r<  zCascadedCmpNode.analyse_typesb5  s?    33C88< 	;<55c::DLrU   c                 $    | j         j        j        S rN   )r  r   rq   rX   s    rT   r  z#CascadedCmpNode.has_python_operandsh5  s    }!--rU   c                     dS rw  rW   rX   s    rT   r  z!CascadedCmpNode.is_cpp_comparisonk5  rD  rU   Fc                    |                      |||          r9d| _        t          j        | _        |j        j        s|                    |          }| j        r1| j                            | j	        ||          }|| j	        ur|| _
        |S rw  )r  r  r   r)  r   rq   r   r  r  r  r  )rY   r  rs   r  r  s        rT   r  z#CascadedCmpNode.optimise_comparisono5  s    223.QQ 	<!DM".DI=, <#66s;;< 	1|77sN[[Ht},,(0%rU   c                     | j                             |          | _         | j         j        t          u r(| j        dv r| j                             d          | _         | j        r| j                            |           d S d S )Nr}  r  )r  r   r   r   r   rG  r  r3  r   s     rT   r3  z,CascadedCmpNode.coerce_operands_to_pyobjects{5  s~    88===**t}@P/P/P M;;<_``DM< 	;L55c:::::	; 	;rU   c                     | j         r;| j                            |          | _        | j                             |           d S d S rN   )r  r  rK  r  r   s     rT   r  z0CascadedCmpNode.coerce_cascaded_operands_to_temp5  sI    < 	? M::3??DML99#>>>>>	? 	?rU   c                    | j         j        r4|                    d|z             |                    || j                    n|                    d|z             |r|                    |           | j                            |           | j        D ]}|                    |           |                     |||| j        | j                   | j	        r1| j	                            ||| j
        p| j        | j
        d u           |r*|                    |           |                    |           | j                            |           | j                            |           |                    d           d S )Nz if (__Pyx_PyObject_IsTrue(%s)) {r  r  r   )r   rq   r   r  r  r  r  r  r   r  r  r  r  )rY   r   r  r  r  r  s         rT   r  z(CascadedCmpNode.generate_evaluation_code5  s   9  	-JJ9FBCCCOOFDI....JJ{V+,,, 	4--d333..t4445 	5 	5I..t4444$$T6dmT]	4 	4 	4< 	DL11fd3Dt}!%!6d!B 2 D D D  	&++D111%%%,,T222  &&&

3rU   c                     | j                             |           | j        r| j                            |           d S d S rN   )r  r  r  r  s     rT   r  zCascadedCmpNode.annotate5  sH    t$$$< 	(L!!$'''''	( 	(rU   rP  )r[   r\   r]   r   r  r  r+  r   r   rO  r   r<  r  r  r  r3  r  r  r  rW   rU   rT   r  r  F5  s        . . .K G,O    : : :  . . .  
 
 
 
; ; ;? ? ?   2( ( ( ( (rU   r  )r-  r0  r
  r%  r  r  r$  r   r  r   r&  r  r  r  r  c                 2    t          |         | f||||d|S )N)r   r  r  r  )binop_node_classes)r   r   r  r  r  rJ  s         rT   r  r  5  s>     h'    rU   c                   :     e Zd ZdgZeZ fdZd Zd Zd Z	 xZ
S )r  r>  c                     t          t          |                               |j                   || _        t
          rt          | d| j                   d S d S )Nz
 Coercing )rP   r  r  r   r>  r!   r  rY   r>  rS   s     rT   r  zCoercionNode.__init__5  s]    lD!!**37333 	7dddDHH566666	7 	7rU   c                     d S rN   rW   rX   s    rT   r(  z&CoercionNode.calculate_constant_result5  rj  rU   c                    | j                             |           | j         j        | j        k    rO| j        \  }}}|                    |||dz
  ft	          ddd| j         j        d| j        d                     d S d S )Nr(   coercer%  z] to [])r9  tagr:  )r>  r  r   r   r6   )rY   r   filelinecols        rT   r  zCoercionNode.annotate5  s    $8=DI%%"hOD$MM4s1u-~HHTX]]]TXT]T]T]3^0` 0` 0` a a a a a &%rU   c                     | S rN   rW   r   s     rT   r<  zCoercionNode.analyse_types5  rp  rU   )r[   r\   r]   r   r,  r   r  r(  r  r<  r^   r_   s   @rT   r  r  5  sv        
 wH$O7 7 7 7 7  a a a      rU   r  c                       e Zd ZdZd Zd ZdS )r  zc
    Coerce an object to a memoryview slice. This holds a new reference in
    a managed temp.
    c                     |j         sJ |j        j         rJ t                              | |           || _        d| _        d| _        || _        | j                            |           d S )Nr(   T)r   r   r  r  r   r  r>  r  rY   r>  r	  rs   s       rT   r  z!CoerceToMemViewSliceNode.__init__5  sq    ****8....dC(((	#	--c22222rU   c                     |                     | j                            | j                                        |                                 | j        |                     d S rN   )r   r   from_py_call_coder>  r   r  r   r  s     rT   r  z-CoerceToMemViewSliceNode.generate_result_code5  sZ    

49..H  KKMMH	
 
 	 	 	 	 	rU   N)r[   r\   r]   r  r  r  rW   rU   rT   r  r  5  s<         
3 3 3    rU   r  c                   &    e Zd Zd Zd Zd Zd ZdS )r  c                 J    t                               | |           || _        d S rN   )r  r  r   )rY   r>  new_types      rT   r  zCastNode.__init__
6  s#    dC(((			rU   c                 4    | j                                         S rN   r>  r?  rX   s    rT   r?  zCastNode.may_be_none6      x##%%%rU   c                 @    | j                             | j                  S rN   )r>  r  r   rX   s    rT   r  zCastNode.calculate_result_code6  s    x!!$),,,rU   c                 :    | j                             |           d S rN   r>  r  r  s     rT   r  zCastNode.generate_result_code6      %%d+++++rU   N)r[   r\   r]   r  r?  r  r  rW   rU   rT   r  r  6  sP          & & &- - -, , , , ,rU   r  c                       e Zd ZdZddZej        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S )r  TFc                     |j         s|j        sJ d|j        d|            t                              | |           || _        |                                | _        || _        d S )NzPyTypeTest for z against non extension type )r{  r|  r   r  r  r   r$  r  )rY   r>  r	  rs   r  s        rT   r  zPyTypeTestNode.__init__6  s     ) 	UX-E 	U 	U 	UAD88T	U 	U 	UdC(((	IIKKrU   zPython type testc                     | S rN   rW   r   s     rT   r<  zPyTypeTestNode.analyse_types,6  rp  rU   c                 F    | j         rdS | j                                        S rw  )r  r>  r?  rX   s    rT   r?  zPyTypeTestNode.may_be_none/6  s%    < 	5x##%%%rU   c                 4    | j                                         S rN   r>  r;  rX   s    rT   r;  zPyTypeTestNode.is_simple46      x!!###rU   c                 4    | j                                         S rN   r>  r  rX   s    rT   r  zPyTypeTestNode.result_in_temp76      x&&(((rU   c                 4    | j                                         S rN   )r>  r   rX   s    rT   r   zPyTypeTestNode.is_ephemeral:6  s    x$$&&&rU   c                 4    | j                                         S rN   r>  rV  rX   s    rT   rV  z#PyTypeTestNode.nonlocally_immutable=6      x,,...rU   c                    | j         | j        j         k    s| j        j        s| S | j                                         s| S | j                                        r.| j        r'| j                            d| j         j        z            S | j        S )Nz!Cannot convert NoneType to %.200s)r   r>  r   typeobj_is_availabler?  r  rG  rr   rX   s    rT   	reanalysezPyTypeTestNode.reanalyse@6  s    9%%TX-=%Ky--// 	K8!! 	ddl 	d8--.QTXT]Tb.bcccxrU   c                     d S rN   rW   rX   s    rT   r(  z(PyTypeTestNode.calculate_constant_resultI6  rj  rU   c                 4    | j                                         S rN   r>  r  rX   s    rT   r  z$PyTypeTestNode.calculate_result_codeM6      x   rU   c                    | j                                         r| j         j        rl| j                             | j                                        | j        | j                  }|j        	                    t          j        dd                     nd| j                             | j                                        | j                  }|j        	                    t          j        dd                     |                    d|d|                    | j                             d S t          | j        d           d S )N)exactRaiseUnexpectedTypeErrorr  ExtTypeTestr  r  zICannot test type of extern C class without type object name specification)r   r*  r|  type_test_coder>  r   r  r  r   r   r	   r   r   r   r   r   )rY   r   	type_tests      rT   r  z#PyTypeTestNode.generate_result_codeP6  sa   9))++ 	:y( 
P I44H&&((L(? 5 A A	  11+2I.0B3D 3D E E E E !I44H&&(($,8 8	 11+M;MNNP P PJJJ		4??484446 7 7 7 7 7 $( 9 : : : : :rU   c                 :    | j                             |           d S rN   r>  r  r  s     rT   r  z,PyTypeTestNode.generate_post_assignment_codec6      ..t44444rU   c                     d S rN   rW   r  s     rT   r  z#PyTypeTestNode.allocate_temp_resultf6  r   rU   c                     d S rN   rW   r  s     rT   r  z"PyTypeTestNode.release_temp_resulti6  r   rU   c                 :    | j                             |           d S rN   r>  r  r  s     rT   r  zPyTypeTestNode.free_tempsl6      D!!!!!rU   c                 :    | j                             |           d S rN   )r>  r  r  s     rT   r  z!PyTypeTestNode.free_subexpr_tempso6  s    ##D)))))rU   NrP  )r[   r\   r]   r  r  r+   rr  rs  re  r<  r?  r;  r  r   rV  r+  r(  r  r  r  r  r  r  r  rW   rU   rT   r  r  6  s       
     .K$K  & & &
$ $ $) ) )' ' '/ / /    ! ! !: : :&5 5 5    " " "* * * * *rU   r  c                       e Zd ZdZ	 ddZdZd Zd Zd Zd Z	d	 Z
d
 Zd Ze	 dd            Ze	 dd            Zd Zd Zd Zd ZdS )rE  TrW   c                     t                               | |           |j        | _        |                                | _        || _        || _        t          |pd          | _        d S rw  )	r  r  r   r   r$  exception_type_cnameexception_messager   exception_format_args)rY   r>  rA  rB  rC  s        rT   r  zNoneCheckNode.__init__z6  s]    dC(((H	IIKK$8!!2%*+@+FB%G%G"""rU   Nc                     | S rN   rW   r   s     rT   r<  zNoneCheckNode.analyse_types6  rp  rU   c                     dS rw  rW   rX   s    rT   r?  zNoneCheckNode.may_be_none6  rn  rU   c                 4    | j                                         S rN   r   rX   s    rT   r;  zNoneCheckNode.is_simple6  r!  rU   c                 4    | j                                         S rN   r#  rX   s    rT   r  zNoneCheckNode.result_in_temp6  r$  rU   c                 4    | j                                         S rN   r'  rX   s    rT   rV  z"NoneCheckNode.nonlocally_immutable6  r(  rU   c                 4    | j                                         S rN   r.  rX   s    rT   r  z#NoneCheckNode.calculate_result_code6  r/  rU   c                     | j         j        r| j                                        S | j         j        rd| j                                        z  S t          d          )Nr  zunsupported type)r   rq   r>  r   r   r  r  rX   s    rT   	conditionzNoneCheckNode.condition6  sV    9  	08%%'''Y) 	0.1B1BBB.///rU   rC  Fc                 Z     | ||||          }||_         |                    |           d S rN   )r  put_nonecheck)rR   r>  r   rB  rA  rC  r  r   s           rT   generatezNoneCheckNode.generate6  s>     s3,.?AVWW 04     rU   c                 f    |                                 r|                     ||||||           d S d S rN   )r?  rN  )rR   r>  r   rB  rA  rC  r  s          rT   generate_if_neededz NoneCheckNode.generate_if_needed6  sI     ?? 	vLLd$57KMbdtuuuuu	v 	vrU   c                    |                     d|                                 z             | j        r|                                 t          j        | j        rs|                     d| j        dt	          j        | j        	                    d                    dd
                    fd| j        D                       d           nB|                     d	| j        d | j        	                    d                    d
           | j        r|                                 |                     |                    | j                             |                     d           d S )Nzif (unlikely(%s == Py_None)) {zPyErr_Format(z, "UTF-8z", r  c                 l    g | ]0}d  t          |                              d                    z  1S )z"%s"rR  )rx   r:  )rc   r>  escapes     rT   r   z/NoneCheckNode.put_nonecheck.<locals>.<listcomp>6  sP     D D D # #VVCHHOOG,D,D%E%EE D D DrU   r  zPyErr_SetString(z");r   )r   rK  r  r   r   escape_byte_stringrC  rA  rB  r:  r  r   r   r   )rY   r   rT  s     @rT   rM  zNoneCheckNode.put_nonecheck6  s   

,t~~/?/??	A 	A 	A   	"!!!2% 
	AJJJ)))1*11'::< < < <		 D D D D'+'AD D D E E E E	F G G G G JJJ)))t-44W==>>>>@ A A A   	+((***

4??48,,---

3rU   c                 0    |                      |           d S rN   )rM  r  s     rT   r  z"NoneCheckNode.generate_result_code6  s    4     rU   c                 :    | j                             |           d S rN   r7  r  s     rT   r  z+NoneCheckNode.generate_post_assignment_code6  r8  rU   c                 :    | j                             |           d S rN   r<  r  s     rT   r  zNoneCheckNode.free_temps6  r=  rU   )rW   )rC  rW   F)r[   r\   r]   rU  r  rs  r<  r?  r;  r  rV  r  rK  rd  rN  rP  rM  r  r  r  rW   rU   rT   rE  rE  s6  s.       
 L (*H H H H K    $ $ $) ) )/ / /! ! !0 0 0 di! ! ! [! nsv v v [v
  4! ! !5 5 5" " " " "rU   rE  c                   F    e Zd ZeZeZdZefdZdZd Z	d Z
d Zd Zd Zd	S )
r  r(   c                    |j                             |          st          |j        d|j         z             n!|j         j        r|                    |          }t                              | |           |t          u r}|j         j	        s|j         j
        rt          |          | _         nB|j         j        s|j         j        rt          | _         n|j         j        rt          j        | _         | j         | _        d S |j         j	        s|j         j
        rN|t$          t&          fvr.|j        d         s!t          |j        d|j         d|d           |x| _         | _        d S || _        d S )Nz$Cannot convert '%s' to Python objectra   r  r  r  )r   r  r   r   r  rK  r  r  r   r  r  r{   r  r  r   r   r^  target_typer   r"   rk   )rY   r>  rs   r   s       rT   r  zCoerceToPyTypeNode.__init__6  sy   x11#66 	,#'ACHLMMMMX  	, &&s++CdC(((>!!x! 1SX%; 1,S11		* 1ch.F 1(		$ 1#0	#yDX 		$38#9 		$Z888N+>? 9cggXXXttt%& & & ,0/DI(((  $DrU   zConverting to Python objectc                     dS rw  rW   rX   s    rT   r?  zCoerceToPyTypeNode.may_be_none6  rD  rU   c                     | j         j        }|t          j        k    s|j        r%|j        dk    r| j                             |          S t          | |          S )NrH  )r>  r   r   r)  rq   rr   r9  r+  )rY   rs   r  s      rT   rG  z$CoerceToPyTypeNode.coerce_to_boolean6  sW    8=
...% /*2-6*A*A8**3///&tS111rU   c                 |    | j         j        j        r| j         S | j                             t          j        |          S rN   )r>  r   r  r  r   r5  r   s     rT   r6  z$CoerceToPyTypeNode.coerce_to_integer7  s4    8= 	C8O8%%j&<cBBBrU   c                     | S rN   rW   r   s     rT   r<  z CoerceToPyTypeNode.analyse_types
7  rl  rU   c                 T   |                     | j        j                            | j                                        |                                 | j                  d|                    |                                 | j                             |                     |           d S )NrW  )	r   r>  r   to_py_call_coder  r[  r   r   r  r  s     rT   r  z'CoerceToPyTypeNode.generate_result_code7  s    

HM))!! " " " " ##DKKMM48<<<> 	? 	? 	? 	T"""""rU   N)r[   r\   r]   r   r   r[  r   r  re  r?  rG  r6  r<  r  rW   rU   rT   r  r  6  s         D KG&4 $ $ $ $: 0K  2 2 2C C C  # # # # #rU   r  c                       e Zd ZdZd Zd ZdS )r  r(   c                     |                     |          }t                              | |           t          j        | _        d S rN   )rK  r  r  r   r   r   rY   r>  rs   s      rT   r  zCoerceIntToBytesNode.__init__7  s9    ""3''dC(((&			rU   c           
      b   | j         }|                                }|j        t          j        t          j        t          j        fvr|j        j        r|                    d|d|d           n|                    d|z             |                    d|	                    | j
                  z             |                    d           d }|j        t          j        urC|j                            t          j        d          }|                    |d	|d
           |}|                    |                                 d|d|                    |                                 | j
                             ||j                            |           |                     |           d S )Nzif ((z
 < 0) || (z
 > 255)) {zif (%s > 255) {zOPyErr_SetString(PyExc_OverflowError, "value too large to pack into a byte"); %sr   Fr  z	 = (char)r  z = PyBytes_FromStringAndSize(&z, 1); )r>  r  r   r   r   r  r6  r  r   r   r   r  r  r   r  r  )rY   r   r>  
arg_resultrt  s        rT   r  z)CoerceIntToBytesNode.generate_result_code$7  s   hZZ\\
8J2&3&35 5 5 x ;


JJ


, - - - - 

,z9:::JJ D??48446 7 7 7 JJsOOO8:111>//
0FSX/YYDJJ444<===J

KKMMMMJJ##DKKMM48<<<> 	? 	? 	? N''---T"""""rU   N)r[   r\   r]   r   r  r  rW   rU   rT   r  r  7  s9         G' ' '
# # # # #rU   r  c                   0    e Zd ZdZd Zd Zd Zd Zd ZdS )r  Nc                    t                               | |           || _        d| _        |                    |          st          |j        d|z             | j        j        s| j        j        rh| j	        j
        r7| j	        j        r+| j	        j        j        rt          |j        d|z  d           | j        j        rt          |j        dd           d S d S d S )Nr(   z$Cannot convert Python object to '%s'z=Obtaining '%s' from externally modifiable global Python valuer}   a  Py_UNICODE* has been removed in Python 3.12. This conversion to a Py_UNICODE* will no longer compile in the latest Python versions. Use Python C API functions like PyUnicode_AsWideCharString if you need to obtain a wchar_t* on Windows (and free the string manually after use).)r  r  r   r   r  r   r   r  r  r>  r   r   r  r   )rY   r>  r>  rs   s       rT   r  zCoerceFromPyTypeNode.__init__H7  s   dC(((	66s;; 	H#'8;FH H H9 	!$)"< 	!x !DHN !tx~7Q !WZee! ! ! ! y) !i  ! ! ! ! ! !	! 	!
! !rU   c                     | S rN   rW   r   s     rT   r<  z"CoerceFromPyTypeNode.analyse_types\7  rl  rU   c                 f    | j         j        o%| j         j         o| j                                        S rN   )r   r  rT  r>  r   rX   s    rT   r   z!CoerceFromPyTypeNode.is_ephemeral`7  s-    	 ;);%;XAVAVAXAXXrU   c           
      "   d }| j         j        rw| j        j         t          u rd| j         j                            d          rEd| j         j        t          d          d          z   }t                              | j        |d           |	                    | j         
                    | j                                        |                                 | j        ||| j                             | j         j        r|                     |           d S d S )N__Pyx_PyObject_As__Pyx_PyBytes__Pyx_PyObjectzexpected bytes, NoneType found)from_py_functionspecial_none_cvalue)r   r  r>  r   ro  rF  r   rE  rP  r   r  r   r  r   rp  rq   r  )rY   r   ro  s      rT   r  z)CoerceFromPyTypeNode.generate_result_codec7  s   9 	c48=J#>#>y)445HII c#2TY5OPSTdPePePfPf5g#g 004Aabbb

49..H  $++--4- $ 8 / 
 
 	 	 	
 9  	'  &&&&&	' 	'rU   c                 0    t          | j        d           d S )Nz0Coercion from Python not allowed without the GILr/  r   s     rT   rs  z CoerceFromPyTypeNode.nogil_checks7  s    dhJKKKKKrU   )	r[   r\   r]   rp  r  r<  r   r  rs  rW   rU   rT   r  r  A7  so        
 ! ! !(  Y Y Y' ' ' L L L L LrU   r  c                       e Zd Zej        Zej        dej        dej	        dej
        dej        dej        dej        diZd Zd Zd	Zd
 Zd Zd Zd ZdS )r+  PyList_GET_SIZEPyTuple_GET_SIZEPySet_GET_SIZEPyBytes_GET_SIZEPyByteArray_GET_SIZE__Pyx_PyUnicode_IS_TRUEc                 f    t                               | |           |j        j        r	d| _        d S d S rl  )r  r  r   rq   r   rd  s      rT   r  zCoerceToBooleanNode.__init__7  s:    dC(((8 	DLLL	 	rU   c                     | j         j        j        r:| j                            | j         j                  |                                  d S d S d S rN   )r>  r   rq   _special_builtinsrj   rr  r   s     rT   rs  zCoerceToBooleanNode.nogil_check7  sQ    8=$ 	)?)C)CDHM)R)R)ZNN	 	)Z)ZrU   rK  c                 n    | j         r|                                  dS | j                                        S rw  )r   rx  r>  r=  rX   s    rT   r=  zCoerceToBooleanNode.check_const7  s5    < 	NN5x##%%%rU   c                 :    d| j                                         z  S )Nz	(%s != 0)r.  rX   s    rT   r  z)CoerceToBooleanNode.calculate_result_code7  s    TX__....rU   c           
         | j         sd S | j                            | j        j                  }|| j                                        rd| j                                        z  gng }|                    d|d| j                                        d           |                    | 	                                dd
                    |          d           d S |                    | 	                                d| j                                        d|                    | 	                                | j                             d S )	Nz(%s != Py_None)r
  z) != 0)r  z&&r  r  rc  )r   r{  rj   r>  r   r?  r   r  r   r  r  r  r   )rY   r   	test_funccheckss       rT   r  z(CoerceToBooleanNode.generate_result_code7  sC   | 	F*..tx}==	 CG8CWCWCYCYa'$(*<*<*>*>>??_aFMMMYYY8J8J8L8L8L8LMNNNJJT[[]]]]DIIf4E4E4E4EFGGGGGJJKKMMMMH&&((((**4;;==$(CCCEF F F F FrU   c                     | S rN   rW   r   s     rT   r<  z!CoerceToBooleanNode.analyse_types7  rp  rU   N)r[   r\   r]   r   r)  r   r   r   r   r   frozenset_typer   r"   r   r{  r  rs  re  r=  r  r  r<  rW   rU   rT   r+  r+  w7  s         !D 	!2!3!1!1!3!7!:  
   0K& & &/ / /F F F    rU   r+  c                   &    e Zd Zd Zd Zd Zd ZdS )r  c                     |j         j        r|                    |          }|| _         t                              | |           |                    |           d S rN   )r   r  rK  r  r  r[  r  s       rT   r  zCoerceToComplexNode.__init__7  sY    8 	,&&s++C	dC(((0055555rU   c                 ^   | j         j        j        rm| j         j                            | j                                                   }| j         j                            | j                                                   }n| j                                         }d}| j        j        d|d|dS r  )r>  r   r  r  r  r  ra  )rY   r  r  s      rT   r  z)CoerceToComplexNode.calculate_result_code7  s    8=# 	//0A0ABBI//0A0ABBII))II	$$$				 	rU   c                     d S rN   rW   r  s     rT   r  z(CoerceToComplexNode.generate_result_code7  r   rU   c                     | S rN   rW   r   s     rT   r<  z!CoerceToComplexNode.analyse_types7  rp  rU   N)r[   r\   r]   r  r  r  r<  rW   rU   rT   r  r  7  sP        6 6 6
 
 
      rU   r  c           
         ddl m} t          j        t          j        t          j        dt          j        d           t          j        dt          j        d           gddd          }t          | j	        d|t          j        d	d
          |  || j	                  g          }|                    |          }|j        |k    r|                    ||          }|S )Nr(   )
HasGilNoder   r  r#  T)r   r   r   __Pyx_SoftComplexToDoubleSoftComplexToDoublez	Complex.c)r  r   )r  r  r   r  r  r  r  r)  r  r   r	   r   r<  r   r  )r>  r	  rs   r  
cfunc_typer
  s         rT   r  r  7  s    %%%%%%% 

!':+G
N
N

!*j.Dd
K
K	N  J #"./DkRRZZ(()  D c""DyH~~h,,KrU   c                   0    e Zd Zd ZdZd Zd Zd Zd ZdS )r8  c                     t                               | |           | j        j                                        | _        | j        j        | _        d| _        | j        j        rt          | _	        d S d S rl  )
r  r  r>  r   as_argument_typer   r   rq   r   r$  rd  s      rT   r  zCoerceToTempNode.__init__7  sh    dC(((HM2244	#x79  	/ .D	/ 	/rU   z#Creating temporary Python referencec                     | S rN   rW   r   s     rT   r<  zCoerceToTempNode.analyse_types7  rl  rU   c                 4    | j                                         S rN   r  rX   s    rT   r?  zCoerceToTempNode.may_be_none7  r  rU   c                     | j                             |          | _         | j                                         r| j         S | j         j        | _        | j        | _        | S rN   )r>  rG  r;  r   r$  r   s     rT   rG  z"CoerceToTempNode.coerce_to_boolean7  sP    8--c228 	8OHM	 IrU   c                    |                     |                                 d| j                            |                                           d           | j        r| j        j        s<|                    |                                 |                                            d S |	                    |                                 | j        | j
                    d S d S )Nr  r  r  )r   r  r>  r  r   r  r   r   r  r  r  r  s     rT   r  z%CoerceToTempNode.generate_result_code7  s     	

KKMMMM48--djjll;;;;= 	> 	> 	> 	P9/ Ptzz||<<<<<//ty9=9N5N 0 P P P P P		P 	PrU   N)	r[   r\   r]   r  re  r<  r?  rG  r  rW   rU   rT   r8  r8  7  sk        
/ / / 8K  & & &  
P 
P 
P 
P 
PrU   r8  c                   b     e Zd ZdZdZ fdZd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zd Zd Z xZS )rV  z
    A node that should not be replaced by transforms or other means,
    and hence can be useful to wrap the argument to a clone node

    MyNode    -> ProxyNode -> ArgNode
    CloneNode -^
    Nc                     t          t          |                               |           |j        | _        |                                  d S rN   )rP   rV  r  r   update_type_and_entryr  s     rT   r  zProxyNode.__init__8  sD    i'',,,"2""$$$$$rU   c                 l    | j                             |          | _         |                                  | S rN   )r>  rB  r  r   s     rT   r<  zProxyNode.analyse_types8  s0    8//44""$$$rU   c                 6    | j                             |          S rN   r>  r   r   s     rT   r   zProxyNode.infer_type!8      x""3'''rU   c                     t          | j        dd           }|r|| _        | j        j        | _        t          | j        dd           }|r	|| _        d S d S Nr   r   )r   r>  r   r$  r   )rY   r   	arg_entrys      rT   r  zProxyNode.update_type_and_entry$8  sa    tx.. 	6DI $ 5DDHgt44	 	#"DJJJ	# 	#rU   c                 :    | j                             |           d S rN   r  r  s     rT   r  zProxyNode.generate_result_code-8  r  rU   c                 4    | j                                         S rN   r.  rX   s    rT   r  zProxyNode.result08  r/  rU   c                 4    | j                                         S rN   r   rX   s    rT   r;  zProxyNode.is_simple38  r!  rU   c                 4    | j                                         S rN   r  rX   s    rT   r?  zProxyNode.may_be_none68  r  rU   c                 :    | j                             |           d S rN   )r>  r  r  s     rT   r  z"ProxyNode.generate_evaluation_code98  s    ))$/////rU   c                 :    | j                             |           d S rN   )r>  r  r  s     rT   r  z ProxyNode.generate_disposal_code<8  s    ''-----rU   c                 :    | j                             |           d S rN   r<  r  s     rT   r  zProxyNode.free_temps?8  r=  rU   )r[   r\   r]   r  rs  r  r<  r   r  r  r  r;  r?  r  r  r  r^   r_   s   @rT   rV  rV  8  s          K% % % % %
  
( ( (# # #, , ,! ! !$ $ $& & &0 0 0. . ." " " " " " "rU   rV  c                   n     e Zd Zg ZdZd Zd Zd Zd Zd Z	d Z
 fdZd	 Zd
 Zd Zd Zd Zd Z xZS )r  Nc                     t                               | |           |j        | _        t          |dd           }|r|| _        |j        | _        t          |dd           }|r	|| _        d S d S r  )r  r  r   r   r   r$  r   )rY   r>  r   r  s       rT   r  zCloneNode.__init__M8  s|    dC((("2sFD)) 	1DI # 0DC$//	 	#"DJJJ	# 	#rU   c                 4    | j                                         S rN   r.  rX   s    rT   r  zCloneNode.resultX8  r/  rU   c                 4    | j                                         S rN   r  rX   s    rT   r?  zCloneNode.may_be_none[8  r  rU   c                 6    | j                             |          S rN   )r>  rO  r   s     rT   rO  zCloneNode.type_dependencies^8  rJ  rU   c                 6    | j                             |          S rN   r  r   s     rT   r   zCloneNode.infer_typea8  r  rU   c                     | j         j        | _        | j         j        | _        d| _        t	          | j         dd           }|r|| _        | S )Nr(   r   )r>  r   r$  r   r   r   )rY   rs   r  s      rT   r<  zCloneNode.analyse_typesd8  sH    HM	 H1DHgt44	 	#"DJrU   c                     | j         j        r| j                             ||          S t          t          |                               ||          S rN   )r>  r   r  rP   r  )rY   	dest_typers   rS   s      rT   r  zCloneNode.coerce_tom8  sH    8 	68%%i555Y%%//	3???rU   c                     dS ry  rW   rX   s    rT   r;  zCloneNode.is_simpler8  rB  rU   c                     d S rN   rW   r  s     rT   r  z"CloneNode.generate_evaluation_codeu8  r   rU   c                     d S rN   rW   r  s     rT   r  zCloneNode.generate_result_codex8  r   rU   c                     d S rN   rW   r  s     rT   r  z CloneNode.generate_disposal_code{8  r   rU   c                     | j         r<|                    |                                 |                                            d S d S rN   )r   r  r  r   r  s     rT   r  z'CloneNode.generate_post_assignment_code~8  sB     < 	9OODKKMM4::<<88888	9 	9rU   c                     d S rN   rW   r  s     rT   r  zCloneNode.free_temps8  r   rU   )r[   r\   r]   r   rs  r  r  r?  rO  r   r<  r  r;  r  r  r  r  r  r^   r_   s   @rT   r  r  B8  s         HK	# 	# 	#! ! !& & &/ / /( ( (  @ @ @ @ @
        9 9 9      rU   r  c                   J     e Zd ZdZdZed             Zd Zd Zd fd	Z	 xZ
S )CppOptionalTempCoercionz
    Used only in CoerceCppTemps - handles cases the temp is actually a OptionalCppClassType (and thus needs dereferencing when on the rhs)
    Fc                     | j         j        S rN   )r>  r   rX   s    rT   r   zCppOptionalTempCoercion.type8      x}rU   c                 :    d| j                                         z  S rR  r.  rX   s    rT   r  z-CppOptionalTempCoercion.calculate_result_code8  s    ****rU   c                     d S rN   rW   r  s     rT   r  z,CppOptionalTempCoercion.generate_result_code8  r   rU   c                 X    t          t          |                               |d          S )NFr  )rP   r  r  )rY   r  r  rS   s      rT   r  z-CppOptionalTempCoercion._make_move_result_rhs8  s*     ,d33II&[`IaaarU   rP  )r[   r\   r]   r  r   rb  r   r  r  r  r^   r_   s   @rT   r  r  8  s          G  X+ + +  b b b b b b b b b brU   r  c                       e Zd Zd ZdS )r  c                     |j         r| j                            |          r| S t                              | ||          S rN   )r|  r   r   r  r  r  s      rT   r  zCMethodSelfCloneNode.coerce_to8  sA    # 		(<(<X(F(F 	K""43777rU   N)r[   r\   r]   r  rW   rU   rT   r  r  8  s#        8 8 8 8 8rU   r  c                   2    e Zd ZeZdZg Zd Zd Zd Z	d Z
dS )ModuleRefNodeFc                     | S rN   rW   r   s     rT   r<  zModuleRefNode.analyse_types8  rp  rU   c                     dS rw  rW   rX   s    rT   r?  zModuleRefNode.may_be_none8  rn  rU   c                     t           j        S rN   )r   r/  rX   s    rT   r  z#ModuleRefNode.calculate_result_code8  s    ""rU   c                     d S rN   rW   r  s     rT   r  z"ModuleRefNode.generate_result_code8  r   rU   N)r[   r\   r]   r   r   r   r   r<  r?  r  r  rW   rU   rT   r  r  8  sa         DGH    # # #    rU   r  c                   .    e Zd ZdgZeZdZd Zd Zd Z	dS )DocstringRefNoder	  Tc                 f    t                               | |           |j        j        sJ || _        d S rN   )r   r  r   rq   r	  )rY   r   r	  s      rT   r  zDocstringRefNode.__init__8  s4    $$$$y$$$$			rU   c                     | S rN   rW   r   s     rT   r<  zDocstringRefNode.analyse_types8  rp  rU   c                 b   |                     |                                 d| j                                        d|                    t	          j        d                    d|                    |                                 | j                             |                     |           d S )Nz = __Pyx_GetAttr(r  r  rc  )	r   r  r	  r  r   r0  r   r   r  r  s     rT   r  z%DocstringRefNode.generate_result_code8  s    

KKMMMM49++----"">#?	#J#JKKKK##DKKMM48<<<> 	? 	? 	? 	T"""""rU   N)
r[   r\   r]   r   r   r   r   r  r<  r  rW   rU   rT   r  r  8  sT         xHDG  
  # # # # #rU   r  c                   8    e Zd Zg ZdZddZd Zd Zd ZddZ	dS )	AnnotationNodeFNc                    t                               | |           |[ddlm} t	          j         |d                              |                    }t          |||                                          }|| _	        || _
        dS )z5string is expected to already be a StringNode or NoneNr(   r	  rT  )description)r   r   )r   r  r	  r	  r   r0  writerC  as_utf8_stringr	  r  )rY   r   r  r	  r	  s        rT   r  zAnnotationNode.__init__8  s    $$$$>;;;;;;#1  \:::@@FFH HF6AVAVAXAXYYYF			rU   c                     | S rN   rW   r   s     rT   r<  zAnnotationNode.analyse_types8  rp  rU   c                 8    |                      |          d         S rl  )r  r   s     rT   re  zAnnotationNode.analyse_as_type8  s    ++C0033rU   c                    t          |t                    r|j        }|j        rB|                    |j                  s&t          |j        d| j        j	        z  d           dS dS |j
        r|j        j        r|                    |j        j                  s&t          |j        d| j        j	        z  d           dS |j        j        r^|j                            |          }|r>|                    |j                  s&t!          |j        d| j        j	        z             dS dS dS |j                            |          }|r-|j        r(t          |j        d| j        j	        z  d           dS dS dS t          |j        d           dS )zZMethod checks for cases when user should be warned that annotation contains unknown types.z5Unknown type declaration '%s' in annotation, ignoringr(   r}   z+Unknown type declaration '%s' in annotationz0Unknown type declaration in annotation, ignoringN)r   r  rZ  r   r-  rr   r   r   r	  r   rZ  r#  r  rb  rg  r$  r   pxd_file_loaded)rY   rs   rT  rY  s       rT   _warn_on_unknown_annotationz*AnnotationNode._warn_on_unknown_annotation8  s#   j.11 	)#J 	X::jo.. n
ORVR]Rcckln n n n n nn n $ 	X)? 	X::jn122 r
ORVR]Rcckln n n n n n0 
r)~??DD _(@(@AU(V(V _*.IDKL]]_ _ _ _ __ _ _ _  *~??DD rL$@ rJNSVZVaVggopr r r r r rr r r r JN$VWWWWWrU   c                 B   | j         rg d fS | j        }dx}}|j        ret          |j        dd           |j        D ]*\  }}|j        s|j        dv rd}|s|}|j        dv rd}|}+|r|rt          |j        dd           n0t          |t                    rt          |j        d	d           g d fS |
                    |
          5  |                    |          }|&|                     ||           g |fcd d d            S |j        rt          |j        dd           |r%|s#|j        s|j        st          |j        d           |j        r|                    |           |j        r|                    |          ng }	d d d            n# 1 swxY w Y   |	|fS )NFzSDicts should no longer be used as type annotations. Use 'cython.int' etc. directly.r(   r}   )r   s   typeT)r   s   ctypez9Duplicate type declarations found in signature annotationzTTuples cannot be declared as simple tuples of types. Use 'tuple[type1, type2, ...]'.)r  zWStrings should no longer be used for type declarations. Use 'cython.int' etc. directly.zOPython type declaration in signature annotation does not refer to a Python type)untypedr  rW  r   r   rL  rY  r   r   rO  new_c_type_contextre  r  rq   r  r  r[  r[  r  )
rY   rs   assigned_valuerT  explicit_pytypeexplicit_ctyperr   r   r  r  s
             rT   r  z&AnnotationNode.analyse_type_annotation9  s   < 	t8OY
+00.% 	JNiqrt t t t)9 	' 	'e- :!222&*O) +%*
Z#666%)N!&J n> n
(cklmmmm
I.. 	JNjrsu u u ut8O##n#EE 	f 	f!11#66H00jAAA8|	f 	f 	f 	f 	f 	f 	f 	f + !
q! ! ! !  k~ kx?S kW_Wo k
ik k k" >88=== GQF]e
==cBBBceI'	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f 	f* (""s   	1FA?FFFrN   )
r[   r\   r]   r   r  r  r<  re  r  r  rW   rU   rT   r  r  8  sz         H
 G
 
 
 
  4 4 4X X X:/# /# /# /# /# /#rU   r  c                        e Zd ZdZdgZddgZdZdZdZ fdZ	e
d             Ze
d             Zd	 Zd
 Zd Z fdZd Zd Z xZS )AssignmentExpressionNodez
    Also known as a named expression or the walrus operator

    Arguments
    lhs - NameNode - not stored directly as an attribute of the node
    rhs - ExprNode

    Attributes
    rhs        - ExprNode
    assignment - SingleAssignmentNode
    r   r  FNc                      t          t          |           j        |fi | t          |          | _        t          | j                  }t          |||d          | _        d S )NT)r  r   r  )rP   r  r  rV  r   r  r-   r  )rY   r   r  r   r  assign_expr_rhsrS   s         rT   r  z!AssignmentExpressionNode.__init__Z9  sk    6&--6sCCdCCCS>>#DH--.SoN N NrU   c                     | j         j        S rN   )r   r   rX   s    rT   r   zAssignmentExpressionNode.typea9  r  rU   c                 $    | j         j        j        S rN   )r  r  rr   rX   s    rT   target_namez$AssignmentExpressionNode.target_namee9  s    "''rU   c                 6    | j                             |          S rN   )r   r   r   s     rT   r   z#AssignmentExpressionNode.infer_typei9  r  rU   c                 :    | j                             |           d S rN   )r  rg  r   s     rT   rg  z-AssignmentExpressionNode.analyse_declarationsl9  s    ,,S11111rU   c                 `   | j                             |          | _         | j         j        j        s^| j         j        j        s*| j         j                            |          | j         _        n#t          j        | j                   | j        _         | j                            |          | _        | S rN   )r   r<  r>  r   r   r9  r  r  r   s     rT   r<  z&AssignmentExpressionNode.analyse_typeso9  s     8))#..x|# 	:8<* :  $x|::3?? '+i&9&9#
 /77<<rU   c                 N   || j         j        j        k    r| j        j        }t	          |t
                    r|j        }|                    ||          }||ur|| j        _        | j                                         t	          | j         j        t                    r_t	          | j         j        t                    s@| j         j        j        | j         _        | j         j        j        j        | j         j        _        | S t          t          |                               ||          S rN   )r  r   r   r>  r   r8  r  r  r  r  rP   r  )rY   r	  rs   old_rhs_argrhs_argrS   s        rT   r  z"AssignmentExpressionNode.coerce_to9  s    t*/// (,K+'788 .)o!++Hc::Gk))&..000t2LAA L *4?+>	 J JL*./*=*ADO'/3/B/F/KDO',-t44>>xMMMrU   c                 4    | j                                         S rN   )r   r  rX   s    rT   r  z.AssignmentExpressionNode.calculate_result_code9  r/  rU   c                 :    | j                             |           d S rN   )r  rc	  r  s     rT   r  z-AssignmentExpressionNode.generate_result_code9  s    //55555rU   )r[   r\   r]   r  r   r   r   r  
clone_noder  rb  r   r  r   rg  r<  r  r  r  r^   r_   s   @rT   r  r  F9  s       
 
 wH,'KGJJN N N N N   X ( ( X(( ( (2 2 2  <N N N N N(! ! !6 6 6 6 6 6 6rU   r  rW   r<  rP  (6  
__future__r   cythondeclarer  bintrera  r  os.pathr  r   Errorsr   r   r   r   r   r   r)   r*   Coder	   r
   r  r   r   r   r+   r,   r-   r   r   r.   r/   r0   r1   r   r   r   r   r   r   r   r   r   r"   r2   r#   r3   r4   r%   r$   r   r   Annotater6   r7   	Debuggingr8   
DebugFlagsr   r!   Pythranr9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   __builtin__rI   rv   ry   r~  ImportErrorrx   version_infor'   r  r&   longrL   r,  r+  rm   ro   rn   rp   r  c_const_py_unicode_ptr_typeri   r   r{   r   r   r   r   r   r   r   r   r   rf  rj  r  r}  r  r'  r  r   r]  r  r  r  r%  rC  r   rU  rg  r  r=  rC  r_  r  r  r  r  r  r  r  r!  r0  r4  r>  rO  ry  r  r  r\  r  r  r  r  r  r  r  r  r  r3  r.  rk  r  r  r  r  r  r  r  r  r/  r  r  rO  r  rU	  rh	  rt	  r|	  r  r	  rM  rK  r	  r	  r	  r	  r
  r
  r
  r%
  r,
  r{
  r4
  rC
  r
  rP
  rQ
  r
  r
  r
  r
  r
  r
  r  r  r  r  r  r%  not_invnegr   r+  r)  rW  ra  rh  rq  rw  rz  r  r  r  r  r  rG	  r  r  r  r  r  r  r  r  r  r  r  matmulr  r   ltler  negegtis_r  r  and_truedivfloordivr  modr  or_r  rshiftr  xorr*  r+  r-  rP  rY  r[  r  r  r  r  r  r  compilefindallr  	frozensetr  r  r  r)  r6  r  r  rz  r  r  r  r  r  r  r  r  rE  r  r  r  r+  r  r  r8  rV  r  r  r  r  r  r  r  rW   rU   rT   <module>r     sm&  
 ' & & & & &   
' 
' 
'VV 
'VV 
'vv 
'VV 
'"F
'06
'KQ6
'$f
'/5v
'DJF
'Y_Y_
' f
' %+F
' 8>v
' OUf
'  	
' -3F	
' >DV	
' PVv	
'
 #F
'
 .4V
'
 AG
'
 SYRX
' v
' '-f
' 5;F
' QWPV
' $*6
' =CF
' TZSY
' %f
' 28
' JP
' '-f
' =CF
' !++
' 
' 
			 



   ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( 2 1 1 1 1 1 1 1                   G G G G G G G G G G                                                      
                   $ $ $ $ $ $       ( ( ( ( ( ( ; ; ; ; ; ; ; ;V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V $ # # # # #'&&&&&& g&OO  # # #JclOOO# A!JMMJ$KM
  
  
  
  
 & 
  
  
   !8  W! : i	!
 :-.0g! :346m! :./1h! :457n!  h! k! ! %D! 124r! 78F!  j!#r!!" |  M#!& z_'!( z)*,n)!* z/02t+!, z*+-o-!. z013uz/02vz56L.0q%|4I ,/1r&5IA! ! F  "+ + +* * *"   4( ( (@  .D D D     "  :C C C C Ct C C CL
 
 
 
 
X 
 
 
    .   .> > > > >{ > > >*    ;          B8 8 8 8 8y 8 8 8D    y   
? 
? 
? 
? 
?y 
? 
? 
?T/ T/ T/ T/ T/i T/ T/ T/l0' 0' 0' 0' 0'	 0' 0' 0'f% % %PU  U  U  U  U 	 U  U  U pk k k k k) k k k\F. F. F. F. F. F. F. F.R    :   /' /' /' /' /'~ /' /' /'d!A !A !A !A !A. !A !A !AHs s s s s~ s s sj# # # # #H # # #:X& X& X& X& X& X& X& X&vX2 X2 X2 X2 X2X X2 X2 X2vl( l( l( l( l(> l( l( l(^L( L( L( L( L(h L( L( L(^+J +J +J +J +J~ +J +J +J\ #  #  #  #  #  #  #  #F# # # # #N # # #<9 9 9 9 9x 9 9 9x    >   .. . . . .x . . .`E E E E E E E E    x   8^2 ^2 ^2 ^2 ^2H ^2 ^2 ^2BZ# Z# Z# Z# Z# Z# Z# Z#F    >   :    >   <       <q& q& q& q& q&! q& q& q&hF> F> F> F> F>' F> F> F>Rj j j j j/ j j jZN N N N N- N N Nb    X   .    n   44 4 4 4 4~ 4 4 4ns s s s sX s s slA( A( A( A( A( A( A( A(F4 4 4 4 49 4 4 4nF3 F3 F3 F3 F3x F3 F3 F3RrA rA rA rA rAX rA rA rAj: : : : :( : : :8m m m m m~ m m m`_# _# _# _# _#X _# _# _#D    X   $5 5 5 5 5 5 5 5*# # # # #( # # #>Y# Y# Y# Y# Y#h Y# Y# Y#x'# '# '# '# '#( '# '# '#TX  X  X  X  X X X  X  X vn	 n	 n	 n	 n	H n	 n	 n	n0 0 0 0 08 0 0 0fK# K# K# K# K#8 K# K# K#\[6 [6 [6 [6 [6 [6 [6 [6|[= [= [= [= [=| [= [= [=|9! 9! 9! 9! 9! 9! 9! 9!x'! '! '! '! '!d '! '! '!R' ' ' ' '"9 ' ' 'D+# +# +# +# +#X +# +# +#\h  h  h  h  h  h  h  h V-! -! -! -! -!h -! -! -!`zQ zQ zQ zQ zQx zQ zQ zQz!, !, !, !, !,8 !, !, !,H+< +< +< +< +< +< +< +<\, , , , ,f , , ,7# 7# 7# 7# 7#/ 7# 7# 7#tG# G# G# G# G#8 G# G# G#T!# !# !# !# !#8 !# !# !#H'# '# '# '# '#8_ '# '# '#T, , , , ,H , , ,47 7 7 7 7H 7 7 74_G _G _G _G _Gh _G _G _GD		 	 	 	 	 	 	 	M M M M MX M M M`6 6 6 6 6H 6 6 6>> > > > >x > > >0h h h h h	 h h h"M M M M M M M M ;  ;  ;  ;  ;"  ;  ;  ;F0# 0# 0# 0# 0#j 0# 0# 0#flC lC lC lC lCH lC lC lC^) ) ) ) )} ) ) )X, , , , ,0 , , , , , , , ,, , , ,&    M   :# # # # #n # # #(	 	 	 	 	 	 	 	       $    N   (( ( ( =				    Z Z Z Z Zx Z Z Zz/ / / / /h / / /D) ) ) ) )H ) ) )&# # # # #X # # #</ / / / / / / /&       
/ / / / /i / / /0E E E E EY E E E:k k k.= .= .= .= .=I .= .= .=d 

  
 
 
R9 R9 R9 R9 R98 R9 R9 R9j %	84	FI\ \ \ \ \h \ \ \|	 	 	 	 	 	 	 	/) /) /) /) /)Z /) /) /)d    J   @I/ I/ I/ I/ I/ I/ I/ I/V4 4 4 4 4 4 4 4LoOO       !!(+! 	(+! 	(+	!
 	(+! ! 	(,! ho! ! ! 	! 	(
! 	(/! ! !  !!" 	(,#!$ /			
!
!))/! ! ! 4  A* A* A* A* A* A* A* A*H       6  
M M M M M9 M M M`0 0 0 0 0< 0 0 0;@ ;@ ;@ ;@ ;@l ;@ ;@ ;@|
$ 
$ 
$ 
$ 
$l 
$ 
$ 
$N N N N Nl N N Nb@ @ @ @ @, @ @ @m( m( m( m( m(l m( m( m(` $
 
    i ! ! !   [@ [@ [@ [@ [@g [@ [@ [@|W= W= W= W= W=l W= W= W=tC4 C4 C4 C4 C4H C4 C4 C4Lp p p p p( p p pfD D D D D8 D D DP 





  f f f f ff f f fPV( V( V( V( V(Xw V( V( V(r^( ^( ^( ^( ^(dG ^( ^( ^(D   &	 	 	 	.    8   :    |   2, , , , ,| , , ,"X* X* X* X* X*\ X* X* X*vZ" Z" Z" Z" Z"L Z" Z" Z"zF# F# F# F# F# F# F# F#R%# %# %# %# %#- %# %# %#P3L 3L 3L 3L 3L< 3L 3L 3Ll4 4 4 4 4, 4 4 4n    ,   8  .(P (P (P (P (P| (P (P (PV4" 4" 4" 4" 4" 4" 4" 4"lC C C C C C C CLb b b b bl b b b,	8 	8 	8 	8 	89 	8 	8 	8    H   &# # # # #x # # #,p# p# p# p# p#X p# p# p#f`6 `6 `6 `6 `6x `6 `6 `6 `6 `6s$   !E, ,E:9E:?e 	ee