AlkantarClanX12
Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/ |
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/fractions.cpython-39.opt-2.pyc |
a R�f_ � @ st d dl mZ d dlZd dlZd dlZd dlZd dlZdgZejj Z ejjZe� dejejB �ZG dd� dej�ZdS )� ��DecimalN�FractionaC \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 s" t t| ��| �}|d u �rdt|�tu r6||_d|_|S t|tj �rV|j |_|j|_|S t|tt f�rx|�� \|_|_|S t|t��rZt�|�}|d u r�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 u �r�t|�u �r�n nn@t|tj ��r�t|tj ��r�|j |j |j |j }}ntd ��|d k�r�td| ��|�rt�||�} |d k �r| } || }|| }||_||_|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__�type�intr r � isinstance�numbers�Rational� numerator�denominator�floatr �as_integer_ratio�str�_RATIONAL_FORMAT�match� ValueError�group�len� TypeError�ZeroDivisionError�mathZgcd)�clsr r r �self�mr r Zscaler �g�� __class__� �./opt/alt/python39/lib64/python3.9/fractions.pyr >