ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/fractions.cpython-311.opt-2.pyc

�

�fp����	ddlmZddlZddlZddlZddlZddlZdgZejj	Z
ejjZej
dejejz��ZGd�dej��ZdS)���DecimalN�Fractiona�
    \A\s*                                  # optional whitespace at the start,
    (?P<sign>[-+]?)                        # an optional sign, then
    (?=\d|\.\d)                            # lookahead for digit or .digit
    (?P<num>\d*|\d+(_\d+)*)                # numerator (possibly empty)
    (?:                                    # followed by
       (?:/(?P<denom>\d+(_\d+)*))?         # an optional denominator
    |                                      # or
       (?:\.(?P<decimal>\d*|\d+(_\d+)*))?  # an optional fractional part
       (?:E(?P<exp>[-+]?\d+(_\d+)*))?      # and optional exponent
    )
    \s*\Z                                  # and optional whitespace to finish
c�j��eZdZ	dZd-dd��fd�Zed���Zed���Zd	�Zd.d�Z	e
d���Ze
d
���Zd�Z
d�Zd�Zd�Zeeej��\ZZd�Zeeej��\ZZd�Zeeej��\ZZd�Zeeej��\ZZ d�Z!ee!ej"��\Z#Z$d�Z%ee%e&��\Z'Z(d�Z)ee)ej*��\Z+Z,d�Z-d�Z.d�Z/d�Z0d�Z1ej2fd�Z3d�Z4d�Z5d �Z6d/d!�Z7d"�Z8d#�Z9d$�Z:d%�Z;d&�Z<d'�Z=d(�Z>d)�Z?d*�Z@d+�ZAd,�ZB�xZCS)0r��
_numerator�_denominatorrNT��
_normalizec���	tt|���|��}|���t|��tur||_d|_|St|tj	��r|j
|_|j|_|St|ttf��r#|���\|_|_|St|t���r/t �|��}|�t%d|z���t	|�d��pd��}|�d��}|rt	|��}n�d}|�d��}|rB|�dd��}d	t+|��z}||zt	|��z}||z}|�d
��}	|	r't	|	��}	|	dkr	|d	|	zz}n	|d	|	zz}|�d��d
kr|}n�t-d���t|��tcxurt|��urnnnbt|tj	��r9t|tj	��r|j
|jz|j
|jz}}nt-d���|dkrt/d|z���|r(t1j||��}
|dkr|
}
||
z}||
z}||_||_|S)N�z Invalid literal for Fraction: %r�num�0�denom�decimal�_��
�expr�sign�-z2argument should be a string or a Rational instancez+both arguments should be Rational instanceszFraction(%s, 0))�superr�__new__�type�intrr	�
isinstance�numbers�Rational�	numerator�denominator�floatr�as_integer_ratio�str�_RATIONAL_FORMAT�match�
ValueError�group�replace�len�	TypeError�ZeroDivisionError�math�gcd)�clsrr r�self�mrr�scaler�g�	__class__s           ��0/opt/alt/python311/lib64/python3.11/fractions.pyrzFraction.__new__>s2���	�<�X�s�#�#�+�+�C�0�0�����I���#�%�%�"+���$%��!����I�w�'7�8�8�(
:�"+�"5���$-�$9��!����I��w�'7�8�8�#
:�5>�5O�5O�5Q�5Q�2����!2����I�s�+�+�
:�$�*�*�9�5�5���9�$�%G�%.�&/�0�0�0�������� 5�#�6�6�	�����(�(���4�"%�e�*�*�K�K�"#�K��g�g�i�0�0�G��-�")�/�/�#�r�":�":�� "�C��L�L� 0��$-��$5��G���$D�	�#�u�,���'�'�%�.�.�C��4�!�#�h�h���!�8�8�%��S��0�I�I�'�2��t�8�3�K��7�7�6�?�?�c�)�)�!*�
�I�� �!9�:�:�:��)�_�_��
8�
8�
8�
8�t�K�'8�'8�
8�
8�
8�
8�
8����G�$4�5�5�	2��{�G�$4�5�5�	2��#�k�&=�=��%�	�(=�=�#�I�I�
�1�2�2�
2��!���#�$5�	�$A�B�B�B��	����K�0�0�A��Q����B���!�O�I��A��K�#���'�����c	��	t|tj��r||��St|t��s/t	|j�d|�dt
|��j�d����||����S)Nz%.from_float() only takes floats, not � (�))rr�Integralr!r*�__name__rr")r.�fs  r4�
from_floatzFraction.from_float�s���	�
�a��)�*�*�	A��3�q�6�6�M��A�u�%�%�	A�� �\�\�\�1�1�1�d�1�g�g�.>�.>�.>�@�A�A�
A��s�A�&�&�(�(�)�)r5c	�"�	ddlm}t|tj��r|t|����}n?t||��s/t
|j�d|�dt|��j�d����||�	���S)Nrrz).from_decimal() only takes Decimals, not r7r8)
rrrrr9rr*r:rr")r.�decrs   r4�from_decimalzFraction.from_decimal�s���O�#�#�#�#�#�#��c�7�+�,�,�	9��'�#�c�(�(�#�#�C�C��C��)�)�	9������s�s�s�D��I�I�$6�$6�$6�8�9�9�
9��s�C�(�(�*�*�+�+r5c� �	|j|jfS�Nr�r/s r4r"zFraction.as_integer_ratio�s��	�
���!2�3�3r5�@Bc��	|dkrtd���|j|krt|��Sd\}}}}|j|j}}	||z}|||zz}	|	|krn|||||zz|	f\}}}}||||zz
}}�0||z
|z}
t||
|zz||
|zz��}t||��}t	||z
��t	||z
��kr|S|S)Nr
z$max_denominator should be at least 1)rr
r
r)r&r	rr�abs)
r/�max_denominator�p0�q0�p1�q1�n�d�a�q2�k�bound1�bound2s
             r4�limit_denominatorzFraction.limit_denominator�s!��		�>�Q����C�D�D�D����/�/��D�>�>�!�#���B��B���� 1�1��	��1��A��A�b�D��B��O�#�#����R��"��W�b�0�N�B��B���a��!��e�q�A�
	��R�
