HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/numpy/f2py/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/numpy/f2py/__pycache__/auxfuncs.cpython-36.pyc
3

���h�T�R@s�dZddlZddlZddlZddlmZddlmZddlmZddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXgRZ	ej
Zejj
ZejZiZgZdZdYdT�ZdZd�Zd[d\�Zd]dD�Zd^d_�Zd`dE�Zdad�Zdbd�ZdcdB�Zddd�Zded5�Zdfd(�Zdgdh�Zdidj�Z dkd:�Z!dldK�Z"dmdO�Z#dndJ�Z$dodM�Z%dpd"�Z&dqd8�Z'drd7�Z(dsd�Z)dtd'�Z*dudL�Z+dvdP�Z,dwdx�Z-dydN�Z.dzd{�Z/d|d}�Z0d~d�Z1d�dC�Z2d�d�Z3d�d��Z4d�d=�Z5d�d<�Z6d�d%�Z7d�d&�Z8d�dG�Z9d�dH�Z:d�d��Z;d�dA�Z<d�d6�Z=d�d;�Z>d�d9�Z?d�d �Z@d�d!�ZAd�dF�ZBd�d�ZCd�dI�ZDd�d��ZEd�d>�ZFd�d$�ZGd�d@�ZHd�d/�ZId�d0�ZJd�d3�ZKd�d.�ZLd�d2�ZMd�d*�ZNd�d��ZOd�d,�ZPd�d4�ZQd�d+�ZRd�d1�ZSd�d)�ZTd�d��ZUd�d��ZVd�d��ZWeId�eJd�eKd�eLd�eOd�eNd�eFd�eSd�eUd�eVd�eWd�iZXd�d?�ZYd�d�ZZd�d��Z[d�d�Z\d�d�Z]d�d�Z^d�d��Z_d�d„Z`d�d�Zad�d�Zbd�dƄZcd�dȄZdGd�dʄd�ee�ZfGd�dX�dX�Zgd�dQ�Zhd�dS�Zid�dR�Zjd�d#�Zkd�d�Zld�d�d҄Zmd�d�Znifd�d
�Zod�d�Zpd�d�Zqd�d�Zrd�dلZsd�d�Ztd�d�Zud�d�Zvd�dބZwd�dW�Zxd�d�dU�Zyd�d	�Zzifd�d�Z{dS)�aW

Auxiliary functions for f2py2e.

Copyright 1999,2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy (BSD style) LICENSE.


NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
$Date: 2005/07/24 19:01:55 $
Pearu Peterson

