
    -Ph                        d dl mZmZmZ ddlZ	 ddlZ e eeej	        
                    d          dd                             dk     Z e eeej	        
                    d          dd                             dk     Zn# e$ r	 dZd	Zd	ZY nw xY werd
ZndZd Zej        d             Zd&dZej        d             Zd Zd Zej        d             Zd Zd Zd Zd Zd Zed Znd Zd Zd Zej        d'd            Z ej        d             Z!d Z"ej        d              Z#d! Z$ej        d"             Z%d# Z&d$ Z'd% Z(dS )(   )CTypeCTypedefTypeCStructOrUnionType    N.   )r   	      )r   r	      T__builtin__builtinsc                 \    | dS t          | dd           }|o|                    dd          S )NF
directives
np_pythran)getattrget)envr   s     W/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/Cython/Compiler/Pythran.pyhas_np_pythranr      s6    
{ulD11J>:>>,>>?    c                 b    t          | t                    rt          | j                  S | j        S N)
isinstancer   is_pythran_supported_typetypedef_base_type
is_numerictype_s    r   is_pythran_supported_dtyper      s/    %&& B()@AAAr   ndarrayc           	         | j         r| j        | j        }}t          |t                    r|j        }nYt          |t                    r|                                }n/t          |t                    r|j	        }nt          d|z            t          rd|||fz  S d|d|dd                    d|z            dS | j        r| j        S | j        r|                                 S t          d	| d
t!          |           d          )Nzunsupported type %s!zpythonic::types::%s<%s,%d>pythonic::types::<z,pythonic::types::pshape<,)longz>>zunsupported pythran type z ())	is_bufferndimdtyper   r   cnamer   sign_and_namer   typedef_cname
ValueErrorpythran_is_pre_0_9joinis_pythran_exprpythran_typer   type)Typtyper(   r)   ctypes        r   r1   r1   #   s8   	| sWbhUe/00 	=KEEu%% 	=''))EE|,, 	='EE3e;<<< 	s/52EEE	s MREERWRWRWY\YaYabklpbpYqYqYqYqrr	  
} "!!!
*222tBxxxxH
I
IIr   c                     d| z  S )Nz(typename std::remove_reference<%s>::type )tys    r   type_remove_refr9   ;   s    5::r   c                     | dk    r#dt          |          dt          |          dS dt          |          d| dt          |          dS )	Nz**z8decltype(pythonic::numpy::functor::power{}(std::declval<z>(), std::declval<z>()))decltype(std::declval<z>() z std::declval<>())r1   )optAtBs      r   pythran_binop_typerA   @   sp    	Tzzzl2....0 	0 
 bbb,r"2"2"2"24 	4r   c                 .    d| dt          |          dS )N	decltype(zstd::declval<r<   r=   )r>   r   s     r   pythran_unaryop_typerD   I   s%     
