AlkantarClanX12
Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/ |
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/fractions.cpython-310.opt-2.pyc |
o 6��fRn � @ sv 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 Z dZdQdd�� 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 r�t|�tu r||_d|_|S t|tj �r+|j |_|j|_|S t|tt f�r<|�� \|_|_|S t|t�r�t�|�}|d u rPtd| ��t|�d�pWd�}|�d�}|ret|�}n8d}|�d�}|r�dt|� }|| t|� }||9 }|�d�} | r�t| �} | d kr�|d| 9 }n|d| 9 }|�d �dkr�| }n3td��t|�t u r�t|�u r�n nnt|tj �r�t|tj �r�|j |j |j |j }}ntd ��|d kr�td| ��|r�t�||�} |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�math�gcd)�clsr r r �self�mr r Zscaler �g�� __class__� �0/opt/alt/python310/lib64/python3.10/fractions.pyr >