�"�$���"�Q�r�T�'�2�a��d�7�+�+���"�b�!�!���v��}����V�D�[�!1�!1�1�1��M��Mr5c��|jSrA)r�rMs r4rzFraction.numerators
���|�r5c��|jSrA)r	rTs r4r zFraction.denominators
���~�r5c�B�	|jj�d|j�d|j�d�S)N�(z, r8)r3r:rr	rBs r4�__repr__zFraction.__repr__	s3���#�~�6�6�6�#�����0A�0A�0A�C�	Cr5c�d�	|jdkrt|j��S|j�d|j��S)Nr
�/)r	r#rrBs r4�__str__zFraction.__str__s:������!�!��t��'�'�'�"�o�o�o�t�/@�/@�A�Ar5c����	��fd�}d�jzdz|_�j|_��fd�}d�jzdz|_�j|_||fS)Nc���t|ttf��r�||��St|t��r�t|��|��St|t��r�t	|��|��St
SrA)rrrr!�complex�NotImplemented)rM�b�fallback_operator�monomorphic_operators  ��r4�forwardz-Fraction._operator_fallbacks.<locals>.forwardes�����!�c�8�_�-�-�
&�+�+�A�q�1�1�1��A�u�%�%�
&�(�(��q���1�5�5�5��A�w�'�'�
&�(�(�����Q�7�7�7�%�%r5�__c�^��t|tj��r�||��St|tj��r&�t	|��t	|����St|tj��r&�t
|��t
|����StSrA)rrr�Realr!�Complexr^r_)r`rMrarbs  ��r4�reversez-Fraction._operator_fallbacks.<locals>.reverseqs�����!�W�-�.�.�
&�+�+�A�q�1�1�1��A�w�|�,�,�
&�(�(��q���5��8�8�<�<�<��A�w��/�/�
&�(�(�����W�Q�Z�Z�@�@�@�%�%r5�__r)r:�__doc__)rbrarcrhs``  r4�_operator_fallbackszFraction._operator_fallbackss�����N	�^	&�	&�	&�	&�	&�	&� �"3�"<�<�t�C���.�6���		&�		&�		&�		&�		&�		&�!�#4�#=�=��D���.�6������r5c�j�	|j|j}}|j|j}}tj||��}|dkrt	||z||zz||zd���S||z}|||zz||zz}tj||��}	|	dkrt	|||zd���St	||	z|||	zzd���S�Nr
Fr
�rr r,r-r�
rMr`�na�da�nb�dbr2�s�t�g2s
          r4�_addz
Fraction._add��������a�m�B����a�m�B���H�R�������6�6��B��G�b�2�g�-�r�B�w�5�I�I�I�I��!�G���"��'�N�R�!�V�#��
�X�a��^�^��
��7�7��A�q�2�v�%�8�8�8�8���R���b�B�h��E�B�B�B�Br5c�j�	|j|j}}|j|j}}tj||��}|dkrt	||z||zz
||zd���S||z}|||zz||zz
}tj||��}	|	dkrt	|||zd���St	||	z|||	zzd���Srmrnros
          r4�_subz
