AlkantarClanX12
Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/ |
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/fractions.cpython-38.opt-2.pyc |
U i�f _ � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZddgZdd� Zdd� Z ej jZej j Ze�dejejB �ZG d d� dej�ZdS ) � ��DecimalN�Fraction�gcdc C sf dd l }|�dtd� t| �t kr2t|�kr\n n&|p<| dk rPt�| |� S t�| |�S t| |�S )Nr z6fractions.gcd() is deprecated. Use math.gcd() instead.� )�warnings�warn�DeprecationWarning�type�int�mathr �_gcd)�a�br � r �./opt/alt/python38/lib64/python3.8/fractions.pyr s � c C s |r|| | } }q | S �Nr �r r r r r r s r aC \A\s* # optional whitespace at the start, then (?P<sign>[-+]?) # an optional sign, then (?=\d|\.\d) # lookahead for digit or .digit (?P<num>\d*) # numerator (possibly empty) (?: # followed by (?:/(?P<denom>\d+))? # an optional denominator | # or (?:\.(?P<decimal>\d*))? # an optional fractional part (?:E(?P<exp>[-+]?\d+))? # and optional exponent ) \s*\Z # and optional whitespace to finish c s� e Zd ZdZdQdd�� fdd�Zedd � �Zed d� �Zdd � ZdRdd�Z e dd� �Ze dd� �Zdd� Z dd� Zdd� Zdd� Zeeej�\ZZdd� Zeeej�\ZZdd � Zeeej�\ZZd!d"� Zeeej�\ZZ d#d$� Z!ee!ej"�\Z#Z$d%d&� Z%ee%e&�\Z'Z(d'd(� Z)ee)ej*�\Z+Z,d)d*� Z-d+d,� Z.d-d.� Z/d/d0� Z0d1d2� Z1d3d4� Z2d5d6� Z3d7d8� Z4dSd9d:�Z5d;d<� Z6d=d>� Z7d?d@� Z8dAdB� Z9dCdD� Z:dEdF� Z;dGdH� Z<dIdJ� Z=dKdL� Z>dMdN� Z?dOdP� Z@� ZAS )Tr �� _numerator�_denominatorr NT�� _normalizec sR t t| ��| �}|d k�rdt|�tkr6||_d|_|S t|tj �rV|j |_|j|_|S t|tt f�rx|�� \|_|_|S t|t��rZt�|�}|d kr�td| ��t|�d�p�d�}|�d�}|r�t|�}nvd}|�d�}|�rdt|� }|| t|� }||9 }|�d�} | �rBt| �} | d k�r4|d| 9 }n|d| 9 }|�d �dk�rb| }ntd��nft|�t k�r�t|�k�r�n nn@t|tj ��r�t|tj ��r�|j |j |j |j }}ntd ��|d k�r�td| ��|�rBt|�t k�rt|�k�r(n nt�||�} |d k �r2| } n t||�} || }|| }||_||_|S )N� z Invalid literal for Fraction: %rZnum�0�denom�decimal� �expr Zsign�-z2argument should be a string or a Rational instancez+both arguments should be Rational instanceszFraction(%s, 0))�superr �__new__r r r r � isinstance�numbers�Rational� numerator�denominator�floatr �as_integer_ratio�str�_RATIONAL_FORMAT�match� ValueError�group�len� TypeError�ZeroDivisionErrorr r r )�clsr% r&