Your IP : 216.73.216.213


Current Path : /opt/alt/python27/lib64/python2.7/site-packages/numpy/core/
Upload File :
Current File : //opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyc

�
��]c@`s�dZddlmZmZmZddlZddlZddlmZddl	m
Z
mZmZyddl
Z
Wnek
r�dZ
nXddlmZejdkr�d	Znd
Zd�Zd�Zd
�Zd�Zejd�Zejd�Zejd�Zied6Zd�Zdefd��YZd�Z de _!defd��YZ"defd��YZ#d�Z$d�Z%d�Z&d�Z'idd6d d!6d"d"6d#d#6d$d$6d%d%6d&d&6d'd'6d(d(6d)d)6d*d*6d+d+6d,d,6d-d-6d.d.6d/d/6d0d16d2d36d4d56d6d76d8d96d:d:6d;d<6Z(d=j)e(j*��Z+idd6d d!6d"d"6d#d#6d>d$6d?d%6d@d&6dAd'6d@d(6dAd)6dBd*6dCd+6dDd,6d-d-6d.d.6d0d16d2d36d6d76d8d96d:d:6d;d<6Z,d=j)e,j*��Z-dE�Z.dF�Z/dG�Z0dH�Z1dI�Z2dJ�Z3dK�Z4dLe5fdM��YZ6dNe7e8fdO��YZ9dP�Z:dQ�Z;dS(Rs_
A place for code to be called from core C-code.

Some things are more easily handled Python.

i(tdivisiontabsolute_importtprint_functionN(t
basestringi(tdtypetarraytndarray(tobject_tlittlet<t>cC`s�g}t|j��}x�|D]�}||}t|�}t|t�sW|d
krftd��n|dkr�|d|kr�qnt|d�}|dkr�td��nt|dd|�}|dkr�|d}	nd}	|j	||||	f�qW|j
dd	��g|D]}
|
d^q}g|D]}
|
d^q<}g|D]}
|
d^qY}
g|D]}
|
d^qv}|||
|fS(Niisentry not a 2- or 3- tupleiisinvalid offset.taligntkeycS`s|dS(Ni((tx((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt<lambda>-t(ii(tlisttkeystlent
isinstancettuplet
ValueErrortintRtNonetappendtsort(tadictRt	allfieldstfnamestfnametobjtntnumtformatttitleR
tnamestformatstoffsetsttitles((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt_makenames_lists.


cC`s�y|d}Wntk
r'd}nX|dkrRt||�\}}}}n�g}g}g}xm|D]e}||}|j|d�|j|d�t|�dkr�|j|d�qk|jd�qkWti|d6|d6|d6|d6|�S(	Ni����iiiR#R$R%R&(tKeyErrorRR'RRR(RRR#R$R%R&tnametres((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt
_usefields8s(




c
C`s�|j}|dkr�|j}|dkrl|jdkr@|jS|jj�}|rb|j|fS|jSq�t|d�|dfSn|j}g|D]}|||f^q�}g}d}x�|D]�}	|	d|kr|	d|}
|jdd|
f�||
7}nt	|	�dkr8|	d|	df}n
|	d}|	djr}|t|	djd�|	djdf}n|t|	d�f}||	dj
7}|j|�q�W|j
|kr�|j
|}
|jdd|
f�n|S(NiiRs|V%dii(tfieldsRtsubdtypetmetadatatstrtcopyt_array_descrR#RRtitemsize(
t
descriptorR,R-tnewR#R
tordered_fieldstresulttoffsettfieldR R)ttup((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyR1XsB		

	$




cC`stj|||�S(N(Rt__new__(tsubtypetshapeR((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt_reconstruct�ssx(?P<order1>[<>|=]?)(?P<repeats> *[(]?[ ,0-9L]*[)]? *)(?P<order2>[<>|=]?)(?P<dtype>[A-Za-z0-9.?]*(?:\[[a-zA-Z0-9,.]+\])?)s\s*,\s*s\s+$t=c
C`s�d}g}x�|t|�kr�tj|d|�}y|j�\}}}}Wn7ttfk
r�tdt|�d|f��nX|j�}|t|�krtj|d|�r�t|�}qt	j|d|�}|stdt|�d|f��n|j�}n|dkr0|}nd|dkrE|}nOt
j||�}t
j||�}||kr�td||f��n|}|ddtgkr�d}n||}|dkr�|}	n|t
|�f}	|j|	�qW|S(	Nitposs*format number %d of "%s" is not recognizediRs/inconsistent byte-order specification %s and %st|R>(Rt	format_retmatchtgroupst	TypeErrortAttributeErrorRtendtspace_retsep_ret
_convordertgett_nbotevalR(
tastrt
startindexR6tmotorder1trepeatstorder2Rtordertnewitem((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt_commastring�sL			
	tdummy_ctypecB`s,eZd�Zd�Zd�Zd�ZRS(cC`s
||_dS(N(t_cls(tselftcls((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt__init__�scC`s|S(N((RXtother((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt__mul__�scG`s
|j|�S(N(RW(RXR[((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt__call__�scC`s|j|jkS(N(RW(RXR[((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt__eq__�s(t__name__t
__module__RZR\R]R^(((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyRV�s			cC`s�tj}|dk	r|StdkrCddl}t|j�}n`td�j}|dkrjtj	}n9|dkr�tj
}n!|dkr�tj}n	tj
}|t_|S(Nitptitltq(t_getintp_ctypetcacheRtctypestnumpyRVtintpRtchartc_inttc_longt
c_longlong(tvaltnpRj((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyRe�s 			t_missing_ctypescB`seZd�Zd�ZRS(cC`s|S(N((RXR R((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pytcast�scC`s|S(N((RXR ((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pytc_void_p�s(R_R`RqRr(((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyRp�s	t_ctypescB`s�eZd
d�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
eed
dd	�Zeed
dd
�Z
ee	d
dd�Zee
d
dd�ZRS(cC`s[trt|_nt�|_||_||_|jjdkrNt|_n	t|_dS(Ni(	RgRsRpt_arrt_datatndimtTruet_zerodtFalse(RXRtptr((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyRZ�s		cC`s|jj|j|�S(N(RsRqRu(RXR((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pytdata_as�scC`s'|jr
dS||jj|jj�S(N(RxRRtRvR<(RXR((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pytshape_ass	cC`s'|jr
dS||jj|jj�S(N(RxRRtRvtstrides(RXR((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt
strides_ass	cC`s|jS(N(Ru(RX((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pytget_data
scC`s|jt��S(N(R|Re(RX((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt	get_shape
scC`s|jt��S(N(R~Re(RX((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pytget_stridesscC`s|jj|j�S(N(RsRrRu(RX((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pytget_as_parameterstdocsc-types datas
c-types shapesc-types stridess_as parameter_N(R_R`RRZR{R|R~RR�R�R�tpropertytdataR<R}t_as_parameter_(((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyRs�s							cC`s�|j}t|�}t|t�r0|g}nt|ttf�r�xF|D]>}y|j|�WqLtk
r�td|f��qLXqLWtt|�|�Std|f��dS(Nsunknown field name: %ssunsupported order value: %s(R#RRR/RtremoveR(tdatatypeRStoldnamest	nameslistR)((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt	_newnamess	

cC`sW|j}i|jd6g|jD]}|j|d^q d6}t|d|dt�S(sReturn copy of structured array with padding between fields removed.

    Parameters
    ----------
    ary : ndarray
       Structured array from which to remove padding bytes

    Returns
    -------
    ary_copy : ndarray
       Copy of ary with padding bytes removed
    R#iR$RR0(RR#R,RRw(tarytdtR)t
copy_dtype((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt_copy_fields-s
	
+cC`s�|js|jr�|dkr.||kr.dS|jr�xF|jD]8}|j|d|krA|j|d|krAdSqAWntd��ndS(s Checks safety of getfield for object arrays.

    As in _view_is_safe, we need to check that memory containing objects is not
    reinterpreted as a non-object datatype and vice versa.

    Parameters
    ----------
    oldtype : data-type
        Data type of the original ndarray.
    newtype : data-type
        Data type of the field being accessed by ndarray.getfield
    offset : int
        Offset of the field being accessed by ndarray.getfield

    Raises
    ------
    TypeError
        If the field access is invalid

    iNis'Cannot get/set field of an object array(t	hasobjectR#R,RD(toldtypetnewtypeR7R)((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt_getfield_is_safe?s	cC`s5||krdS|js"|jr1td��ndS(sz Checks safety of a view involving object arrays, for example when
    doing::

        np.zeros(10, dtype=oldtype).view(newtype)

    Parameters
    ----------
    oldtype : data-type
        Data type of original ndarray
    newtype : data-type
        Data type of the view

    Raises
    ------
    TypeError
        If the new type is incompatible with the old type.

    Ns)Cannot change data-type for object array.(R�RD(R�R�((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt
_view_is_safe_s
t?tS1tctbtBthtHRbtIRctLRdtQtetftdtgtFtZftDtZdtGtZgtStstUtwtOtVR
Rti2tu2ti4tu4ti8tu8tf2cC`s>dtfd��Y}||�}t|dt�\}}|S(NtStreamcB`sJeZd�Zd�Zd�Zd�Zed��Zd�ZeZ	RS(cS`s||_d|_dS(Nt@(R�t	byteorder(RXR�((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyRZ�s	cS`s!|j| }|j||_|S(N(R�(RXRR*((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pytadvance�s
cS`s4|jt|� |kr0|jt|��tStS(N(R�RR�RwRy(RXR�((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pytconsume�scS`s�t|�rYd}x7|t|j�krK||j|�rK|d}qW|j|�S|jj|�}|j|�}|jt|��|SdS(Nii(tcallableRR�R�tindex(RXR�RbR*((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt
consume_until�s,
cS`s|jdS(Ni(R�(RX((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pytnext�scS`s
t|j�S(N(tboolR�(RX((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt__bool__�s(
R_R`RZR�R�R�R�R�R�t__nonzero__(((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyR��s					tis_subdtype(tobjectt__dtype_from_pep3118Ry(tspecR�tstreamRR((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt_dtype_from_pep3118�s$c	C`sutdgdgdgdd�}d}d}t}x�|r�d}|jd�rUPnd}|jd�r�|jd	�}ttt|jd
���}n|j	dkr�|j
d�}|dkr�d}n||_n|jdkr�t}	t
}
nt}	t}
|jd��}|r*t|�}nd}t}|jd�r`t|dt�\}}
n�|j	|
kr|j	dkr�|j
d�}n|j
d�}|dk}|	|}|dkr�|d|7}d}nidd6dd6j|j|j�}t||�}|j}
ntd|j��d}|jdkr�||
}|j|
}||7}|dkr�|dks�|dk	r�t|�dkr�t||�}q�||7}nt|
|�}n|dkr�t||ff�}n|dk	rt||f�}n|jd�r2|jd�}nd}|oG|dks�|dk	ry||dkrytd|��n|dj|�|dj|�|dj|�n||j7}||7}||d<q6W|jdkr�|dc||7<n|ddgkrU|dddkrU|d|ddjkrU|rU|dd}nt|�t|�}||fS(NR#R$R%R2iit}t(t)t,R�R>R	R
t^t!cS`s|j�S(N(tisdigit(R�((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyRRsT{R�tZiR
tUSVs%ds'Unknown PEP 3118 data type specifier %rt:s+Duplicate field name '%s' in PEP3118 format(R�R>R	R
R�R�(R�R�(tdictRyRR�R�RtmapRtsplitR�R�R�t_pep3118_native_mapt_pep3118_native_typecharst_pep3118_standard_mapt_pep3118_standard_typecharsR�RwRJRt	alignmentRR�R2t_prodt_add_trailing_paddingt_lcmtRuntimeErrorRt
_fix_names(R�R�t
field_specR7tcommon_alignmentt
is_paddingtvalueR<R�ttype_mapttype_map_charstitemsize_strR2Rttypechart	dtypechartnumpy_byteordertextra_offsett
start_paddingt
intra_paddingR)tret((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyR��s�		!		
	
*




cC`s�|d}xrt|�D]d\}}|dk	r5qnd}x3trpdj|�}||krcPn|d}q>W|||<qWdS(s< Replace names which are None with the next unused f%d name R#isf{}iN(t	enumerateRRwR!(R�R#RbR)tj((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyR�js
	c
C`s�|jdkr?tddgd|gddgd|j�}nl|j}|j}td|dg|D]}||d^qddg|D]}||d^q�d|j�}|dc|7<t|�S(	sBInject the specified number of padding bytes at the end of a dtypeR#tf0R$R%iR2iN(R,RR�R2R#R(R�tpaddingR�R,R#R)((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyR�ys					!!cC`s%d}x|D]}||9}q
W|S(Ni((taRaR
((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyR��s
cC`s"x|r|||}}qW|S(s0Calculate the greatest common divisor of a and b((R�R�((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt_gcd�s	cC`s|t||�|S(N(R�(R�R�((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyR��stTooHardErrorcB`seZRS((R_R`(((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyR��st	AxisErrorcB`seZdZddd�ZRS(s Axis supplied was invalid. cC`sn|dkr!|dkr!|}n3dj||�}|dk	rTdj||�}ntt|�j|�dS(Ns2axis {} is out of bounds for array of dimension {}s{}: {}(RR!tsuperR�RZ(RXtaxisRvt
msg_prefixtmsg((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyRZ�s	N(R_R`t__doc__RRZ(((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyR��scO`s�djg|D]}dj|�^q
g|j�D]\}}dj||�^q2�}||jdd�}	djd�|	D��}
dj||||
�S(s= Format the error message for when __array_ufunc__ gives up. s, s{!r}s{}={!r}toutcs`s$|]}tt|�j�VqdS(N(treprttypeR_(t.0targ((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pys	<genexpr>�ssToperand type(s) all returned NotImplemented from __array_ufunc__({!r}, {!r}, {}): {}((tjoinR!titemsRJ(tdummytufunctmethodtinputstkwargsR�tktvtargs_stringtargsttypes_string((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pytarray_ufunc_errmsg_formatter�s%2c	C`s�|jdkrd}n"djd�t|j�D��}|jdkrRd}nY|jdkrjd}nAdjd	djd
�t|j�D��dtd|j��}d}|jdkr�d
|}ndjd|jd|d|d|�S(sz
    Builds a signature string which resembles PEP 457

    This is used to construct the first line of the docstring
    iR
s, cs`s"|]}dj|d�VqdS(sx{}iN(R!(R�Rb((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pys	<genexpr>�sis, /, out=()s
, /, out=Nones%[, {positional}], / [, out={default}]t
positionalcs`s"|]}dj|d�VqdS(sout{}iN(R!(R�Rb((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pys	<genexpr>�stdefaultsM, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]s, where=Trues&{name}({in_args}{out_args}, *{kwargs})R)tin_argstout_argsRN(N(	tninR�trangetnoutR!R�Rt	signatureR_(RRRR((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt_ufunc_doc_signature_formatter�s&	"			
		(<R�t
__future__RRRtretsystnumpy.compatRt
multiarrayRRRRgtImportErrorRtnumerictypesRR�RKR'R+R1R=tcompileRARHRGRIRUR�RVReRfRpRsR�R�R�R�R�R�RR�R�R�R�R�R�R�R�R�R�R�R�Rt
IndexErrorR�RR(((sG/opt/alt/python27/lib64/python2.7/site-packages/numpy/core/_internal.pyt<module>s�

			 	0	
	/
		/			 	 

	+	