Fraction._sub�rxr5c��	|j|j}}|j|j}}tj||��}|dkr
||z}||z}tj||��}|dkr
||z}||z}t	||z||zd���Srmrn)rMr`rprqrrrs�g1rvs        r4�_mulz
Fraction._mul�s������a�m�B����a�m�B��
�X�b�"�
�
��
��6�6��2�I�B��2�I�B�
�X�b�"�
�
��
��6�6��2�I�B��2�I�B���R���b��U�;�;�;�;r5c� �	|j|j}}|j|j}}tj||��}|dkr
||z}||z}tj||��}|dkr
||z}||z}||z||z}	}|	dkr||	}	}t	||	d���S�Nr
rFr
rn)
rMr`rprqrrrsr|rvrKrLs
          r4�_divz
Fraction._div�s������a�m�B����a�m�B��
�X�b�"�
�
��
��6�6��2�I�B��2�I�B�
�X�b�"�
�
��
��6�6��2�I�B��2�I�B��B�w��R��1���q�5�5��2��r�q�A���1��/�/�/�/r5c�B�	|j|jz|j|jzzSrA�rr �rMr`s  r4�	_floordivzFraction._floordivs"�����a�m�+�����1L�M�Mr5c��	|j|j}}t|j|z||jz��\}}|t|||z��fSrA)r �divmodrr)rMr`rqrs�div�n_mods      r4�_divmodzFraction._divmodsL������
�B���A�K�"�,�b�1�;�.>�?�?�
��U��H�U�B��G�,�,�,�,r5c�l�	|j|j}}t|j|z|j|zz||z��SrA)r rr)rMr`rqrss    r4�_modz
Fraction._mods9������
�B�����r�)�a�k�B�.>�?��b��I�I�Ir5c��	t|tj��r�|jdkr�|j}|dkr"t|j|z|j|zd���S|jdkr$t|j|z|j|zd���St|j|z|j|zd���St|��t|��zSt|��|zSr)	rrrr rrrr	r!)rMr`�powers   r4�__pow__zFraction.__pow__s��	��a��)�*�*�	!��}��!�!�����A�:�:�#�A�L�E�$9�$%�N�e�$;�/4�6�6�6�6��\�Q�&�&�#�A�N�u�f�$<�$%�L�U�F�$:�/4�6�6�6�6�$�a�n�_�%��$?�&'�l�]��v�$=�/4�6�6�6�6��Q�x�x�5��8�8�+�+���8�8�q�=� r5c��	|jdkr|jdkr
||jzSt|tj��rt|j|j��|zS|jdkr
||jzS|t|��zS)Nr
r)	r	rrrrrrr r!)r`rMs  r4�__rpow__zFraction.__rpow__;s�����>�Q���1�<�1�#4�#4����$�$��a��)�*�*�	=��A�K���7�7�1�<�<��>�Q������$�$��E�!�H�H�}�r5c�<�	t|j|jd���S�NFr
�rrr	rTs r4�__pos__zFraction.__pos__Is��9����a�n��G�G�G�Gr5c�>�	t|j|jd���Sr�r�rTs r4�__neg__zFraction.__neg__Ms ������
�q�~�%�H�H�H�Hr5c�V�	tt|j��|jd���Sr�)rrErr	rTs r4�__abs__zFraction.__abs__Qs&�����A�L�)�)�1�>�e�L�L�L�Lr5c�~�	|jdkr||j|jz��S||j|jz��S�Nrr)rM�_indexs  r4�__int__zFraction.__int__UsI����<�!����6�Q�\�M�Q�^�;�<�=�=�=��6�!�,�!�.�8�9�9�9r5c�Z�	|jdkr|j|jzS|j|jzSr�rrTs r4�	__trunc__zFraction.__trunc__\s5����<�!����l�]�a�n�4�5�5��<�1�>�1�1r5c�"�	|j|jzSrAr�rTs r4�	__floor__zFraction.__floor__cs����{�a�m�+�+r5c�&�	|j|jzSrAr�rTs r4�__ceil__zFraction.__ceil__gs����+����.�/�/r5c�\�	|�Pt|j|j��\}}|dz|jkr|S|dz|jkr|dzS|dzdkr|S|dzSdt|��z}|dkr t	t||z��|��St	t||z��|z��S)N�r
rr)r�rr rEr�round)r/�ndigits�floor�	remainder�shifts     r4�	__round__zFraction.__round__ls���	��?�%�d�n�d�6F�G�G��E�9��1�}�t�/�/�/����Q���!1�1�1��q�y� ����a������q�y� ��C��L�L� ���Q�;�;��E�$��,�/�/��7�7�7��E�$��,�/�/�%�7�8�8�8r5c��		t|jdt��}ttt	|j����|z��}n#t$r
t}YnwxYw|jdkr|n|}|dkrdn|S)N���r���)�powr	�_PyHASH_MODULUS�hashrErr&�_PyHASH_INF)r/�dinv�hash_�results    r4�__hash__zFraction.__hash__�s����	<��t�(�"�o�>�>�D�(��c�$�/�2�2�3�3�d�:�;�;�E�E��'�	 �	 �	 ��E�E�E�	 ����(�/�Q�.�.���U�F���r�\�\�r�r�v�-s�A�A$�#A$c���	t|��tur|j|ko
|jdkSt	|t
j��r |j|jko|j|jkSt	|t
j	��r|j
dkr|j}t	|t��rGtj|��stj|��rd|kS||�|��kSt"S)Nr
r�)rrrr	rrrrr rg�imag�realr!r,�isnan�isinfr<r_r�s  r4�__eq__zFraction.__eq__�s������7�7�c�>�>��<�1�$�<���1�)<�<��a��)�*�*�	5��L�A�K�/�4��N�a�m�3�
5��a���)�)�	�a�f��k�k���A��a����
	"��z�!�}�}�
,��
�1�
�
�
,��a�x���A�L�L��O�O�+�+�"�!r5c�b�	t|tj��r&||j|jz|j|jz��St|t��rStj	|��stj
|��r|d|��S|||�|����StS)Nr�)
rrrrr r	rr!r,r�r�r<r_)r/�other�ops   r4�_richcmpzFraction._richcmp�s���	��e�W�-�.�.�	;��2�d�o��(9�9��'�%�/�9�;�;�
;��e�U�#�#�	"��z�%� � �
8�D�J�u�$5�$5�
8��r�#�u�~�~�%��r�$����� 6� 6�7�7�7�!�!r5c�D�	|�|tj��SrA)r��operator�ltr�s  r4�__lt__zFraction.__lt__������z�z�!�X�[�)�)�)r5c�D�	|�|tj��SrA)r�r��gtr�s  r4�__gt__zFraction.__gt__�r�r5c�D�	|�|tj��SrA)r�r��ler�s  r4�__le__zFraction.__le__������z�z�!�X�[�)�)�)r5c�D�	|�|tj��SrA)r�r��ger�s  r4�__ge__zFraction.__ge__�r�r5c�,�	t|j��SrA)�boolrrTs r4�__bool__zFraction.__bool__�s����A�L�!�!�!r5c�,�|j|j|jffSrA)r3rr	rBs r4�
__reduce__zFraction.__reduce__�s������$�2C� D�E�Er5c�v�t|��tkr|S|�|j|j��SrA�rrr3rr	rBs r4�__copy__zFraction.__copy__��1����:�:��!�!��K��~�~�d�o�t�/@�A�A�Ar5c�v�t|��tkr|S|�|j|j��SrAr�)r/�memos  r4�__deepcopy__zFraction.__deepcopy__�r�r5)rN)rCrA)Dr:�
__module__�__qualname__�	__slots__r�classmethodr<r?r"rR�propertyrr rXr[rkrwr��add�__add__�__radd__rz�sub�__sub__�__rsub__r}�mul�__mul__�__rmul__r��truediv�__truediv__�__rtruediv__r��floordiv�__floordiv__�
__rfloordiv__r�r��
__divmod__�__rdivmod__r��mod�__mod__�__rmod__r�r�r�r�r��indexr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��
__classcell__)r3s@r4rr&s���������(/�I�h�$�h�h�h�h�h�h�h�T�*�*��[�*��	,�	,��[�	,�4�4�4�5�5�5�5�n����X������X��C�C�C�
B�B�B�i �i �i �^C�C�C�,�+�D�(�,�?�?��G�X�C�C�C�,�+�D�(�,�?�?��G�X�<�<�<�,�+�D�(�,�?�?��G�X�0�0�0�$!4� 3�D�(�:J� K� K��K��N�N�N�#6�"5�i��AR�"S�"S��L�-�-�-�-�2�1�'�6�B�B��J��J�J�J�
,�+�D�(�,�?�?��G�X�!�!�!�<���H�H�H�I�I�I�M�M�M�#�.�:�:�:�:�2�2�2�,�,�,�0�0�0�
9�9�9�9�2.�.�.�B"�"�"�*"�"�"�,*�*�*�*�*�*�*�*�*�*�*�*�"�"�"�F�F�F�B�B�B�
B�B�B�B�B�B�Br5)rrr,rr��re�sys�__all__�	hash_info�modulusr��infr��compile�VERBOSE�
IGNORECASEr$rr�r5r4�<module>rs���6�������������������	�	�	�	�
�
�
�
��,��
�-�'���m����2�:���Z�"�-��!�!��NB�NB�NB�NB�NB�w��NB�NB�NB�NB�NBr5

Zerion Mini Shell 1.0