�N)�reduce�)�__version__)�cfuncs�
applyrules�	debugcapi�
dictappend�errmess�gentitle�getargs2�getcallprotoargument�getcallstatement�getfortranname�getpymethoddef�
getrestdoc�getusercode�getusercode1�hasbody�hascallstatement�	hascommon�hasexternals�hasinitvalue�hasnote�
hasresultnote�
isallocatable�isarray�isarrayofstrings�	iscomplex�iscomplexarray�iscomplexfunction�iscomplexfunction_warn�isdouble�isdummyroutine�
isexternal�
isfunction�isfunction_wrap�isint1array�	isinteger�isintent_aux�
isintent_c�isintent_callback�
isintent_copy�
isintent_dict�
isintent_hide�isintent_in�isintent_inout�isintent_inplace�isintent_nothide�isintent_out�isintent_overwrite�	islogical�islogicalfunction�islong_complex�
islong_double�islong_doublefunction�islong_long�islong_longfunction�ismodule�ismoduleroutine�
isoptional�	isprivate�
isrequired�	isroutine�isscalar�issigned_long_longarray�isstring�
isstringarray�isstringfunction�issubroutine�issubroutine_wrap�isthreadsafe�
isunsigned�isunsigned_char�isunsigned_chararray�isunsigned_long_long�isunsigned_long_longarray�isunsigned_short�isunsigned_shortarray�l_and�l_not�l_or�outmess�replace�show�
stripcomma�throw_errorcCstjdd�rtjj|�dS)N�verboser)�options�get�sys�stdout�write)�t�r_�4/tmp/pip-build-5_djhm0z/numpy/numpy/f2py/auxfuncs.pyrS>scCsdtkS)NZcapi)�debugoptions)�varr_r_r`rCscCsd|ko|ddkot|�S)N�typespec�	character)r#)rbr_r_r`�	_isstringGsrecCst|�ot|�S)N)rer)rbr_r_r`rCLscCst|�od|kS)NZcharselector)rC)rbr_r_r`�ischaracterPsrfcCst|�ot|�S)N)rre)rbr_r_r`rDTscCst|�o|dddkS)N�	dimensionrz(*)���)rD)rbr_r_r`rXscCsd|kot|�S)Nrg)r#)rbr_r_r`r^scCst|�pt|�pt|�S)N)rrCr#)rbr_r_r`rAbscCst|�o|jd�dkS)Nrc�complex�double complex)rirj)rArZ)rbr_r_r`rfscCst|�o|jd�dkS)Nrc�logical)rArZ)rbr_r_r`r4kscCst|�o|jd�dkS)Nrc�integer)rArZ)rbr_r_r`r'oscCst|�o|jd�dkS)Nrc�real)rArZ)rbr_r_r`�isrealssrncCsHy|ddStk
rBy|ddStk
r<YnXYnXdS)NZkindselector�*�kind)�KeyError)rbr_r_r`�get_kindwsrrcCs*t|�sdS|jd�dkrdSt|�dkS)Nrrcrlrk�8)rlrk)rArZrr)rbr_r_r`r9�s
cCs*t|�sdS|jd�dkrdSt|�dkS)Nrrcrlz-1)rArZrr)rbr_r_r`rJ�s
cCs*t|�sdS|jd�dkrdSt|�dkS)Nrrcrlz-2)rArZrr)rbr_r_r`rN�s
cCs*t|�sdS|jd�dkrdSt|�dkS)Nrrcrlz-4)rArZrr)rbr_r_r`rI�s
cCs*t|�sdS|jd�dkrdSt|�dkS)Nrrcrlz-8)rArZrr)rbr_r_r`rL�s
cCs*t|�sdS|jd�dksdSt|�dkS)Nrrcrmrs)rArZrr)rbr_r_r`r!�s
cCs*t|�sdS|jd�dksdSt|�dkS)NrrcrmZ16)rArZrr)rbr_r_r`r7�s
cCst|�sdSt|�dkS)NrZ32)rrr)rbr_r_r`r6�scCst|�o|jd�dkS)Nrcri�double complex)rirt)rrZ)rbr_r_r`r�scCs"t|�o |jd�dko t|�dkS)Nrcrl�1)rrZrr)rbr_r_r`r&�scCs"t|�o |jd�dko t|�dkS)Nrcrlrkz-1)rlrk)rrZrr)rbr_r_r`rK�scCs"t|�o |jd�dko t|�dkS)Nrcrlrkz-2)rlrk)rrZrr)rbr_r_r`rO�scCs"t|�o |jd�dko t|�dkS)Nrcrlrkz-4)rlrk)rrZrr)rbr_r_r`�isunsignedarray�srvcCs"t|�o |jd�dko t|�dkS)Nrcrlrkz-8)rlrk)rrZrr)rbr_r_r`rM�scCs"t|�o |jd�dko t|�dkS)Nrcrlrkru)rlrk)rrZrr)rbr_r_r`�issigned_chararray�srwcCs"t|�o |jd�dko t|�dkS)Nrcrlrk�2)rlrk)rrZrr)rbr_r_r`�issigned_shortarray�srycCs"t|�o |jd�dko t|�dkS)Nrcrlrk�4)rlrk)rrZrr)rbr_r_r`�issigned_array�sr{cCs"t|�o |jd�dko t|�dkS)Nrcrlrkrs)rlrk)rrZrr)rbr_r_r`rB�scCsd|kod|dkS)N�attrspecZallocatabler_)rbr_r_r`r�scCsd|kpt|�S)Nrg)rC)rbr_r_r`�	ismutable�sr}cCsd|kS)N�
modulenamer_)�routr_r_r`r<�scCsd|kod|dkS)N�block�moduler_)rr_r_r`r;�scCsd|kod|dkS)Nr��functionr_)rr_r_r`r$scCs"t|�rdSto t|�o t|�S)Nr)r)�	wrapfuncsr$r#)rr_r_r`r%scCsd|kod|dkS)Nr�Z
subroutiner_)rr_r_r`rF
scCst|�rdSt|�ot|�S)Nr)r)rF�hasassumedshape)rr_r_r`rGscCsZ|jd�rdSxF|dD]:}x4|dj|i�jdg�D]}|dkr6d|d<dSq6WqWdS)Nr�T�args�varsrg�:F)rZ)r�a�dr_r_r`r�s
r�cCst|�pt|�S)N)r$rF)rr_r_r`r@scCsFt|�sdSd|kr|d}n|d}||dkrBt|d|�SdS)Nr�result�namer�)r$r4)rr�r_r_r`r5#s
cCsFt|�sdSd|kr|d}n|d}||dkrBt|d|�SdS)Nrr�r�r�)r$r9)rr�r_r_r`r:/s
cCsFt|�sdSd|kr|d}n|d}||dkrBt|d|�SdS)Nrr�r�r�)r$r7)rr�r_r_r`r8;s
cCsFt|�sdSd|kr|d}n|d}||dkrBt|d|�SdS)Nrr�r�r�)r$r)rr�r_r_r`rGs
cCst|�rtd�dSdS)Na�    **************************************************************
        Warning: code with a function returning complex value
        may not work correctly with your Fortran compiler.
        Run the following test before using it in your applications:
        $(f2py install dir)/test-site/{b/runme_scalar,e/runme}
        When using GNU gcc/g77 compilers, codes should work correctly.
    **************************************************************