L! !r   c                 z     d                      fd|D                       }t          |          dk    rdnd|z  S )Nr$   c                 &    g | ]} |          S r7   r7   ).0idx
index_codes     r   
<listcomp>z!_index_access.<locals>.<listcomp>P   s!    <<<SC<<<r   r   z[%s]z(%s))r/   len)rI   indicesindexings   `  r   _index_accessrN   N   sH    xx<<<<G<<<==H'lla''FFVx??r   c                     | \  }}|j         rBdt          |j        j                   z   }dt          dd                    dg|z            dS |j        rd|                                z  S |j        r
d|j	        z  S t          d|z            )	Nr   z
pythonic::z::functor::slice{}(r$   0r&   std::declval<%s>()zunsupported indexing type %s!)is_sliceintstepis_nonepythran_builtinsr/   is_intr+   r0   r1   r-   )index_with_typerH   
index_typens       r   _index_type_coder[   T   s    %OC
| >(()))HHcU1W 	 
	 >#j&>&>&@&@@@		# >#j&===
4zA
B
BBr   c                 ^   | j         rU| j        | j        | j        f}| j        j        rd}|d d         }nd}d|dd                    d |D                       dS | j        j        rt          |           S | j        j	        r| 
                                S t          d	| j        z            )
Ncontiguous_slicer   slicer"   (r$   c              3   >   K   | ]}|                                 V  d S r   )pythran_result)rG   vs     r   	<genexpr>z_index_code.<locals>.<genexpr>k   s.      >>!1++-->>>>>>r   r&   zunsupported indexing type %s)rR   startstoprT   rU   r/   r2   rW   
to_pythranr0   ra   r-   )rH   valuesfuncs      r   _index_coderi   b   s    
| $CHch.8 	%DBQBZFFDDD#((>>v>>>>>>>@ 	@	 $#		! $!!###
3ch>
?
??r   c           	      n    t          dt          |           dt          t          |          d          S )Nr;   z>()r&   )r9   r1   rN   r[   )r   rL   s     r   pythran_indexing_typerk   s   s@    ?U&0000   r   c                 ,    t          t          |           S r   )rN   ri   )rL   s    r   pythran_indexing_coderm   z   s    g...r   c                 N    | j         sg S t          | j                  | j        gz   S r   )is_numpy_attributenp_func_to_listobj	attributerh   s    r   rp   rp   }   s,    " 	48$$'777r   c                     dS )NFr7   )names    r   pythran_is_numpy_func_supportedrv      s    ur   c                     t           j        j        d         }t          |           }|D ]}|                    |d           }| dS dS )NnumpyFT)pythrantablesMODULESrp   r   )rh   CurFFLFs       r   rv   rv      sV    ~%g.T"" 	 	A88At$$D|uu tr   c                 ~    t          |           } d                    | d d         dgz             }d|d| d         S )Nz::functorzpythonic::numpy::rp   r/   )rh   
submoduless     r   pythran_functorr      sF    4  D49	{233JJ(2

DHH==r   c                 l    d                     d |D                       }dt          |           d|dS )Nr$   c              3   D   K   | ]}d t          |j                  z  V  dS )rQ   N)r1   r2   )rG   as     r   rc   z$pythran_func_type.<locals>.<genexpr>   s2      NNA(<+?+??NNNNNNr   rC   z{}(z)))r/   r   )rh   argss     r   pythran_func_typer      sA    88NNNNNNNDD#24#8#8#8#8$$$??r   c                    | j         }|j        r'|                    |                                           S t	          |          rR|                                 st          | dd           r-d|                                  d|                                  dS t          |g d          r|                                 S | j        r
dt          z  S |t          |          }| j         j        sJ d|d|                                 d	S )
NentryrC   z){})r0   r   is_float
is_complexzpythonic::%s::Nonezfrom_python<z>(r&   )r2   rW   	cast_coderesultr0   result_in_tempr   is_typerU   rV   r1   is_pyobject	py_result)r>   r4   op_types      r   rf   rf      s   gG~ .  ---w ;R%6%6%8%8 ;GBQU<V<V ; ;299;;::299;;::::wSSSTT yy{{	z 7#&666}W%%7$)EE2<<>>>>::r   c                 8    |D ]}t          | |d          r dS dS )NFT)r   )r   typesattrs      r   r   r      s6      5$&& 	44	5r   c                 8    | j         pt          | j                  S r   )rU   r   r2   )nodes    r   !is_pythran_supported_node_or_noner      s    <?4TY???r   c                 D    d}t          | |          pt          |           S )N)r0   rW   r   r   rU   r   r   r0   r   pythran_supporteds     r   r   r      s)    X5+,,F0F0FFr   c                 D    d}t          | |          pt          |           S )N)r0   rW   r   r   r   r   r   s     r   #is_pythran_supported_operation_typer      s)    M5*++Eu/E/EEr   c                     | j         S r   )r0   r   s    r   r0   r0      s      r   c                 Z    | j         o$t          | j                  o| j        dv o| j         S )N)cstrided)is_numpy_bufferr   r)   modecastr   s    r   is_pythran_bufferr      s;    ! >&@&M&M >J**>38:~?r   c                 P    t          |           } dd                    |           z  S )Nzpythonic/numpy/%s.hpp/r   rs   s    r   pythran_get_func_include_filer      s$    4  D"SXXd^^33r   c                    |                      d           |                      d           |                      d           |                      d           |                      d           |                      dt          z             |                      d           dD ]2}|                      d	|z             |                      d
|z             3dD ]}|                      d|z             d S )Nzpythonic/core.hppzpythonic/python/core.hppzpythonic/types/bool.hppzpythonic/types/ndarray.hppzpythonic/numpy/power.hppzpythonic/%s/slice.hppz<new>)          @   zpythonic/types/uint%d.hppzpythonic/types/int%d.hpp)
floatfloat32float64setr^   tuplerS   complex	complex64
complex128zpythonic/types/%s.hpp)add_include_filerV   )r   its      r   include_pythran_genericr      s   ,---344423335666344403CCDDD!!! = =81<===7!;<<<<4 : :4q89999: :r   )r    r   ))
PyrexTypesr   r   r   cythonry   r   maprS   __version__splitr.   pythran_is_pre_0_9_6ImportErrorrV   r   ccallr   r1   cfuncr9   rA   rD   rN   r[   ri   rk   rm   rp   rv   r   r   rf   r   r   r   r   r0   r   r   r   r7   r   r   <module>r      s   ? ? ? ? ? ? ? ? ? ?  NNNss3(;(A(A#(F(Fqs(KLLMMPVV 5S'*=*C*CC*H*H1*M!N!NOOR[[      G 
  "$!
@ @ @   J J J J0 ; ; ;4 4 4! ! !
 @ @ @
C C C@ @ @"  / / /8 8 8
 ?     > > >
@ @ @
 ; ; ; ;2   @ @ @ G G GF F F ! ! !? ? ?4 4 4: : : : :s   A6B BB