ok

Mini Shell

Direktori : /lib64/python2.7/Demo/classes/
Upload File :
Current File : //lib64/python2.7/Demo/classes/Complex.pyo

�
��^c@s�ddlZddlZejdZejdZd�Zd�Zdded�Zd�Zd�Z	d	dd
��YZ
d�Zdd
�Zd�Z
edkr�e
�ndS(i����Ng@cCst|d�ot|d�S(Ntretim(thasattr(tobj((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt	IsComplexGscCs7t|�r|St|t�r)t|�St|�SdS(N(Rt
isinstancettupletComplex(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt	ToComplexJs

icCs5|t|}ttj|�|tj|�|�S(N(ttwopiRtmathtcostsin(trtphit
fullcircle((s,/usr/lib64/python2.7/Demo/classes/Complex.pytPolarToComplexRscCst|�r|jS|S(N(RR(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pytReVscCst|�r|jSdS(Ni(RR(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pytIm[sRcBs�eZddd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Ze	ZZed�ZeZd�ZeZd�Zd�Zd�ZeZd�Zd�Zdd�Zd�ZRS(icCs�d}d}t|�r-|j}|j}n|}t|�r\||j}||j}n
||}||jd<||jd<dS(NiRR(RRRt__dict__(tselfRRt_ret_im((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__init__bs	


cCs
td�dS(NsComplex numbers are immutable(t	TypeError(Rtnametvalue((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__setattr__tscCs,|jst|j�St|j|jf�S(N(RthashR(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__hash__ws	
cCs/|jsd|jfSd|j|jfSdS(NsComplex(%r)sComplex(%r, %r)(RR(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__repr__|s	cCs.|jst|j�Sd|j|jfSdS(NsComplex(%r, %r)(RtreprR(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__str__�s	
cCst|j|j�S(N(RRR(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__neg__�scCs|S(N((R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__pos__�scCstj|j|j�S(N(R
thypotRR(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__abs__�scCs"|jrtd�nt|j�S(Ns,can't convert Complex with nonzero im to int(Rt
ValueErrortintR(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__int__�s	cCs"|jrtd�nt|j�S(Ns-can't convert Complex with nonzero im to long(RR%tlongR(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__long__�s	cCs"|jrtd�nt|j�S(Ns.can't convert Complex with nonzero im to float(RR%tfloatR(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt	__float__�s	cCs1t|�}t|j|jf|j|jf�S(N(RtcmpRR(Rtother((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__cmp__�scCst|�}t||�S(N(RR,(RR-((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__rcmp__�scCs!|j|jkodknS(Ni(RR(R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__nonzero__�scCs&|tttj|j|j�tS(N(R	thalfpiR
tatan2RR(RR((s,/usr/lib64/python2.7/Demo/classes/Complex.pytangle�scCs-t|�}t|j|j|j|j�S(N(RRRR(RR-((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__add__�scCs-t|�}t|j|j|j|j�S(N(RRRR(RR-((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__sub__�scCst|�}||S(N(R(RR-((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__rsub__�scCsIt|�}t|j|j|j|j|j|j|j|j�S(N(RRRR(RR-((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__mul__�scCs�t|�}t|j|j|j|j�}|sBtd�nt|j|j|j|j||j|j|j|j|�S(NsComplex division(RR*RRtZeroDivisionErrorR(RR-td((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__div__�s$"cCst|�}||S(N(R(RR-((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__rdiv__�scCs�|dk	rtd�nt|�rk|jr_|jrBtd�q_ttj|j�|�Sn|j}nt|j	�|�}||j
�}ttj|�|tj
|�|�S(Ns&Complex does not support ternary pow()sComplex to the Complex power(tNoneRRRtexpR
tlogRtpowtabsR3RRR(RtntzR
R((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__pow__�s		cCst|�}t||�S(N(RR?(Rtbase((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt__rpow__�sN( t__name__t
__module__RRRRR R!R"R$R'R)R+R.R/R0R@tradiusR	R3RR4t__radd__R5R6R7t__rmul__R:R;R<RCRE(((s,/usr/lib64/python2.7/Demo/classes/Complex.pyR`s6													
						cCs?tj|j�}ttj|j�|tj|j�|�S(N(R
R=RRRRR(RBR
((s,/usr/lib64/python2.7/Demo/classes/Complex.pyR=�sg���ư>cCs�dG|GdG|Gyt|�}Wntj}nXdG|GHt|t�sZt|t�ri||k}nt||�|k}|s�dG|GdGt||�GHndS(Ns       tands->s!!	!!	!! should betdiff(tevaltsystexc_typeRtstrR@(texprtatbRtfuzztresulttok((s,/usr/lib64/python2.7/Demo/classes/Complex.pytcheckop�s
	cCsdGHdt�fd t�fd!td�fd"tdd�fd#ttdd��fd$ttdd�d�fd%tdtdd��fd&tdtd��fd'tdtdd��fd(ttdd�tdd
��ff
}ddg}x�|D]x}|dcd7<|dd|djksH|dd|djkr�dG|dGdG|dGH|dcd7<q�q�Wd
G|dGdG|dGdGHid)dtdd�tdd�ftdd�dtdd�ftdd�td�tdd�ftd�tdd�tdd�fgd6d*dtdd�tdd�ftdd�dtdd�ftdd�td�tdd�ftd�tdd�tdd�fgd6d+dtdd�tdd�ftdd�dtdd�ftdd�td�tdd�ftd�tdd�tdd�fgd6d,dtdd�tdd�ftdd�dtdd�ftdd�td�tdd�ftd�tdd�tdd�fgd6d-dtdd�dftdd�dtdd�ftdd�td�tdd�ftd�tdd�dfdtdd�dfgd6d.dtdd�dftdd�ddftdd�td�dftd�tdd�dfgd6}xIt|�D];}|dGH|f}x ||D]}t||�q�Wq�WdS(/Nstest constructorsiiiiii����i����iis        expectedtgots  tofstests failedi
isa+bi����i����sa-bsa*bg�?g�������?g��������sa/bispow(a,b)scmp(a,b)t:(ii(ii(ii(ii(ii(ii(ii(ii(i����i(i����i(ii
i(ii
i����(ii
i
(g�?i
g�������?(ii
i(ii
i����(RRRtsortedRW(tconstructor_testtcntttt	testsuiteRQtitem((s,/usr/lib64/python2.7/Demo/classes/Complex.pyttest�sn*
6$+$+$+$+$%		t__main__((R
RNtpiR	R1RRRRRRR=RWRaRF(((s,/usr/lib64/python2.7/Demo/classes/Complex.pyt<module>As

				�		J

Zerion Mini Shell 1.0