rr)rrS)rr_r_r`r Ss
cCsFt|�sdSd|kr|d}n|d}||dkrBt|d|�SdS)Nrr�r�r�)r$rC)rr�r_r_r`rEas
cCsd|ko|dS)NZ	externalsr_)rr_r_r`rmscCsd|kod|dkS)N�f2pyenhancementsZ
threadsafer_)rr_r_r`rHqscCsd|ko|dS)Nr�r_)rr_r_r`�hasvariablesvsr�cCs(d|ko&d|dko&d|dko&t|�S)Nr|�optional�required)r1)rbr_r_r`r=zscCsd|kod|dkS)Nr|Zexternalr_)rbr_r_r`r#scCst|�ot|�S)N)r=r1)rbr_r_r`r?�scCspd|krdSd|dkrdSd|dkr,dSd|dkr<dSd|dkrLdSd|dkr\dSd	|dkrldSdS)
N�intentr�hider�inplace�in�out�inout�outinr_)rbr_r_r`r.�scCsDd|koBd|dks d|dkoBd|dkoBd|dkoBd|dkS)Nr�r�r�r�r�r�r_)rbr_r_r`r/�scCsd|jdg�kS)Nr�r�)rZ)rbr_r_r`r2�scCs<d|ko:d|dkp:d|dko:d|dko:ttt�|�S)Nr�r�r�r�)rRr/r0)rbr_r_r`r-�scCs
t|�S)N)r-)rbr_r_r`r1�scCsd|jdg�kS)N�cr�)rZ)rbr_r_r`r)�scCsd|jdg�kS)N�cacher�)rZ)rbr_r_r`�isintent_cache�sr�cCsd|jdg�kS)N�copyr�)rZ)rbr_r_r`r+�scCsd|jdg�kS)N�	overwriter�)rZ)rbr_r_r`r3�scCsd|jdg�kS)N�callbackr�)rZ)rbr_r_r`r*�scCsd|jdg�kS)Nr�r�)rZ)rbr_r_r`r0�scCsd|jdg�kS)NZauxr�)rZ)rbr_r_r`r(�scCsd|jdg�kS)NZaligned4r�)rZ)rbr_r_r`�isintent_aligned4�sr�cCsd|jdg�kS)NZaligned8r�)rZ)rbr_r_r`�isintent_aligned8�sr�cCsd|jdg�kS)NZ	aligned16r�)rZ)rbr_r_r`�isintent_aligned16�sr�Z	INTENT_INZINTENT_INOUTZ
INTENT_OUTZINTENT_HIDEZINTENT_CACHEZINTENT_CZOPTIONALZINTENT_INPLACEZINTENT_ALIGNED4ZINTENT_ALIGNED8ZINTENT_ALIGNED16cCsd|kod|dkS)Nr|Zprivater_)rbr_r_r`r>�scCsd|kS)N�=r_)rbr_r_r`r�scCst|�sdS|dddkS)Nrr��"�')r�r�)r)rbr_r_r`�hasinitvalueasstring�sr�cCsd|kS)NZnoter_)rbr_r_r`r�scCsFt|�sdSd|kr|d}n|d}||dkrBt|d|�SdS)Nrr�r�r�)r$r)rr�r_r_r`r�s
cCsd|kS)N�commonr_)rr_r_r`r�scCs6t|�rdSt|�r2x|dD]}t|�rdSqWdS)Nr�bodyr)rr�containscommon)r�br_r_r`r�sr�cCs:t|�rdSt|�sdSx|dD]}t|�r"dSq"WdS)Nrrr�)r;r�containsmodule)r�r�r_r_r`r�
sr�cCsd|kS)Nr�r_)rr_r_r`rscCst|�dk	S)N)r
)rr_r_r`rscCsdS)Nrr_)rbr_r_r`�istruesr�cCsdS)Nrr_)rbr_r_r`�isfalse!sr�c@seZdZdS)�	F2PYErrorN)�__name__�
__module__�__qualname__r_r_r_r`r�%sr�c@seZdZdd�Zdd�ZdS)rWcCs
||_dS)N)�mess)�selfr�r_r_r`�__init__+szthrow_error.__init__cCsd||jf}t|��dS)Nz

  var = %s
  Message: %s
)r�r�)r�rbr�r_r_r`�__call__.szthrow_error.__call__N)r�r�r�r�r�r_r_r_r`rW)scGsRdg}}x0tt|��D] }d|||f}|jd|�qWtd|dj|�f�S)Nzlambda vz%s,f%d=f[%d]zf%d(v)z%s:%sz and )�range�len�append�eval�join)�f�l�l2�ir_r_r`rP3s

