AlkantarClanX12

Your IP : 18.225.92.60


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/fractions.cpython-312.opt-2.pyc

�

�Q�f�����	ddlmZddlZddlZddlZddlZddlZddlZdgZejjZejjZ
ejd��d��Zej dej"ej$z�Zdd�Zd	�Zej d
ej,ej"z�j.ZGd�dej2�Zy)
���DecimalN�Fractioni@)�maxsizec��	t|dt�}ttt|��|z�}|dk\r|n|}|dk(rdS|S#t$r	t
}Y�$wxYw)N���r���)�pow�_PyHASH_MODULUS�hash�abs�
ValueError�_PyHASH_INF)�	numerator�denominator�dinv�hash_�results     �0/opt/alt/python312/lib64/python3.12/fractions.py�_hash_algorithmrse��2��;��O�4��(�T�#�i�.�)�D�0�1���1�n�U�5�&�F��2��2�)�6�)��+�����s�A�A�Aa�
    \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
       (?:\s*/\s*(?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��	|dk\r	|d|zz}n	|d|zz}t||dz	z|�\}}|dk(r
|dzdk(r|dz}|r|dkn|dk}|t|�fS)Nr�
�r	)�divmodr
)�n�d�exponent�no_neg_zero�q�r�signs       r�_round_to_exponentr"Js�����1�}�	�R��\���	�R�(��]����!�q�A�v�,��"�D�A�q��A�v�!�a�%�1�*�	�R����1�q�5�Q��U�D���Q��<��c��	|dk(rddd|z
fStt|��t|�}}t|�t|�z
||kz}||z
}t|||�\}}tt|��|dzk(r
|dz}|dz
}|||fS)NrFrr)�strr
�lenr")	rr�figures�str_n�str_d�mrr!�significands	         r�_round_to_figuresr,gs���� 	�A�v��a��W��$�$��s�1�v�;��A��5�E��E�
�S��Z��5�E�>�2�A��7�{�H�*�1�a��:��D�+��3�{����!��+������A�
����h�&�&r#a�
    (?:
        (?P<fill>.)?
        (?P<align>[<>=^])
    )?
    (?P<sign>[-+ ]?)
    (?P<no_neg_zero>z)?
    (?P<alt>\#)?
    # A '0' that's *not* followed by another digit is parsed as a minimum width
    # rather than a zeropad flag.
    (?P<zeropad>0(?=[0-9]))?
    (?P<minimumwidth>0|[1-9][0-9]*)?
    (?P<thousands_sep>[,_])?
    (?:\.(?P<precision>0|[1-9][0-9]*))?
    (?P<presentation_type>[eEfFgG%])
c���eZdZ	dZd+�fd�	Zed��Zed��Ze�fd��Zd�Z	d�Z
d,d�Zed	��Z
ed
��Zd�Zd�Zd
�Zd�Zd�Zeeej*�\ZZd�Zeeej2�\ZZd�Zeeej:�\ZZd�Z ee ejB�\Z"Z#d�Z$ee$ejJ�\Z&Z'd�Z(ee(e)�\Z*Z+d�Z,ee,ejZ�\Z.Z/d�Z0d�Z1d�Z2d�Z3d�Z4ejjfd�Z6d�Z7d�Z8d�Z9d-d�Z:d �Z;d!�Z<d"�Z=d#�Z>d$�Z?d%�Z@d&�ZAd'�ZBd(�ZCd)�ZDd*�ZE�xZFS).r��
_numerator�_denominatorc�D��	tt|�|�}|���t|�tur||_d|_|St|tj�r$|j|_|j|_|St|ttf�r|j�\|_|_|St|t�r�t j#|�}|�t%d|z��t	|j'd�xsd�}|j'd�}|rt	|�}n�d}|j'd�}|r6|j)dd�}d	t+|�z}||zt	|�z}||z}|j'd
�}|r"t	|�}|dk\r	|d	|zz}n	|d	|zz}|j'd�d
k(r�|}n�t-d��t|�tcxur
t|�urnnnrt|tj�rMt|tj�r3|j|jz|j|jz}}nt-d��|dk(rt/d|z��t1j2||�}	|dkr|	}	||	z}||	z}||_||_|S)Nrz Invalid literal for Fraction: %r�num�0�denom�decimal�_�r�exprr!�-z2argument should be a string or a Rational instancez+both arguments should be Rational instances�Fraction(%s, 0))�superr�__new__�type�intr/r0�
isinstance�numbers�Rationalrr�floatr�as_integer_ratior%�_RATIONAL_FORMAT�matchr�group�replacer&�	TypeError�ZeroDivisionError�math�gcd)�clsrr�selfr*r4r5�scaler8�g�	__class__s          �rr<zFraction.__new__�s����	�<�X�s�+�C�0�����I��#�%�"+���$%��!����I�w�'7�'7�8�"+�"5�"5���$-�$9�$9��!����I��w�'7�8�5>�5O�5O�5Q�2����!2����I�s�+�$�*�*�9�5���9�$�%G�%.�&/�0�0������� 5�#�6�	�����(���"%�e�*�K�"#�K��g�g�i�0�G��")�/�/�#�r�":�� "�C��L� 0��$-��$5��G��$D�	�#�u�,���'�'�%�.�C��!�#�h���!�8�%��S��0�I�'�2��t�8�3�K��7�7�6�?�c�)�!*�
�I� �!9�:�:��)�_��
8�t�K�'8�
8����G�$4�$4�5��{�G�$4�$4�5��#�#�k�&=�&=�=��%�%�	�(=�(=�=�#�I�
�1�2�
2��!��#�$5�	�$A�B�B��H�H�Y��,����?���A��a��	�����#���'����r#c	��	t|tj�r||�St|t�s1t	|j
�d|�dt
|�j
�d���|j|j��S)Nz%.from_float() only takes floats, not � (�))	r?r@�IntegralrBrH�__name__r=�_from_coprime_intsrC)rL�fs  r�
from_floatzFraction.from_float#sr��	�
�a��)�)�*��q�6�M��A�u�%�� �\�\�1�d�1�g�.>�.>�@�A�
A�%�s�%�%�q�'9�'9�';�<�<r#c	��	ddlm}t|tj�r|t|��}n=t||�s1t
|j�d|�dt|�j�d���|j|j��S)Nrrz).from_decimal() only takes Decimals, not rRrS)r5rr?r@rTr>rHrUr=rVrC)rL�decrs   r�from_decimalzFraction.from_decimal1su��O�#��c�7�+�+�,��#�c�(�#�C��C��)�����s�D��I�$6�$6�8�9�
9�&�s�%�%�s�';�';�'=�>�>r#c�L��	tt|�|�}||_||_|S�N)r;rr<r/r0)rLrr�objrPs    �rrVzFraction._from_coprime_ints=s/���	�
�H�c�*�3�/��"���&����
r#c�"�	|jdk(S�Nr�r0�rMs r�
is_integerzFraction.is_integerIs��8�� � �A�%�%r#c�4�	|j|jfSr]r.rbs rrCzFraction.as_integer_ratioMs��	�����!2�!2�3�3r#c��	|dkrtd��|j|krt|�Sd\}}}}|j|j}}	||z}|||zz}	|	|kDrn|||||zz|	f\}}}}||||zz
}}�/||z
|z}
d|z||
|zzz|jkrtj	||�Stj	||
|zz||
|zz�S)Nrz$max_denominator should be at least 1)rrrr�)rr0rr/rV)rM�max_denominator�p0�q0�p1�q1rr�a�q2�ks           r�limit_denominatorzFraction.limit_denominatorTs��		�>�Q���C�D�D�����/��D�>�!�#���B��B����� 1� 1�1����1��A��A�b�D��B��O�#����R��"��W�b�0�N�B��B���a��!��e�q�A�
��R�
�"�$��
�Q�3��1�R�4��=�D�-�-�-��.�.�r�2�6�6��.�.�r�!�B�$�w��1�R�4��@�@r#c��|jSr])r/�rls rrzFraction.numerator�s���|�|�r#c��|jSr]rarqs rrzFraction.denominator�s���~�~�r#c�j�	|jj�d|j�d|j�d�S)N�(z, rS)rPrUr/r0rbs r�__repr__zFraction.__repr__�s-���#�~�~�6�6�#����0A�0A�C�	Cr#c��	|jdk(rt|j�S|j�d|j��S)Nr�/)r0r%r/rbs r�__str__zFraction.__str__�s7�������!��t���'�'�"�o�o�t�/@�/@�A�Ar#c
��� �!�	|st|�St|�}|�$td|�dt|�j����|d�*|d�%td|�dt|�j�d���|dxsd}|dxsd}|d	d
k(rdn|d	}t|d�}t|d
�}t|d�}t
|dxsd�}	|d�!t
|dxsd�}
|d}|dvxr|}|}
|dvrdnd}|dvr7|
}|dk(r|dz}t|j|j||�\}}d}|
}nY|dvrt|
d�n|
dz}t|j|j|�\}}}|dvxs|dkDxs||zdk}|r|dz
n|}|dk(rd}n|r|�||zd ��}nd}|d|dz�d!��}|rd
n|}|dt|�|z
� |t|�|z
d}|r|jd�}|
r|sdnd"}||z|z}|r8|	t|�z
t|�z
}� j�!rd#|zd$zdzn|�� �!rIdt� �dz
d#zz}� d|dj� �!fd%�t!|t� �d#�D��z� � |z}||	t|�z
t|�z
z}|dk(r||z|zS|d&k(r||z|zS|d'k(rt|�dz}|d||z|z||dzS||z|zS)(NzInvalid format specifier z for object of type �align�zeropadz0; can't use explicit alignment when zero-padding�fill� �>r!r9r7r�alt�minimumwidthr3�
thousands_sep�	precision�6�presentation_type�gG�EFG�E�ezfF%�%rfFr�eEr���z+03dr�.��c3�4�K�|]}��||dzz���y�w)r�N�)�.0�pos�leadingr�s  ��r�	<genexpr>z&Fraction.__format__.<locals>.<genexpr>s)�����4�<�C����c�A�g� 6�6�<�s��<�^)r%�#_FLOAT_FORMAT_SPECIFICATION_MATCHERrr=rU�boolr>r"r/r0�maxr,r&�rstrip�zfill�join�range)"rM�format_specrEr|rz�pos_signr�alternate_formr{r�r�r��
trim_zeros�
trim_point�exponent_indicatorr�negativer+�
scientific�	point_posr'�suffix�digitsr!�	frac_part�	separator�trailing�min_leading�	first_pos�body�padding�halfr�r�s"                                @@r�
__format__zFraction.__format__�s���O���t�9��4�K�@���=��+�K�?�;&�&*�4�j�&9�&9�%<�>��
��7�^�
'�E�)�,<�,H��+�K�?�;&�&*�4�j�&9�&9�%<�=A�A��
�
�V�}�#����g��%�#���v��#�-�2�5��=���5��/�0���e�E�l�+���u�Y�'�(���5��0�7�C�8���o�.�
���k�*�1�c�2�	�!�"5�6��&�$�.�E�~�3E�
�'�'�
�$5��$>�S�C����%�!�z�H� �C�'��A�
��$6�����!2�!2�H�k�%K�!�H�k��J�!�I�%��,��I�q�!���]�
�
/@�����!2�!2�G�/=�+�H�k�8�"�T�)�,��a�<�,��g�%��+�
�
(2��!���y�I���#��F�
�*�+�H�y�,@��+F�G�F��F� ��)�a�-���1�2��
�s�H���2�3�v�;��2�3���3�v�;��2�4�5�	��!�(�(��-�I�$�Y�B�C�	��y�(�6�1���&��T��2�S��]�B�K��m�m�,9��K��1�$�q�(�{��G�
��S��\�A�-��2�2�I��j�y�)�B�G�G�4� ��C��L�!�<�4�-��G���!���,��T��2�S��Y�>�?���C�<��T�>�D�(�(�
�c�\��$�;��(�(�
�c�\��w�<�1�$�D��5�D�>�D�(�4�/�'�$�%�.�@�@��'�>�D�(�(r#c�����	��fd�}d�jzdz|_�j|_��fd�}d�jzdz|_�j|_||fS)Nc���t|t�r	�||�St|t�r�|t|��St|t�r�t|�|�St|t�r�t	|�|�St
Sr])r?rr>rB�complex�NotImplemented)rl�b�fallback_operator�monomorphic_operators  ��r�forwardz-Fraction._operator_fallbacks.<locals>.forwardesq����!�X�&�+�A�q�1�1��A�s�#�+�A�x��{�;�;��A�u�%�(��q��1�5�5��A�w�'�(����Q�7�7�%�%r#�__c�<��t|tj�r�t|�|�St|tj�r�t|�t|��St|tj�r�t|�t|��StSr])	r?r@rAr�RealrB�Complexr�r�)r�rlr�r�s  ��r�reversez-Fraction._operator_fallbacks.<locals>.reversessp����!�W�-�-�.�+�H�Q�K��;�;��A�w�|�|�,�(��q��5��8�<�<��A�w���/�(����W�Q�Z�@�@�%�%r#�__r)rU�__doc__)r�r�r�r�s``  r�_operator_fallbackszFraction._operator_fallbacksso���N	�^
	&� �"3�"<�"<�<�t�C���.�6�6���		&�!�#4�#=�#=�=��D���.�6�6������r#c��	|j|j}}|j|j}}tj||�}|dk(r"tj||z||zz||z�S||z}|||zz||zz}tj||�}	|	dk(rtj|||z�Stj||	z|||	zz�Sr`�r/r0rJrKrrV�
rlr��na�da�nb�dbrO�s�t�g2s
          r�_addz
Fraction._add���������q�~�~�B�����q�~�~�B���H�H�R������6��.�.�r�B�w��b��/@�"�r�'�J�J��!�G���"��'�N�R�!�V�#��
�X�X�a��^��
��7��.�.�q�!�b�&�9�9��*�*�1��7�A��r��N�C�Cr#c��	|j|j}}|j|j}}tj||�}|dk(r"tj||z||zz
||z�S||z}|||zz||zz
}tj||�}	|	dk(rtj|||z�Stj||	z|||	zz�Sr`r�r�s
          r�_subz
Fraction._sub�r�r#c�0�	|j|j}}|j|j}}tj||�}|dkDr
||z}||z}tj||�}|dkDr
||z}||z}tj||z||z�Sr`r�)rlr�r�r�r�r��g1r�s        r�_mulz
Fraction._mul�s�������q�~�~�B�����q�~�~�B��
�X�X�b�"�
��
��6��2�I�B��2�I�B�
�X�X�b�"�
��
��6��2�I�B��2�I�B��*�*�2��7�B��G�<�<r#c�t�	|j|j}}|dk(rtd|z��|j|j}}tj||�}|dkDr
||z}||z}tj||�}|dkDr
||z}||z}||z||z}	}|	dkr||	}	}t
j
||	�S)Nrr:r)r/r0rIrJrKrrV)
rlr�r�r�r�r�r�r�rrs
          r�_divz
Fraction._div�s�������q�~�~�B��
��7�#�$5��$:�;�;����q�~�~�B��
�X�X�b�"�
��
��6��2�I�B��2�I�B�
�X�X�b�"�
��
��6��2�I�B��2�I�B��B�w��R��1���q�5��2��r�q�A��*�*�1�a�0�0r#c�j�	|j|jz|j|jzzSr])rr�rlr�s  r�	_floordivzFraction._floordivs*������a�m�m�+�������1L�M�Mr#c��	|j|j}}t|j|z||jz�\}}|t|||z�fSr])rrrr)rlr�r�r��div�n_mods      r�_divmodzFraction._divmodsN�������
�
�B���A�K�K�"�,�b�1�;�;�.>�?�
��U��H�U�B��G�,�,�,r#c��	|j|j}}t|j|z|j|zz||z�Sr])rrr)rlr�r�r�s    r�_modz
Fraction._mods>�������
�
�B������r�)�a�k�k�B�.>�?��b��I�Ir#c��	t|tj��r|jdk(r�|j}|dk\r0t
j
|j|z|j|z�S|jdkDr2t
j
|j|z|j|z�S|jdk(rtd|j|zz��t
j
|j|z|j|z�St|�t|�zSt|ttf�rt|�|zStS)Nrrr:)
r?r@rArrrrVr/r0rIrBr�r�)rlr��powers   r�__pow__zFraction.__pow__!s=��	��a��)�)�*��}�}��!������A�:�#�6�6�q�|�|�u�7L�78�~�~��7N�P�P��\�\�A�%�#�6�6�q�~�~�%��7O�78�|�|��v�7M�O�O��\�\�Q�&�+�,=�,-�N�N�u�f�,D�-E�F�F�$�6�6�����U�F�7R�9:���
�5�&�7P�R�R�
�Q�x�5��8�+�+�
��E�7�+�
,���8�q�=� �!�!r#c�0�	|jdk(r|jdk\r||jzSt|tj�r#t|j|j�|zS|jdk(r||jzS|t|�zS)Nrr)	r0r/r?r@rArrrrB)r�rls  r�__rpow__zFraction.__rpow__As~����>�>�Q��1�<�<�1�#4�����$�$��a��)�)�*��A�K�K����7�1�<�<��>�>�Q������$�$��E�!�H�}�r#c�X�	tj|j|j�Sr]�rrVr/r0rqs r�__pos__zFraction.__pos__Os ��9��*�*�1�<�<����H�Hr#c�Z�	tj|j|j�Sr]r�rqs r�__neg__zFraction.__neg__Ss"����*�*�A�L�L�=�!�.�.�I�Ir#c�j�	tjt|j�|j�Sr])rrVr
r/r0rqs r�__abs__zFraction.__abs__Ws%����*�*�3�q�|�|�+<�a�n�n�M�Mr#c��	|jdkr!||j|jz�S||j|jz�S�Nrr.)rl�_indexs  r�__int__zFraction.__int__[sF����<�<�!���Q�\�\�M�Q�^�^�;�<�=�=��!�,�,�!�.�.�8�9�9r#c��	|jdkr|j|jzS|j|jzSr�r.rqs r�	__trunc__zFraction.__trunc__bs<����<�<�!���l�l�]�a�n�n�4�5�5��<�<�1�>�>�1�1r#c�6�	|j|jzSr]r.rqs r�	__floor__zFraction.__floor__is����|�|�q�~�~�-�-r#c�:�	|j|jzSr]r.rqs r�__ceil__zFraction.__ceil__ms����,�,��!�.�.�0�1�1r#c�(�	|�K|j}t|j|�\}}|dz|kr|S|dz|kDr|dzS|dzdk(r|S|dzSdt|�z}|dkDrt	t||z�|�St	t||z�|z�S)Nrfrrr)r0rr/r
r�round)rM�ndigitsr�floor�	remainder�shifts      r�	__round__zFraction.__round__rs���	��?��!�!�A�%�d�o�o�q�9��E�9��1�}�q� ����Q���"��q�y� ����a�����q�y� ��C��L� ���Q�;��E�$��,�/��7�7��E�$��,�/�%�7�8�8r#c�D�	t|j|j�Sr])rr/r0rbs r�__hash__zFraction.__hash__�s����t����0A�0A�B�Br#c��	t|�tur |j|k(xr|jdk(St	|t
j�r4|j|jk(xr|j|jk(St	|t
j�r|jdk(r|j}t	|t�rCtj|�stj|�rd|k(S||j!|�k(St"S)Nrr�)r=r>r/r0r?r@rArrr��imag�realrBrJ�isnan�isinfrXr�r�s  r�__eq__zFraction.__eq__�s������7�c�>��<�<�1�$�<����1�)<�<��a��)�)�*��L�L�A�K�K�/�4��N�N�a�m�m�3�
5��a����)�a�f�f��k����A��a����z�z�!�}��
�
�1�
��a�x���A�L�L��O�+�+�"�!r#c�h�	t|tj�r7||j|jz|j
|jz�St|t�rKtj|�stj|�r	|d|�S|||j|��StS)Nr�)
r?r@rAr/rr0rrBrJrrrXr�)rM�other�ops   r�_richcmpzFraction._richcmp�s���	��e�W�-�-�.��d�o�o��(9�(9�9��'�'�%�/�/�9�;�
;��e�U�#��z�z�%� �D�J�J�u�$5��#�u�~�%��$����� 6�7�7�!�!r#c�D�	|j|tj�Sr])r�operator�ltr�s  r�__lt__zFraction.__lt__������z�z�!�X�[�[�)�)r#c�D�	|j|tj�Sr])rr	�gtr�s  r�__gt__zFraction.__gt__�rr#c�D�	|j|tj�Sr])rr	�ler�s  r�__le__zFraction.__le__������z�z�!�X�[�[�)�)r#c�D�	|j|tj�Sr])rr	�ger�s  r�__ge__zFraction.__ge__�rr#c�.�	t|j�Sr])r�r/rqs r�__bool__zFraction.__bool__�s����A�L�L�!�!r#c�J�|j|j|jffSr])rPr/r0rbs r�
__reduce__zFraction.__reduce__�s ��������$�2C�2C� D�E�Er#c�v�t|�tk(r|S|j|j|j�Sr]�r=rrPr/r0rbs r�__copy__zFraction.__copy__��.����:��!��K��~�~�d�o�o�t�/@�/@�A�Ar#c�v�t|�tk(r|S|j|j|j�Sr]r)rM�memos  r�__deepcopy__zFraction.__deepcopy__�rr#)rN)i@Br])GrU�
__module__�__qualname__�	__slots__r<�classmethodrXr[rVrcrCro�propertyrrrurxr�r�r�r	�add�__add__�__radd__r��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�rrrrrrrrrr!�
__classcell__)rPs@rrr�s�����(/�I�g�R�=��=��	?��	?��	��	�&�4�7A�r��������C�
B�r)�hk �bD�,�D�(�,�,�?��G�X�D�,�D�(�,�,�?��G�X�=�,�D�(�,�,�?��G�X�1�(!4�D�(�:J�:J� K��K��N�#6�i��AR�AR�"S��L�-�-�2�'�6�B��J��J�
,�D�(�,�,�?��G�X�"�@�I�J�N�#�.�.�:�2�.�2�
9�4C�"�*"�,*�*�*�*�"�F�B�
Br#)F)r5r�	functoolsrJr@r	�re�sys�__all__�	hash_info�modulusr�infr�	lru_cacher�compile�VERBOSE�
IGNORECASErDr"r,�DOTALL�	fullmatchr�rArr�r#r�<module>rJs���6������	�
��,��
�-�-�'�'���m�m��������w�'�*�(�*�@�2�:�:���Z�Z�"�-�-��!��"�:$'�R'1�b�j�j�2��Y�Y�����'�'�Y�$�$|B�w���|Br#