ž ¬ÿfž(c@sÍdZddlmZmZdddddgZGdd„dd eƒZGd d„deƒZejeƒGd d„deƒZ e je ƒGd d„de ƒZ Gd d„de ƒZ e je ƒdS(u~Abstract Base Classes (ABCs) for numbers, according to PEP 3141. TODO: Fill out more detailed documentation on the operators.i(uABCMetauabstractmethoduNumberuComplexuRealuRationaluIntegralcBs&|EeZdZdZfZdZdS(uNumberuŸAll numbers inherit from this class. If you just want to check if an argument x is a number, without caring what kind, use isinstance(x, Number). N(u__name__u __module__u __qualname__u__doc__u __slots__uNoneu__hash__(u __locals__((u,/opt/alt/python33/lib64/python3.3/numbers.pyuNumber su metaclasscBs||EeZdZdZfZedd„ƒZdd„Zeedd„ƒƒZ eedd „ƒƒZ ed d „ƒZ ed d „ƒZ edd„ƒZ edd„ƒZdd„Zdd„Zedd„ƒZedd„ƒZedd„ƒZedd„ƒZedd„ƒZed d!„ƒZed"d#„ƒZed$d%„ƒZed&d'„ƒZd(d)„Zd*S(+uComplexuaComplex defines the operations that work on the builtin complex type. In short, those are: a conversion to complex, .real, .imag, +, -, *, /, abs(), .conjugate, ==, and !=. If it is given heterogenous arguments, and doesn't have special knowledge about them, it should fall back to the builtin complex type as described below. cCsdS(u<Return a builtin complex instance. Called for complex(self).N((uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __complex__-suComplex.__complex__cCs |dkS(u)True if self != 0. Called for bool(self).i((uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__bool__1suComplex.__bool__cCs t‚dS(uXRetrieve the real component of this number. This should subclass Real. N(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyureal5su Complex.realcCs t‚dS(u]Retrieve the imaginary component of this number. This should subclass Real. N(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyuimag>su Complex.imagcCs t‚dS(u self + otherN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__add__GsuComplex.__add__cCs t‚dS(u other + selfN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__radd__LsuComplex.__radd__cCs t‚dS(u-selfN(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__neg__QsuComplex.__neg__cCs t‚dS(u+selfN(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__pos__VsuComplex.__pos__cCs || S(u self - other((uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__sub__[suComplex.__sub__cCs | |S(u other - self((uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__rsub___suComplex.__rsub__cCs t‚dS(u self * otherN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__mul__csuComplex.__mul__cCs t‚dS(u other * selfN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__rmul__hsuComplex.__rmul__cCs t‚dS(u5self / other: Should promote to float when necessary.N(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __truediv__msuComplex.__truediv__cCs t‚dS(u other / selfN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __rtruediv__rsuComplex.__rtruediv__cCs t‚dS(uBself**exponent; should promote to float or complex when necessary.N(uNotImplementedError(uselfuexponent((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__pow__wsuComplex.__pow__cCs t‚dS(u base ** selfN(uNotImplementedError(uselfubase((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__rpow__|suComplex.__rpow__cCs t‚dS(u7Returns the Real distance from 0. Called for abs(self).N(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__abs__suComplex.__abs__cCs t‚dS(u$(x+y*i).conjugate() returns (x-y*i).N(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu conjugate†suComplex.conjugatecCs t‚dS(u self == otherN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__eq__‹suComplex.__eq__cCs ||k S(u self != other((uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__ne__suComplex.__ne__N(u__name__u __module__u __qualname__u__doc__u __slots__uabstractmethodu __complex__u__bool__upropertyurealuimagu__add__u__radd__u__neg__u__pos__u__sub__u__rsub__u__mul__u__rmul__u __truediv__u __rtruediv__u__pow__u__rpow__u__abs__u conjugateu__eq__u__ne__(u __locals__((u,/opt/alt/python33/lib64/python3.3/numbers.pyuComplex s0    cBs=|EeZdZdZfZedd„ƒZedd„ƒZedd„ƒZedd „ƒZ ed$d d „ƒZ d d „Z dd„Z edd„ƒZedd„ƒZedd„ƒZedd„ƒZedd„ƒZedd„ƒZdd„Zedd„ƒZed d!„ƒZd"d#„Zd$S(%uRealuÜTo Complex, Real adds the operations that work on real numbers. In short, those are: a conversion to float, trunc(), divmod, %, <, <=, >, and >=. Real also provides defaults for the derived operations. cCs t‚dS(uTAny Real can be converted to a native float object. Called for float(self).N(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __float__£suReal.__float__cCs t‚dS(uGtrunc(self): Truncates self to an Integral. Returns an Integral i such that: * i>0 iff self>0; * abs(i) <= abs(self); * for any Integral j satisfying the first two conditions, abs(i) >= abs(j) [i.e. i has "maximal" abs among those]. i.e. "truncate towards 0". N(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __trunc__ªs uReal.__trunc__cCs t‚dS(u$Finds the greatest Integral <= self.N(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __floor__·suReal.__floor__cCs t‚dS(u!Finds the least Integral >= self.N(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__ceil__¼su Real.__ceil__cCs t‚dS(u¸Rounds self to ndigits decimal places, defaulting to 0. If ndigits is omitted or None, returns an Integral, otherwise returns a Real. Rounds half toward even. N(uNotImplementedError(uselfundigits((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __round__ÁsuReal.__round__cCs||||fS(u™divmod(self, other): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. ((uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __divmod__ÊsuReal.__divmod__cCs||||fS(u™divmod(other, self): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. ((uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __rdivmod__ÒsuReal.__rdivmod__cCs t‚dS(u)self // other: The floor() of self/other.N(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __floordiv__ÚsuReal.__floordiv__cCs t‚dS(u)other // self: The floor() of other/self.N(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __rfloordiv__ßsuReal.__rfloordiv__cCs t‚dS(u self % otherN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__mod__äsu Real.__mod__cCs t‚dS(u other % selfN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__rmod__ésu Real.__rmod__cCs t‚dS(uRself < other < on Reals defines a total ordering, except perhaps for NaN.N(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__lt__îsu Real.__lt__cCs t‚dS(u self <= otherN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__le__õsu Real.__le__cCstt|ƒƒS(u(complex(self) == complex(float(self), 0)(ucomplexufloat(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __complex__ûsuReal.__complex__cCs| S(u&Real numbers are their real component.((uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyurealÿsu Real.realcCsdS(u)Real numbers have no imaginary component.i((uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyuimagsu Real.imagcCs| S(uConjugate is a no-op for Reals.((uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu conjugate suReal.conjugateN(u__name__u __module__u __qualname__u__doc__u __slots__uabstractmethodu __float__u __trunc__u __floor__u__ceil__uNoneu __round__u __divmod__u __rdivmod__u __floordiv__u __rfloordiv__u__mod__u__rmod__u__lt__u__le__u __complex__upropertyurealuimagu conjugate(u __locals__((u,/opt/alt/python33/lib64/python3.3/numbers.pyuReal˜s(    cBs\|EeZdZdZfZeedd„ƒƒZeedd„ƒƒZdd„Z dS( uRationalu6.numerator and .denominator should be in lowest terms.cCs t‚dS(N(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu numeratorsuRational.numeratorcCs t‚dS(N(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu denominatorsuRational.denominatorcCs|j|jS(u float(self) = self.numerator / self.denominator It's important that this conversion use the integer's "true" division rather than casting one side to float before dividing so that ratios of huge integers convert without overflowing. (u numeratoru denominator(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __float__ suRational.__float__N( u__name__u __module__u __qualname__u__doc__u __slots__upropertyuabstractmethodu numeratoru denominatoru __float__(u __locals__((u,/opt/alt/python33/lib64/python3.3/numbers.pyuRationalscBsI|EeZdZdZfZedd„ƒZdd„Zed$dd„ƒZ edd „ƒZ ed d „ƒZ ed d „ƒZ edd„ƒZ edd„ƒZedd„ƒZedd„ƒZedd„ƒZedd„ƒZedd„ƒZedd„ƒZdd„Zed d!„ƒZed"d#„ƒZd$S(%uIntegralu@Integral adds a conversion to int and the bit-string operations.cCs t‚dS(u int(self)N(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__int__0suIntegral.__int__cCs t|ƒS(u6Called whenever an index is needed, such as in slicing(uint(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __index__5suIntegral.__index__cCs t‚dS(u4self ** exponent % modulus, but maybe faster. Accept the modulus argument if you want to support the 3-argument version of pow(). Raise a TypeError if exponent < 0 or any argument isn't Integral. Otherwise, just implement the 2-argument version described in Complex. N(uNotImplementedError(uselfuexponentumodulus((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__pow__9s uIntegral.__pow__cCs t‚dS(u self << otherN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __lshift__DsuIntegral.__lshift__cCs t‚dS(u other << selfN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __rlshift__IsuIntegral.__rlshift__cCs t‚dS(u self >> otherN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __rshift__NsuIntegral.__rshift__cCs t‚dS(u other >> selfN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __rrshift__SsuIntegral.__rrshift__cCs t‚dS(u self & otherN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__and__XsuIntegral.__and__cCs t‚dS(u other & selfN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__rand__]suIntegral.__rand__cCs t‚dS(u self ^ otherN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__xor__bsuIntegral.__xor__cCs t‚dS(u other ^ selfN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__rxor__gsuIntegral.__rxor__cCs t‚dS(u self | otherN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__or__lsuIntegral.__or__cCs t‚dS(u other | selfN(uNotImplementedError(uselfuother((u,/opt/alt/python33/lib64/python3.3/numbers.pyu__ror__qsuIntegral.__ror__cCs t‚dS(u~selfN(uNotImplementedError(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __invert__vsuIntegral.__invert__cCstt|ƒƒS(ufloat(self) == float(int(self))(ufloatuint(uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu __float__|suIntegral.__float__cCs| S(u"Integers are their own numerators.((uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu numerator€suIntegral.numeratorcCsdS(u!Integers have a denominator of 1.i((uself((u,/opt/alt/python33/lib64/python3.3/numbers.pyu denominator…suIntegral.denominatorN(u__name__u __module__u __qualname__u__doc__u __slots__uabstractmethodu__int__u __index__uNoneu__pow__u __lshift__u __rlshift__u __rshift__u __rrshift__u__and__u__rand__u__xor__u__rxor__u__or__u__ror__u __invert__u __float__upropertyu numeratoru denominator(u __locals__((u,/opt/alt/python33/lib64/python3.3/numbers.pyuIntegral+s(   N(u__doc__uabcuABCMetauabstractmethodu__all__uNumberuComplexuregisterucomplexuRealufloatuRationaluIntegraluint(((u,/opt/alt/python33/lib64/python3.3/numbers.pyusu u _