cGsRdg}}x0tt|��D] }d|||f}|jd|�qWtd|dj|�f�S)Nzlambda vz%s,f%d=f[%d]zf%d(v)z%s:%sz or )r�r�r�r�r�)r�r�r�r�r_r_r`rR;s

cCstd�S)Nzlambda v,f=f:not f(v))r�)r�r_r_r`rQCscCs*y|dddkStk
r$dSXdS)Nr��fortranname�r)rq)rr_r_r`r"GscCsVy4|dd}|dkrt�|s2td|d�t�Wntk
rP|d}YnX|S)Nr�r�r�z"Failed to use fortranname from %s
r�)rqr	)rr�r_r_r`rNsc
Csy|dj|�}Wntk
r&dSX|s0dS|dkrFt|t�rFdSt|t�rh|t|�kr`dS||}|dd�dk�r|r�d|dt|�d|dd�}n|dd�}|dd�dkr�|r�|dd�dt|�d	}n|dd
�}ntd
|t|�f�|S)Nr�r�z'''z
	/* start z multiline (z) */
z
	/* end multiline (z)*/z-%s multiline block should end with `'''`: %s
���r�r�)rZrq�
isinstance�str�listr��reprr	)rZ	blockname�comment�counter�rr_r_r`�getmultilineblock\s.
&r�cCs
t|d�S)NZ
callstatement)r�)rr_r_r`r
zsc
Cst|ddd�}|r|St|�r*td�dSddlm}gg}}tttt��|�r`|j	ddg�x�|d	D]�}|d
|}t
|�r�qj||kr�||d}nJ||�}tttt
t��|�r�nt|�r�n|d}t|�s�t|�r�|jd�|j|�qjWd
j||�}	|	�s
d}	|	S)NZcallprotoargumentr)r�z<warning: callstatement is defined without callprotoargument
r)�getctypezchar*Zsize_tr�r�Z_typedefro�,�void)r�rrSZ	capi_mapsr�rPrErQr%�extendr*r)rRrArrCrr�r�)
rZcb_mapr�r�Z	arg_typesZ
arg_types2�nrb�ctypeZ
proto_argsr_r_r`r~s<

cCs
t|d�S)N�usercode)r�)rr_r_r`r�scCst|ddd�S)Nr�r)r�)r�)rr_r_r`r�scCs
t|d�S)NZpymethoddef)r�)rr_r_r`r�scCsxgg}}d|krp|d}d|krhx"|dD]}||kr,|j|�q,Wx(|D]}||krL|j|�qLWn|d}||fS)Nr��sortvars)r�)r�sortargsr�r�r_r_r`�getargs�s

r�cs�g�jdg�}���fdd��dj�D�}|��d�kr�x"�dD]}|�krH|j|�qHWx,�D]}||krh|j|�qhWn|�d}�|fS)Nr�cs(g|] }t�d|�r|�kr|�qS)r�)r()�.0r�)r�rr_r`�
<listcomp>�szgetargs2.<locals>.<listcomp>r�r�)rZ�keysr�)rr�Zauxvarsr�r_)r�rr`r�s
cCs<d|krdSd}|ddkr,|d|df}|dj|d�S)NZf2pymultilinesr�z
python moduler�)rZ)r�kr_r_r`r�scCs*dt|�dd}d|d||dfS)N�P��z/*%s %s %s*/ro)r�)r�r�r_r_r`r
�scCs$t|t�rttfdd�|g�S|gS)NcSs|||�S)Nr_)�x�yr�r_r_r`�<lambda>�szflatlist.<locals>.<lambda>)r�r�r�flatlist)r�r_r_r`r��s
r�cCs |r|ddkr|dd�S|S)Nrr�rhrhr_)�sr_r_r`rV�sr�cs�t�t�r��fdd��D�St�t�r<��fdd��D�Sx�dt�j��D]v}|dkr\qNd�kr~|�dkr~�d|}n�}t�|t�r��jd||jt�|����qN�jd|�|��qNW�S)Ncsg|]}t�|���qSr_)rT)r��_m)�
defaultsepr�r_r`r��szreplace.<locals>.<listcomp>csg|]}t|����qSr_)rT)r�r�)r�r�r_r`r��sr��
separatorsforz#%s#)r�r�r�rTr�r�)r�r�r�r��sepr_)r�r�r�r`rT�s

 cCs@t|t�r&x|D]}t||�}qW|S�x|j�D�]}|ddkrFq2||k�r,t||t�rl||g||<t||t�r�t||t�r�||||||<n||j||�nxt||t��r8t||t��r8|dk�rxL||j�D]$}|||kr�||||||<q�Wnt||||�||<q2||||<q2W|S)Nr�_r�)r�r�rr�r�r��dict)�rd�arr�r��k1r_r_r`r�s.



cCs�i}t|t�r@x,|D]$}t|||�}t||�}d|krPqW|Sd|krZ|d|�rZ|Sd|kr�td|di||�}d|kr�tj|d��x |j�D�]}|dkr�||||<q�t||t�r�t|||�||<�n�t||t��r0g||<x:||D].}t||i||�}	||	kr�||j	|	|�q�W�n:|ddk�rDq��n&t||t
��rVg||<x�||j�D]�}
t|
tj��rj|
|��rjt|||
t��r�x�|||
D]N}t|t
��r�td|i||�}d|k�r�|d}nd	}||j	t||���q�WnR|||
}t|t
��r:td|i|�}d|k�r6|d}nd	}||j	t||���qjWnt
d
t||��t||t�r�t||�dk�r�||d||<||gkr�||=q�W|S)N�_break�_checkZneedZneedsr�rr�Z	supertextr�zapplyrules: ignoring rule %s.
r)r�r�rrrZappend_needsr�r�rTr�r��types�FunctionTyper	r�r�)�rulesr�rb�retr�Zrr�resr�r�r�r�r_r_r`rsl







)rr)r�)|�__doc__�pprintr[r��	functoolsrr�rr�__all__�versionZf2py_version�stderrr]r	rUrYrar�rSrrerCrfrDrrrArr4r'rnrrr9rJrNrIrLr!r7r6rr&rKrOrvrMrwryr{rBrr}r<r;r$r%rFrGr�r@r5r:r8rr rErrHr�r=r#r?r.r/r2r-r1r)r�r+r3r*r0r(r�r�r�r,r>rr�rrrr�r�rrr�r��	Exceptionr�rWrPrRrQr"rr�r
rrrrr�rrr
r�rVrTrrr_r_r_r`�<module>s"






$