AlkantarClanX12
Current Path : /proc/self/root/usr/lib64/python3.6/__pycache__/ |
Current File : //proc/self/root/usr/lib64/python3.6/__pycache__/fractions.cpython-36.opt-2.pyc |
3 \W\ � @ s� d dl mZ d dlZd dlZd dlZd dlZd dlZddgZdd� Zdd� Z ej jZej j ZejdejejB �ZG d d� dej�ZdS ) � )�DecimalN�Fraction�gcdc C sf dd l }|jdtd� t| �t ko0t|�kn r\|p<| dk rPtj| |� S tj| |�S t| |�S )Nr z6fractions.gcd() is deprecated. Use math.gcd() instead.� )�warnings�warn�DeprecationWarning�type�int�mathr �_gcd)�a�br � r �!/usr/lib64/python3.6/fractions.pyr s c C s x|r|| | } }qW | 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 ZdRZdSdd�� fdd�Zed d � �Zedd� �ZdTdd�Ze dd� �Z e dd� �Zdd� Zdd� Z dd� Zdd� Zeeej�\ZZdd� Zeeej�\ZZdd� Zeeej�\ZZd d!� Zeeej�\ZZd"d#� Z d$d%� Z!d&d'� Z"d(d)� Z#d*d+� Z$d,d-� Z%d.d/� Z&d0d1� Z'd2d3� Z(d4d5� Z)d6d7� Z*d8d9� Z+dUd:d;�Z,d<d=� Z-d>d?� Z.d@dA� Z/dBdC� Z0dDdE� Z1dFdG� Z2dHdI� Z3dJdK� Z4dLdM� Z5dNdO� Z6dPdQ� Z7� Z8S )Vr � _numerator�_denominatorr NT)� _normalizec sR t t| �j| �}|d k�rdt|�tkr6||_d|_|S t|tj �rV|j |_|j|_|S t|tt f�rx|j� \|_|_|S t|t��rZtj|�}|d kr�td| ��t|jd�p�d�}|jd�}|r�t|�}nvd}|jd�}|�rdt|� }|| t|� }||9 }|jd�} | �rBt| �} | d k�r4|d| 9 }n|d| 9 }|jd �dk�rb| }ntd��nft|�t k�o�t|�kn �r�n@t|tj ��r�t|tj ��r�|j |j |j |j }}ntd ��|d k�r�td| ��|�rBt|�t k�ot|�kn �r(tj||�} |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! r �self�mr r Zscaler �g)� __class__r r r T sr $ $ zFraction.__new__c C sD t |tj�r| |�S t |t�s8td| j|t|�jf ��| |j� � S )Nz.%s.from_float() only takes floats, not %r (%s))r r �Integralr"