File manager - Edit - /usr/lib/python3.10/__pycache__/numbers.cpython-310.pyc
Back
o ����}�5hl(����������������������@���s����d�Z�ddlmZmZ�g�d�ZG�dd��ded�ZG�dd��de�Ze�e��G�d d ��d e�Z e �e ��G�dd��de �ZG�d d��de�Ze�e ��dS�)z~Abstract Base Classes (ABCs) for numbers, according to PEP 3141. TODO: Fill out more detailed documentation on the operators.�����)�ABCMeta�abstractmethod)�Number�Complex�Real�Rational�Integralc�������������������@���s���e�Zd�ZdZdZdZdS�)r���z�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)�__name__� __module__�__qualname__�__doc__� __slots__�__hash__r ���r ���r ����/usr/lib/python3.10/numbers.pyr������s����r���)� metaclassc�������������������@���s����e�Zd�ZdZdZedd���Zdd��Zeedd����Z eed d ����Z edd���Zed d���Zedd���Z edd���Zdd��Zdd��Zedd���Zedd���Zedd���Zedd���Zedd ���Zed!d"���Zed#d$���Zed%d&���Zed'd(���Zd)S�)*r���af��Complex 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 heterogeneous arguments, and doesn't have special knowledge about them, it should fall back to the builtin complex type as described below. r ���c�����������������C�������dS�)z<Return a builtin complex instance. Called for complex(self).Nr �����selfr ���r ���r����__complex__-���s����zComplex.__complex__c�����������������C���s���|�dkS�)z)True if self != 0. Called for bool(self).r���r ���r���r ���r ���r����__bool__1�������zComplex.__bool__c�����������������C�������t��)zXRetrieve the real component of this number. This should subclass Real. ��NotImplementedErrorr���r ���r ���r����real5�������zComplex.realc�����������������C���r���)z]Retrieve the imaginary component of this number. This should subclass Real. r���r���r ���r ���r����imag>���r���zComplex.imagc�����������������C���r���)zself + otherr����r����otherr ���r ���r����__add__G�������zComplex.__add__c�����������������C���r���)zother + selfr���r���r ���r ���r����__radd__L���r!���zComplex.__radd__c�����������������C���r���)z-selfr���r���r ���r ���r����__neg__Q���r!���zComplex.__neg__c�����������������C���r���)z+selfr���r���r ���r ���r����__pos__V���r!���zComplex.__pos__c�����������������C���s ���|�|��S�)zself - otherr ���r���r ���r ���r����__sub__[������� zComplex.__sub__c�����������������C���s ���|��|�S�)zother - selfr ���r���r ���r ���r����__rsub___���r&���zComplex.__rsub__c�����������������C���r���)zself * otherr���r���r ���r ���r����__mul__c���r!���zComplex.__mul__c�����������������C���r���)zother * selfr���r���r ���r ���r����__rmul__h���r!���zComplex.__rmul__c�����������������C���r���)z5self / other: Should promote to float when necessary.r���r���r ���r ���r����__truediv__m���r!���zComplex.__truediv__c�����������������C���r���)zother / selfr���r���r ���r ���r����__rtruediv__r���r!���zComplex.__rtruediv__c�����������������C���r���)zBself**exponent; should promote to float or complex when necessary.r���)r����exponentr ���r ���r����__pow__w���r!���zComplex.__pow__c�����������������C���r���)zbase ** selfr���)r����baser ���r ���r����__rpow__|���r!���zComplex.__rpow__c�����������������C���r���)z7Returns the Real distance from 0. Called for abs(self).r���r���r ���r ���r����__abs__����r!���zComplex.__abs__c�����������������C���r���)z$(x+y*i).conjugate() returns (x-y*i).r���r���r ���r ���r���� conjugate����r!���zComplex.conjugatec�����������������C���r���)z self == otherr���r���r ���r ���r����__eq__����r!���zComplex.__eq__N)r ���r���r���r ���r���r���r���r����propertyr���r���r ���r"���r#���r$���r%���r'���r(���r)���r*���r+���r-���r/���r0���r1���r2���r ���r ���r ���r���r��� ���sP���� r���c�������������������@���s����e�Zd�ZdZdZedd���Zedd���Zedd���Zed d ���Z ed&dd ��Z dd��Zdd��Zedd���Z edd���Zedd���Zedd���Zedd���Zedd���Zdd��Zed d!���Zed"d#���Zd$d%��ZdS�)'r���z�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. r ���c�����������������C���r���)zTAny Real can be converted to a native float object. Called for float(self).r���r���r ���r ���r���� __float__��������zReal.__float__c�����������������C���r���)aG��trunc(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". r���r���r ���r ���r���� __trunc__����s���zReal.__trunc__c�����������������C���r���)z$Finds the greatest Integral <= self.r���r���r ���r ���r���� __floor__����r!���zReal.__floor__c�����������������C���r���)z!Finds the least Integral >= self.r���r���r ���r ���r����__ceil__����r!���z Real.__ceil__Nc�����������������C���r���)z�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. r���)r����ndigitsr ���r ���r���� __round__����r���zReal.__round__c�����������������C���s���|�|�|�|�fS�)z�divmod(self, other): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. r ���r���r ���r ���r���� __divmod__��������zReal.__divmod__c�����������������C���s���||��||��fS�)z�divmod(other, self): The pair (self // other, self % other). Sometimes this can be computed faster than the pair of operations. r ���r���r ���r ���r����__rdivmod__����r<���zReal.__rdivmod__c�����������������C���r���)z)self // other: The floor() of self/other.r���r���r ���r ���r����__floordiv__����r!���zReal.__floordiv__c�����������������C���r���)z)other // self: The floor() of other/self.r���r���r ���r ���r���� __rfloordiv__����r!���zReal.__rfloordiv__c�����������������C���r���)zself % otherr���r���r ���r ���r����__mod__����r!���zReal.__mod__c�����������������C���r���)zother % selfr���r���r ���r ���r����__rmod__����r!���z Real.__rmod__c�����������������C���r���)zRself < other < on Reals defines a total ordering, except perhaps for NaN.r���r���r ���r ���r����__lt__����r5���zReal.__lt__c�����������������C���r���)z self <= otherr���r���r ���r ���r����__le__����r!���zReal.__le__c�����������������C�������t�t|���S�)z(complex(self) == complex(float(self), 0))�complex�floatr���r ���r ���r���r�����������zReal.__complex__c�����������������C�������|� �S�)z&Real numbers are their real component.r ���r���r ���r ���r���r�����������z Real.realc�����������������C���r���)z)Real numbers have no imaginary component.r���r ���r���r ���r ���r���r�������r!���z Real.imagc�����������������C���rH���)zConjugate is a no-op for Reals.r ���r���r ���r ���r���r1�����s���zReal.conjugate�N)r ���r���r���r ���r���r���r4���r6���r7���r8���r:���r;���r=���r>���r?���r@���rA���rB���rC���r���r3���r���r���r1���r ���r ���r ���r���r�������sB���� r���c�������������������@���s<���e�Zd�ZdZdZeedd����Zeedd����Zdd��Z d S�) r���z6.numerator and .denominator should be in lowest terms.r ���c�����������������C���r���rJ���r���r���r ���r ���r���� numerator��r!���zRational.numeratorc�����������������C���r���rJ���r���r���r ���r ���r����denominator��r!���zRational.denominatorc�����������������C���s���t�|�j�t�|�j��S�)a��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. )�intrK���rL���r���r ���r ���r���r4�����s���zRational.__float__N) r ���r���r���r ���r���r3���r���rK���rL���r4���r ���r ���r ���r���r�����s����r���c�������������������@���s����e�Zd�ZdZdZedd���Zdd��Zed&dd ��Zed d���Z edd ���Z edd���Zedd���Zedd���Z edd���Zedd���Zedd���Zedd���Zedd���Zedd���Zd d!��Zed"d#���Zed$d%���ZdS�)'r���z�Integral adds methods that work on integral numbers. In short, these are conversion to int, pow with modulus, and the bit-string operations. r ���c�����������������C���r���)z int(self)r���r���r ���r ���r����__int__/��r!���zIntegral.__int__c�����������������C���s���t�|��S�)z6Called whenever an index is needed, such as in slicing)rM���r���r ���r ���r���� __index__4��r���zIntegral.__index__Nc�����������������C���r���)a4��self ** 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. r���)r���r,����modulusr ���r ���r���r-���8��s��� zIntegral.__pow__c�����������������C���r���)z self << otherr���r���r ���r ���r���� __lshift__C��r!���zIntegral.__lshift__c�����������������C���r���)z other << selfr���r���r ���r ���r����__rlshift__H��r!���zIntegral.__rlshift__c�����������������C���r���)z self >> otherr���r���r ���r ���r���� __rshift__M��r!���zIntegral.__rshift__c�����������������C���r���)z other >> selfr���r���r ���r ���r����__rrshift__R��r!���zIntegral.__rrshift__c�����������������C���r���)zself & otherr���r���r ���r ���r����__and__W��r!���zIntegral.__and__c�����������������C���r���)zother & selfr���r���r ���r ���r����__rand__\��r!���zIntegral.__rand__c�����������������C���r���)zself ^ otherr���r���r ���r ���r����__xor__a��r!���zIntegral.__xor__c�����������������C���r���)zother ^ selfr���r���r ���r ���r����__rxor__f��r!���zIntegral.__rxor__c�����������������C���r���)zself | otherr���r���r ���r ���r����__or__k��r!���zIntegral.__or__c�����������������C���r���)zother | selfr���r���r ���r ���r����__ror__p��r!���zIntegral.__ror__c�����������������C���r���)z~selfr���r���r ���r ���r���� __invert__u��r!���zIntegral.__invert__c�����������������C���rD���)zfloat(self) == float(int(self)))rF���rM���r���r ���r ���r���r4���{��rG���zIntegral.__float__c�����������������C���rH���)z"Integers are their own numerators.r ���r���r ���r ���r���rK�����rI���zIntegral.numeratorc�����������������C���r���)z!Integers have a denominator of 1.����r ���r���r ���r ���r���rL������r!���zIntegral.denominatorrJ���)r ���r���r���r ���r���r���rN���rO���r-���rQ���rR���rS���rT���rU���rV���rW���rX���rY���rZ���r[���r4���r3���rK���rL���r ���r ���r ���r���r���&��sF���� r���N)r ����abcr���r����__all__r���r����registerrE���r���rF���r���r���rM���r ���r ���r ���r����<module>���s��� p uc
| ver. 1.4 |
Github
|
.
| PHP 8.2.28 | Generation time: 0.15 |
proxy
|
phpinfo
|
Settings