관리-도구
편집 파일: fractions.cpython-37.opt-2.pyc
B YI~d�\ � @ 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/python37/lib64/python3.7/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 ZdZdQdd�� fdd�Zedd � �Zed d� �ZdRd d�Ze dd� �Z e dd� �Zdd� Zdd� Z dd� Zdd� Zeeej�\ZZdd� Zeeej�\ZZdd� Zeeej�\ZZdd � Zeeej�\ZZd!d"� Z d#d$� Z!d%d&� Z"d'd(� Z#d)d*� Z$d+d,� Z%d-d.� Z&d/d0� Z'd1d2� Z(d3d4� Z)d5d6� Z*d7d8� Z+dSd9d:�Z,d;d<� Z-d=d>� Z.d?d@� Z/dAdB� Z0dCdD� Z1dEdF� Z2dGdH� Z3dIdJ� Z4dKdL� Z5dMdN� Z6dOdP� Z7� Z8S )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 �sign�-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"