uawdijnntqw1x1x1
IP : 18.224.43.98
Hostname : host45.registrar-servers.com
Kernel : Linux host45.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
..
/
lib64
/
cifs-utils
/
..
/
enchant
/
..
/
python3.6
/
__pycache__
/
_pydecimal.cpython-36.opt-2.pyc
/
/
3 \T��$@sFdddddddddd d ddd ddddddddddddddddddd d!d"d#g$ZeZd$Zd%Zd&Zd'd(lZd'd(lZd'd(l Z yd'd)l mZedd*�Z Wnek r�d+d,�Z YnXdZdZdZdZdZdZdZdZd-Ze jd�kr�d1Zd1Zd�Znd2Zd2Zd�Zeed0ZGd3d�de�ZGd4d�de�ZGd5d�de�Z Gd6d�de �Z!Gd7d �d ee"�Z#Gd8d�de �Z$Gd9d�de e"�Z%Gd:d �d e�Z&Gd;d�de �Z'Gd<d�de�Z(Gd=d�de�Z)Gd>d �d e&e(�Z*Gd?d�de&e(e)�Z+Gd@d�dee,�Z-ee#e&e*e(e+e e)e-g Z.e!e e$e e%e e'e iZ/eeeeeeeefZ0yd'd(l1Z1Wn.ek �rdGdAdB�dBe2�Z3e3�Z1[3YnXy e1j4Wn>e5k �r�e6e1j7�dC��r�e1j7�`8dDd�Z9dEd�Z:Yn6Xe1j4�Z4e6e4dC��r�e4`8e4fdFd�Z:e4fdGd�Z9[1[4d�dHd�Z;GdId�de2�Z<d�dKdL�Z=ej>j?e<�GdMdN�dNe2�Z@GdOd�de2�ZAGdPdQ�dQe2�ZBd�dRdS�ZCeDjEZFdTdU�ZGdVdW�ZHdXdY�ZIdZd[�ZJd�d]d^�ZKd_d`�ZLdadb�ZMGdcdd�dde2�ZNeN�jOZPd�dedf�ZQdgdh�ZRdidj�ZSdkdldmdndodpdqdrdsdt� fdudv�ZTd�dwdx�ZUd�dydz�ZVeAd{ee#e*e ggd|d�d0d'd}�ZWeAd~ee#e*e ee+ggd�ZXeAd~eggd�ZYd'd(lZZZeZj[d�eZj\eZj]B�j^Z_eZj[d��j^Z`eZj[d��j^ZaeZj[d�eZj\eZjbB�Zc[Zyd'd(ldZeWnek �r�YnXd�d�d��Zfd�d��Zgd�d��Zhd�d�d��Zid�d��Zjd�d��Zke<d��Zle<d��Zme<d��Zne<d'�Zoe<d0�Zpe<d��ZqelemfZre jsjtZue jsjvZwe jsjxZyezdreud.eu�Z{[ d(S)��Decimal�Context�DecimalTuple�DefaultContext�BasicContext�ExtendedContext�DecimalException�Clamped�InvalidOperation�DivisionByZero�Inexact�Rounded� Subnormal�Overflow� Underflow�FloatOperation�DivisionImpossible�InvalidContext�ConversionSyntax�DivisionUndefined� ROUND_DOWN� ROUND_HALF_UP�ROUND_HALF_EVEN� ROUND_CEILING�ROUND_FLOOR�ROUND_UP�ROUND_HALF_DOWN� ROUND_05UP� setcontext� getcontext�localcontext�MAX_PREC�MAX_EMAX�MIN_EMIN� MIN_ETINY�HAVE_THREADSZdecimalz1.70z2.4.2�N)� namedtuplezsign digits exponentcGs|S)N�)�argsr'r'�"/usr/lib64/python3.6/_pydecimal.py�<lambda>�sr*T��?�l��N�Zoi@�Tc@seZdZdd�ZdS)rcGsdS)Nr')�self�contextr(r'r'r)�handle�szDecimalException.handleN)�__name__� __module__�__qualname__r0r'r'r'r)r�sc@seZdZdS)rN)r1r2r3r'r'r'r)r�s c@seZdZdd�ZdS)r cGs,|r(t|dj|djdd�}|j|�StS)Nr%�nT)�_dec_from_triple�_sign�_int�_fix_nan�_NaN)r.r/r(�ansr'r'r)r0�s zInvalidOperation.handleN)r1r2r3r0r'r'r'r)r �sc@seZdZdd�ZdS)rcGstS)N)r9)r.r/r(r'r'r)r0szConversionSyntax.handleN)r1r2r3r0r'r'r'r)r�sc@seZdZdd�ZdS)r cGst|S)N)�_SignedInfinity)r.r/�signr(r'r'r)r0szDivisionByZero.handleN)r1r2r3r0r'r'r'r)r s c@seZdZdd�ZdS)rcGstS)N)r9)r.r/r(r'r'r)r0szDivisionImpossible.handleN)r1r2r3r0r'r'r'r)rsc@seZdZdd�ZdS)rcGstS)N)r9)r.r/r(r'r'r)r0)szDivisionUndefined.handleN)r1r2r3r0r'r'r'r)r!sc@seZdZdS)rN)r1r2r3r'r'r'r)r,s c@seZdZdd�ZdS)rcGstS)N)r9)r.r/r(r'r'r)r0CszInvalidContext.handleN)r1r2r3r0r'r'r'r)r8sc@seZdZdS)rN)r1r2r3r'r'r'r)rFs c@seZdZdS)r N)r1r2r3r'r'r'r)r Rs c@seZdZdd�ZdS)rcGs�|jttttfkrt|S|dkrR|jtkr4t|St|d|j|j |jd�S|dkr�|jt krlt|St|d|j|j |jd�SdS)Nr%�9r-)�roundingrrrrr;rr5�prec�Emaxr)r.r/r<r(r'r'r)r0ss zOverflow.handleN)r1r2r3r0r'r'r'r)r]sc@seZdZdS)rN)r1r2r3r'r'r'r)r�s c@seZdZdS)rN)r1r2r3r'r'r'r)r�s c@seZdZefdd�ZdS)� MockThreadingcCs |jtS)N)�modules� __xname__)r.�sysr'r'r)�local�szMockThreading.localN)r1r2r3rDrEr'r'r'r)rA�srA�__decimal_context__cCs,|tttfkr|j�}|j�|tj�_dS)N)rrr�copy�clear_flags� threading�current_threadrF)r/r'r'r)r�scCs4y tj�jStk r.t�}|tj�_|SXdS)N)rIrJrF�AttributeErrorr)r/r'r'r)r�s cCs,y|jStk r&t�}||_|SXdS)N)rFrKr)�_localr/r'r'r)r�scCs(|tttfkr|j�}|j�||_dS)N)rrrrGrHrF)r/rLr'r'r)r�scCs|dkrt�}t|�S)N)r�_ContextManager)Zctxr'r'r)r�s$c @s�eZdZd�Zd�dd�Zed d ��Zdd�Zd d�Zd�dd�Z dd�Z dd�Zdd�Zd�dd�Z d�dd�Zd�dd�Zd�dd�Zd�dd �Zd�d!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd�d,d-�Zd�d.d/�Zd�d0d1�Z�dd2d3�Z�dd5d6�Z�dd7d8�ZeZ�dd9d:�Z�dd;d<�Z�dd=d>�Z e Z!�dd?d@�Z"dAdB�Z#�ddCdD�Z$�ddEdF�Z%�d dGdH�Z&�d dIdJ�Z'�ddKdL�Z(�ddMdN�Z)�d dOdP�Z*�ddQdR�Z+dSdT�Z,dUdV�Z-e-Z.dWdX�Z/e0e/�Z/dYdZ�Z1e0e1�Z1d[d\�Z2d]d^�Z3d_d`�Z4dadb�Z5dcdd�Z6dedf�Z7dgdh�Z8didj�Z9dkdl�Z:dmdn�Z;dodp�Z<dqdr�Z=e>e6e7e8e9e:e;e<e=ds�Z?�ddtdu�Z@dvdw�ZAdxdy�ZB�ddzd{�ZC�dd|d}�ZDd~d�ZE�dd�d��ZF�dd�d��ZG�dd�d��ZH�dd�d��ZI�dd�d��ZJd�d��ZKd�d��ZL�dd�d��ZM�dd�d��ZNeNZO�dd�d��ZP�dd�d��ZQ�dd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZV�dd�d��ZW�dd�d��ZX�dd�d��ZYd�d��ZZd�d��Z[�dd�d��Z\�d d�d��Z]d�d��Z^d�d��Z_d�d��Z`d�d��Za�d!d�d��Zbd�d��Zcd�d��Zdd�d��Ze�d"d�d��Zfd�d��Zgd�dÄZh�d#d�dńZid�dDŽZj�d$d�dɄZk�d%d�d˄Zld�d̈́Zmd�dτZn�d&d�dфZo�d'd�dӄZp�d(d�dՄZq�d)d�dׄZr�d*d�dلZs�d+d�dۄZt�d,d�d݄Zu�d-d�d߄Zv�d.d�d�Zw�d/d�d�Zxd�d�Zy�d0d�d�Zz�d1d�d�Z{�d2d�d�Z|d�d�Z}d�d�Z~d�d�Z�d3d�d�Z�dS(4r�_expr7r6�_is_special�0NcCs�tj|�}t|t��r$t|j�jdd��}|dkrP|dkr@t�}|jt d|�S|j d�dkrfd|_nd|_|j d�}|dk r�|j d �p�d}t|j d �p�d�}tt||��|_ |t|�|_d|_nZ|j d �}|dk �rtt|p�d��jd�|_ |j d��rd|_nd|_nd|_ d|_d|_|St|t��rf|dk�rBd|_nd|_d|_tt|��|_ d|_|St|t��r�|j|_|j|_|j |_ |j|_|St|t��r�|j|_t|j�|_ t|j�|_d|_|St|ttf��r&t|�dk�r�td��t|dt��o|ddk�std��|d|_|ddk�rHd|_ |d|_d|_n�g} x^|dD]R} t| t��r�d| k�ozdkn�r�| �s�| dk�r�| j| �ntd���qVW|ddk�r�djtt| ��|_ |d|_d|_nDt|dt��rdjtt| �pdg��|_ |d|_d|_ntd��|St|t��r||dk�rBt�}|jtd�tj|�}|j|_|j|_|j |_ |j|_|St d|��dS)N�_�zInvalid literal for Decimal: %rr<�-r-r%�intZfrac�exprPF�diag�signal�Nr4�FT�ztInvalid tuple size in creation of Decimal from list or tuple. The list or tuple should have exactly three elements.z|Invalid sign. The first value in the tuple should be an integer; either 0 for a positive number or 1 for a negative number.r+� zTThe second value in the tuple must be composed of integers in the range 0 through 9.zUThe third value in the tuple must be an integer, or one of the strings 'F', 'n', 'N'.z;strict semantics for mixing floats and Decimals are enabledzCannot convert %r to Decimal)r%r-)r4rX)!�object�__new__� isinstance�str�_parser�strip�replacer�_raise_errorr�groupr6rTr7�lenrNrO�lstrip�absr�_WorkRepr<rU�list�tuple� ValueError�append�join�map�floatr� from_float� TypeError)�cls�valuer/r.�m�intpart�fracpartrUrV�digitsZdigitr'r'r)r]4s� ( zDecimal.__new__cCs�t|t�r||�St|t�s$td��tj|�s8tj|�rD|t|��Stjd|�dkrZd}nd}t |�j �\}}|j�d}t|t |d|�|�}|tkr�|S||�SdS)Nzargument must be int or float.g�?r%r-�)r^rTrorq�_mathZisinfZisnan�reprZcopysignrg�as_integer_ratio� bit_lengthr5r_r)rr�fr<r4�d�k�resultr'r'r)rp�s zDecimal.from_floatcCs(|jr$|j}|dkrdS|dkr$dSdS)Nr4r-rXr+r%)rOrN)r.rUr'r'r)�_isnan�szDecimal._isnancCs|jdkr|jrdSdSdS)NrYr-r%���)rNr6)r.r'r'r)�_isinfinitys zDecimal._isinfinitycCs||j�}|dkrd}n|j�}|s&|rx|dkr4t�}|dkrJ|jtd|�S|dkr`|jtd|�S|rn|j|�S|j|�SdS)NFr+�sNaNr%)r�rrcr r8)r.�otherr/�self_is_nan�other_is_nanr'r'r)�_check_nanss" zDecimal._check_nanscCsv|dkrt�}|js|jrr|j�r0|jtd|�S|j�rF|jtd|�S|j�r\|jtd|�S|j�rr|jtd|�SdS)Nzcomparison involving sNaNzcomparison involving NaNr%)rrO�is_snanrcr �is_qnan)r.r�r/r'r'r)�_compare_check_nans.s(zDecimal._compare_check_nanscCs|jp|jdkS)NrP)rOr7)r.r'r'r)�__bool__OszDecimal.__bool__cCs|js|jr8|j�}|j�}||kr(dS||kr4dSdS|sP|sDdSd|jS|s^d|jS|j|jkrndS|j|jkr~dS|j�}|j�}||k�r�|jd|j|j}|jd|j|j}||kr�dS||kr�d|jSd |jSn ||k�rd |jSd|jSdS)Nr%r-rPr�r�r�r�r�r�r�r�)rOr�r6�adjustedr7rN)r.r�Zself_infZ other_inf� self_adjustedZother_adjusted�self_paddedZother_paddedr'r'r)�_cmpVs> zDecimal._cmpcCs<t||dd�\}}|tkr|S|j||�r.dS|j|�dkS)NT)�equality_opFr%)�_convert_for_comparison�NotImplementedr�r�)r.r�r/r'r'r)�__eq__�szDecimal.__eq__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r:r'r'r)�__lt__�szDecimal.__lt__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r:r'r'r)�__le__�szDecimal.__le__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r:r'r'r)�__gt__�szDecimal.__gt__cCs<t||�\}}|tkr|S|j||�}|r.dS|j|�dkS)NFr%)r�r�r�r�)r.r�r/r:r'r'r)�__ge__�szDecimal.__ge__cCs>t|dd�}|js|r0|jr0|j||�}|r0|St|j|��S)NT)�raiseit)�_convert_otherrOr�rr�)r.r�r/r:r'r'r)�compare�szDecimal.comparecCs�|jr4|j�rtd��n|j�r$tS|jr0tStS|jdkrNtd|jt �}ntt |jt �}t|j�|t }|dkr||n|}|dkr�dS|S)Nz"Cannot hash a signaling NaN value.r%� r-r+r����) rOr�rq�is_nan�_PyHASH_NANr6�_PyHASH_INFrN�pow�_PyHASH_MODULUS� _PyHASH_10INVrTr7)r.Zexp_hashZhash_r:r'r'r)�__hash__�s zDecimal.__hash__cCst|jttt|j��|j�S)N)rr6rjrnrTr7rN)r.r'r'r)�as_tuple�szDecimal.as_tuplecCs�|jr |j�rtd��ntd��|s(dSt|j�}|jdkrR|d|jd}}nr|j}x(|dkr�|ddkr�|d}|d8}q\W|j}t||@j�d|�}|r�||L}||8}d||>}|j r�|}||fS)Nz#cannot convert NaN to integer ratioz(cannot convert Infinity to integer ratior%r-r�rx)r%r-) rOr�rk� OverflowErrorrTr7rN�minr|r6)r.r4r~Zd5Zd2Zshift2r'r'r)r{�s, zDecimal.as_integer_ratiocCsdt|�S)Nz Decimal('%s'))r_)r.r'r'r)�__repr__'szDecimal.__repr__Fc Csdddg|j}|jrL|jdkr&|dS|jdkr>|d|jS|d|jS|jt|j�}|jdkrt|dkrt|}n6|s~d }n,|jdkr�|d dd }n|d dd }|dkr�d}d d||j}nN|t|j�k�r�|jd|t|j�}d}n |jd|�}d |j|d�}||k�r*d}n*|dk�r:t�}ddg|jd||}||||S)NrRrSrYZInfinityr4�NaNr�r%�r-rPrZ�.�e�Ez%+di����)r6rOrNr7rer�capitals) r.�engr/r<� leftdigits�dotplacerurvrUr'r'r)�__str__,s: zDecimal.__str__cCs|jd|d�S)NT)r�r/)r�)r.r/r'r'r)� to_eng_string`szDecimal.to_eng_stringcCsT|jr|j|d�}|r|S|dkr(t�}|rB|jtkrB|j�}n|j�}|j|�S)N)r/)rOr�rr>r�copy_abs�copy_negate�_fix)r.r/r:r'r'r)�__neg__is zDecimal.__neg__cCsT|jr|j|d�}|r|S|dkr(t�}|rB|jtkrB|j�}nt|�}|j|�S)N)r/)rOr�rr>rr�rr�)r.r/r:r'r'r)�__pos__s zDecimal.__pos__TcCsJ|s|j�S|jr&|j|d�}|r&|S|jr:|j|d�}n|j|d�}|S)N)r/)r�rOr�r6r�r�)r.�roundr/r:r'r'r)�__abs__�szDecimal.__abs__c Cslt|�}|tkr|S|dkr"t�}|js.|jr�|j||�}|rB|S|j�rr|j|jkrj|j�rj|jtd�St |�S|j�r�t |�St |j|j�}d}|jt kr�|j|jkr�d}|r�|r�t |j|j�}|r�d}t|d|�}|j|�}|S|�s"t||j|jd�}|j||j�}|j|�}|S|�sZt||j|jd�}|j||j�}|j|�}|St|�}t|�}t|||j�\}}t�} |j|jk�r�|j|jk�r�t|d|�}|j|�}|S|j|jk�r�||}}|jdk�r�d| _|j|j|_|_nd| _n&|jdk�rd| _d\|_|_nd| _|jdk�r@|j|j| _n|j|j| _|j| _t | �}|j|�}|S)Nz -INF + INFr%r-rP)r%r%)r�r�rrOr�r�r6rcr rr�rNr>rr5r��maxr?�_rescalerh� _normalizer<rTrU) r.r�r/r:rUZnegativezeror<�op1�op2r�r'r'r)�__add__�s| zDecimal.__add__cCsHt|�}|tkr|S|js |jr6|j||d�}|r6|S|j|j�|d�S)N)r/)r�r�rOr�r�r�)r.r�r/r:r'r'r)�__sub__szDecimal.__sub__cCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r�)r.r�r/r'r'r)�__rsub__szDecimal.__rsub__cCsDt|�}|tkr|S|dkr"t�}|j|jA}|js:|jr�|j||�}|rN|S|j�rn|sf|jtd�St |S|j�r�|s�|jtd�St |S|j |j }|s�|r�t|d|�}|j|�}|S|j dkr�t||j |�}|j|�}|S|j dk�rt||j |�}|j|�}|St|�}t|�}t|t|j|j�|�}|j|�}|S)Nz(+-)INF * 0z0 * (+-)INFrP�1)r�r�rr6rOr�r�rcr r;rNr5r�r7rhr_rT)r.r�r/Z resultsignr:Z resultexpr�r�r'r'r)�__mul__sH zDecimal.__mul__cCs�t|�}|tkrtS|dkr"t�}|j|jA}|js:|jr�|j||�}|rN|S|j�rj|j�rj|jtd�S|j�rzt |S|j�r�|jt d�t|d|j��S|s�|s�|jt d�S|jtd|�S|s�|j|j}d}n�t|j�t|j�|jd}|j|j|}t|�}t|�} |dk�r:t|jd|| j�\}} nt|j| jd|�\}} | �rt|d dk�r�|d7}n<|j|j}x.||k�r�|ddk�r�|d}|d7}�q�Wt|t|�|�}|j|�S) Nz(+-)INF/(+-)INFzDivision by infinityrPz0 / 0zx / 0r%r-r�rx)r�r�rr6rOr�r�rcr r;rr5�Etinyrr rNrer7r?rh�divmodrTr_r�)r.r�r/r<r:rU�coeff�shiftr�r�� remainder� ideal_expr'r'r)�__truediv__QsP zDecimal.__truediv__cCs |j|jA}|j�r|j}nt|j|j�}|j�|j�}|sP|j�sP|dkrjt|dd�|j||j�fS||jk�rt |�}t |�}|j |j kr�|jd|j |j 9_n|jd|j |j 9_t|j|j�\}} |d|jk�rt|t |�d�t|jt | �|�fS|jtd�} | | fS)Nr+rPr%r�z%quotient too large in //, % or divmodr�)r6r�rNr�r�r5r�r>r?rhrUrTr�r_rcr)r.r�r/r<r��expdiffr�r��q�rr:r'r'r)�_divide�s* zDecimal._dividecCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r�)r.r�r/r'r'r)�__rtruediv__�szDecimal.__rtruediv__cCs�t|�}|tkr|S|dkr"t�}|j||�}|r:||fS|j|jA}|j�r~|j�rj|jtd�}||fSt||jtd�fS|s�|s�|jt d�}||fS|jt d|�|jtd�fS|j||�\}}|j|�}||fS)Nzdivmod(INF, INF)zINF % xzdivmod(0, 0)zx // 0zx % 0) r�r�rr�r6r�rcr r;rr r�r�)r.r�r/r:r<Zquotientr�r'r'r)� __divmod__�s0 zDecimal.__divmod__cCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r�)r.r�r/r'r'r)�__rdivmod__�szDecimal.__rdivmod__cCs�t|�}|tkr|S|dkr"t�}|j||�}|r6|S|j�rJ|jtd�S|sj|r^|jtd�S|jtd�S|j||�d}|j |�}|S)NzINF % xzx % 0z0 % 0r-) r�r�rr�r�rcr rr�r�)r.r�r/r:r�r'r'r)�__mod__�s" zDecimal.__mod__cCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r�)r.r�r/r'r'r)�__rmod__�szDecimal.__rmod__cCs�|dkrt�}t|dd�}|j||�}|r.|S|j�rB|jtd�S|sb|rV|jtd�S|jtd�S|j�r|t|�}|j|�St |j |j �}|s�t|jd|�}|j|�S|j �|j �}||jdkr�|jt�S|dkr�|j||j�}|j|�St|�}t|�}|j|jk�r(|jd |j|j9_n|jd |j|j9_t|j|j�\}} d| |d@|jk�r~| |j8} |d7}|d |jk�r�|jt�S|j} | d k�r�d| } | } t| t| �|�}|j|�S)NT)r�zremainder_near(infinity, x)zremainder_near(x, 0)zremainder_near(0, 0)rPr-r+r�r%r�)rr�r�r�rcr rrr�r�rNr5r6r�r?rr�r>rhrUrTr�r_)r.r�r/r:�ideal_exponentr�r�r�r�r�r<r'r'r)�remainder_nearsZ zDecimal.remainder_nearcCs�t|�}|tkr|S|dkr"t�}|j||�}|r6|S|j�rb|j�rR|jtd�St|j|jAS|s�|r�|jt d|j|jA�S|jt d�S|j||�dS)Nz INF // INFzx // 0z0 // 0r%)r�r�rr�r�rcr r;r6r rr�)r.r�r/r:r'r'r)�__floordiv__Ls$zDecimal.__floordiv__cCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r�)r.r�r/r'r'r)� __rfloordiv__hszDecimal.__rfloordiv__cCs8|j�r(|j�rtd��|jr"dnd}nt|�}t|�S)Nz%Cannot convert signaling NaN to floatz-nan�nan)r�r�rkr6r_ro)r.�sr'r'r)� __float__oszDecimal.__float__cCst|jr(|j�rtd��n|j�r(td��d|j}|jdkrT|t|j�d|jS|t|jd|j�pjd�SdS)NzCannot convert NaN to integerz"Cannot convert infinity to integerr-r%r�rPr�) rOr�rkr�r�r6rNrTr7)r.r�r'r'r)�__int__ys zDecimal.__int__cCs|S)Nr')r.r'r'r)�real�szDecimal.realcCstd�S)Nr%)r)r.r'r'r)�imag�szDecimal.imagcCs|S)Nr')r.r'r'r)� conjugate�szDecimal.conjugatecCstt|��S)N)�complexro)r.r'r'r)�__complex__�szDecimal.__complex__cCsR|j}|j|j}t|�|krJ|t|�|d�jd�}t|j||jd�St|�S)NrPT) r7r?�clamprerfr5r6rNr)r.r/ZpayloadZmax_payload_lenr'r'r)r8�szDecimal._fix_nancCsX|jr |j�r|j|�St|�S|j�}|j�}|s�|j|g|j}tt |j |�|�}||j krx|jt�t |jd|�St|�St|j�|j |j}||kr�|jtd|j�}|jt�|jt�|S||k}|r�|}|j |k�r�t|j�|j |} | dk�rt |jd|d�}d} |j|j} | || �}|jd| ��p>d}|dk�r~tt|�d�}t|�|jk�r~|dd�}|d7}||k�r�|jtd|j�}nt |j||�}|�r�|�r�|jt�|�r�|jt�|�r�|jt�|jt�|�s�|jt�|S|�r|jt�|jdk�rP|j |k�rP|jt�|jd|j |} t |j| |�St|�S)NrPz above Emaxr%r�r-r�)rOr�r8rr��Etopr@r�r�r�rNrcrr5r6rer7r?rrr�_pick_rounding_functionr>r_rTrr )r.r/r�r��exp_maxZnew_expZexp_minr:Zself_is_subnormalrwZrounding_method�changedr�r�r'r'r)r��sn zDecimal._fixcCst|j|�rdSdSdS)Nr%r-r�)� _all_zerosr7)r.r?r'r'r)�_round_downszDecimal._round_downcCs|j|�S)N)r�)r.r?r'r'r)� _round_upszDecimal._round_upcCs*|j|dkrdSt|j|�r"dSdSdS)NZ56789r-r%r�)r7r�)r.r?r'r'r)�_round_half_ups zDecimal._round_half_upcCst|j|�rdS|j|�SdS)Nr-r�)�_exact_halfr7r�)r.r?r'r'r)�_round_half_downszDecimal._round_half_downcCs8t|j|�r*|dks&|j|ddkr*dS|j|�SdS)Nr%r-�02468r�)r�r7r�)r.r?r'r'r)�_round_half_even#szDecimal._round_half_evencCs |jr|j|�S|j|�SdS)N)r6r�)r.r?r'r'r)�_round_ceiling+s zDecimal._round_ceilingcCs |js|j|�S|j|�SdS)N)r6r�)r.r?r'r'r)�_round_floor2s zDecimal._round_floorcCs0|r |j|ddkr |j|�S|j|�SdS)Nr-Z05)r7r�)r.r?r'r'r)�_round_05up9s zDecimal._round_05up)rrrrrrrrcCsb|dk r2t|t�std��tdd|�}|j|�S|jrR|j�rJtd��ntd��t|j dt ��S)Nz+Second argument to round should be integralr%r�zcannot round a NaNzcannot round an infinity)r^rTrqr5�quantizerOr�rkr�r�r)r.r4rUr'r'r)� __round__Ks/ zDecimal.__round__cCs0|jr |j�rtd��ntd��t|jdt��S)Nzcannot round a NaNzcannot round an infinityr%)rOr�rkr�rTr�r)r.r'r'r)� __floor__�s zDecimal.__floor__cCs0|jr |j�rtd��ntd��t|jdt��S)Nzcannot round a NaNzcannot round an infinityr%)rOr�rkr�rTr�r)r.r'r'r)�__ceil__�s zDecimal.__ceil__cCst|dd�}t|dd�}|js$|jr�|dkr2t�}|jdkrJ|jtd|�S|jdkrb|jtd|�S|jdkrr|}nf|jdkr�|}nV|jdkr�|s�|jtd�St|j|jA}n*|jdkr�|s�|jtd�St|j|jA}n0t|j|jAt t |j�t |j��|j|j�}|j||�S) NT)r�rXr�r4rYzINF * 0 in fmaz0 * INF in fma) r�rOrrNrcr r;r6r5r_rTr7r�)r.r�Zthirdr/�productr'r'r)�fma�s6 zDecimal.fmacCs�t|�}|tkr|St|�}|tkr(|S|dkr6t�}|j�}|j�}|j�}|sZ|sZ|r�|dkrp|jtd|�S|dkr�|jtd|�S|dkr�|jtd|�S|r�|j|�S|r�|j|�S|j|�S|j�o�|j�o�|j�s�|jtd�S|dkr�|jtd�S|�s|jtd�S|j�|j k�r(|jtd�S|�rD|�rD|jtd�S|j ��rTd}n|j}tt |��}t|j��}t|j��} |j |td |j|�|}x t| j�D]} t|d |�}�q�Wt|| j |�}t|t|�d�S) Nr+r�z@pow() 3rd argument not allowed unless all arguments are integersr%zApow() 2nd argument cannot be negative when 3rd argument specifiedzpow() 3rd argument cannot be 0zSinsufficient precision: pow() 3rd argument must not have more than precision digitszXat least one of pow() 1st argument and 2nd argument must be nonzero; 0**0 is not definedr�)r�r�rr�rcr r8� _isintegerr�r?�_isevenr6rgrTrh�to_integral_valuer�rU�ranger5r_)r.r��modulor/r�r�Z modulo_is_nanr<�base�exponent�ir'r'r)� _power_modulo�sl zDecimal._power_modulocCst|�}|j|j}}x |ddkr6|d}|d7}qWt|�}|j|j}}x |ddkrn|d}|d7}qPW|dk�r||9}x |ddkr�|d}|d7}q�W|dkr�dS|d|} |jdkr�| } |j�o�|jdk�r|jt|�} t| | |d�}nd}tddd|| |�S|jdk�r�|d}|dk�r�||@|k�rPdSt |�d} |d d}|t t|��k�r~dSt| ||�} t|||�}| dk�s�|dk�r�dS| |k�r�dSd| }n�|dk�r�t |�d d} t d| |�\}}|�rdSx$|ddk�r$|d}| d8} �qW|dd}|t t|��k�rHdSt| ||�} t|||�}| dk�sx|dk�r|dS| |k�r�dSd| }ndS|d|k�r�dS| |}tdt|�|�S|dk�r�|d|d}}n�|dk�rt tt||���|k�rdSt |�}|dk�r>t tt|�|��|k�r>dS|d|}}x:|d|dk�oldkn�r�|d}|d}�qPWx:|d|dk�o�dkn�r�|d}|d}�q�W|dk�rt|dk�r�||k�r�dSt ||�\}}|dk�rdSdt |�|>}x>t |||d�\}}||k�r>Pn||d||}�qW||k�oh|dk�spdS|}|dk�r�||dt|�k�r�dS||}||9}|d|k�r�dSt|�}|j��r�|jdk�r�|jt|�} t|| |t |��}nd}td|d|||�S)Nr�r%r-r�rPr+�r���]�Arx�rZ�d)r+rr�r)rhrTrUr<r�r6rNr�r5�_nbitsrer_�_decimal_lshift_exactr�rg� _log10_lb)r.r��p�x�xc�xe�y�yc�yer�r�ZzerosZ last_digitr�Zemaxr�rtr4Zxc_bits�rem�ar�r�Zstr_xcr'r'r)�_power_exact(s�: &&&& zDecimal._power_exactcCs@|dk r|j|||�St|�}|tkr*|S|dkr8t�}|j||�}|rL|S|sd|s`|jtd�StSd}|jdkr�|j �r�|j �s�d}n|r�|jtd�S|j�}|s�|jdkr�t|dd�St |S|j�r�|jdkr�t |St|dd�S|tk�r�|j ��rZ|jdk�rd}n||jk�r"|j}nt|�}|j|}|d|jk�rxd|j}|jt�n|jt�|jt�d|j}t|dd||�S|j�}|j��r�|jdk|dkk�r�t|dd�St |Sd}d} |j�|j�} |dk|jdkk�r| tt|j��k�rHt|d|jd�}n,|j�}| tt|��k�rHt|d|d�}|dk�r�|j||jd�}|dk �r�|dk�r�td|j|j�}d} |dk�r:|j}t|�} | j| j}}t|�}|j|j}}|jdk�r�|}d }xJt||||||�\}}|d dtt|��|d�rP|d 7}�q�Wt|t|�|�}| �r2|j ��r2t|j�|jk�r�|jdt|j�}t|j|jd||j|�}|j �}|j!�xt"D]}d|j#|<�q�W|j$|�}|jt�|j%t&�r�|jt'�|j%t(�r|jt(d|j�x:t't&ttt)fD]}|j%|�r|j|��qWn |j$|�}|S) Nz0 ** 0r%r-z+x ** y with x negative and y not an integerrPr�FTrZrxr�z above Emax)*rr�r�rr�rcr �_Oner6r�r�r�r5r;r�r?rTrNrrr��_log10_exp_boundrer_r@r�rr7rhrUr<�_dpowerrGrH�_signals�trapsr��flagsr rrr)r.r�r�r/r:Zresult_signZ multiplierrUZself_adj�exactZboundr�r rrr rrr�extrar�r�Z newcontextZ exceptionr'r'r)�__pow__ s� " zDecimal.__pow__cCs"t|�}|tkr|S|j||d�S)N)r/)r�r�r)r.r�r/r'r'r)�__rpow__� szDecimal.__rpow__cCs�|dkrt�}|jr(|j|d�}|r(|S|j|�}|j�r>|S|sPt|jdd�S|j|j�g|j }t |j�}|j}x.|j|ddkr�||kr�|d7}|d8}qvWt|j|jd|�|�S)N)r/rPr%r-) rrOr�r�r�r5r6r@r�r�rer7rN)r.r/r:�dupr��endrUr'r'r)� normalize� s$ zDecimal.normalizecCs�t|dd�}|dkrt�}|dkr(|j}|js4|jr||j||�}|rH|S|j�sX|j�r||j�rp|j�rpt|�S|jtd�S|j �|j ko�|jkns�|jtd�S|s�t|j d|j �}|j|�S|j�}||jkr�|jtd�S||j d|jk�r|jtd�S|j|j |�}|j�|jk�r0|jtd�St|j�|jk�rN|jtd�S|�rn|j�|jk�rn|jt�|j |j k�r�||k�r�|jt�|jt�|j|�}|S) NT)r�zquantize with one INFz)target exponent out of bounds in quantizerPz9exponent of quantize result too large for current contextr-z7quantize result has too many digits for current context)r�rr>rOr�r�rrcr r�rNr@r5r6r�r�r?r�rer7�Eminr rr)r.rUr>r/r:r�r'r'r)r� sT zDecimal.quantizecCsDt|dd�}|js|jr8|j�r(|j�p6|j�o6|j�S|j|jkS)NT)r�)r�rOr��is_infiniterN)r.r�r/r'r'r)�same_quantumJ s zDecimal.same_quantumcCs�|jrt|�S|s t|jd|�S|j|krHt|j|jd|j||�St|j�|j|}|dkrzt|jd|d�}d}|j|}|||�}|jd|�p�d}|dkr�tt |�d�}t|j||�S)NrPr%r�r-) rOrr5r6rNr7rer�r_rT)r.rUr>rwZ this_functionr�r�r'r'r)r�Y s" zDecimal._rescalecCsh|dkrtd��|js|r$t|�S|j|j�d||�}|j�|j�krd|j|j�d||�}|S)Nr%z'argument should be at least 1 in _roundr-)rkrOrr�r�)r.�placesr>r:r'r'r)�_round{ s zDecimal._roundcCs�|jr"|j|d�}|r|St|�S|jdkr4t|�S|sFt|jdd�S|dkrTt�}|dkrb|j}|jd|�}||kr�|j t �|j t�|S)N)r/r%rP)rOr�rrNr5r6rr>r�rcrr)r.r>r/r:r'r'r)�to_integral_exact� s$ zDecimal.to_integral_exactcCs`|dkrt�}|dkr|j}|jr>|j|d�}|r6|St|�S|jdkrPt|�S|jd|�SdS)N)r/r%)rr>rOr�rrNr�)r.r>r/r:r'r'r)r�� s zDecimal.to_integral_valuecCs�|dkrt�}|jrB|j|d�}|r(|S|j�rB|jdkrBt|�S|sdt|jd|jd�}|j|�S|jdkrz|j t d�S|jd}t|�}|j d?}|j d@r�|jd}t|j�d?d}n|j}t|j�dd?}||}|dkr�|d|9}d } nt|d|�\}} | } ||8}d|}x(||}||k�r:Pn||d?}�q$W| �o\|||k} | �r�|dk�r||d|}n|d|9}||7}n|d dk�r�|d7}tdt|�|�}|j�}|jt�} |j|�}| |_|S)N)r/r%rPr+r-zsqrt(-x), x > 0r�rTrx)rrOr�r�r6rr5rNr�rcr r?rhrUrTrer7r�r_� _shallow_copy� _set_roundingrr>)r.r/r:r?�opr��c�lr�rr�r4r�r>r'r'r)�sqrt� s` zDecimal.sqrtcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j|�}|dkr�|j|�}|dkr�|}n|}|j|�S)NT)r�r-r%r�)r�rrOr�r�r�r�� compare_total)r.r�r/�sn�onr*r:r'r'r)r�%s& zDecimal.maxcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j|�}|dkr�|j|�}|dkr�|}n|}|j|�S)NT)r�r-r%r�)r�rrOr�r�r�r�r-)r.r�r/r.r/r*r:r'r'r)r�Os& zDecimal.mincCs8|jr dS|jdkrdS|j|jd�}|dt|�kS)NFr%TrP)rOrNr7re)r.�restr'r'r)r�qs zDecimal._isintegercCs(|s|jdkrdS|jd|jdkS)Nr%Tr-r�r�)rNr7)r.r'r'r)r�zszDecimal._isevencCs.y|jt|j�dStk r(dSXdS)Nr-r%)rNrer7rq)r.r'r'r)r��szDecimal.adjustedcCs|S)Nr')r.r'r'r)� canonical�szDecimal.canonicalcCs.t|dd�}|j||�}|r |S|j||d�S)NT)r�)r/)r�r�r�)r.r�r/r:r'r'r)�compare_signal�s zDecimal.compare_signalcCsft|dd�}|jr|jrtS|jr0|jr0tS|j}|j�}|j�}|sP|�r||kr�t|j�|jf}t|j�|jf}||kr�|r�tStS||kr�|r�tStStS|r�|dkr�tS|dkr�tS|dkr�tS|dkr�tSn4|dkr�tS|dkr�tS|dk�rtS|dk�rtS||k�rtS||k�r*tS|j|jk�rF|�rBtStS|j|jk�rb|�r^tStStS)NT)r�r-r+) r�r6�_NegativeOnerr�rer7�_ZerorN)r.r�r/r<Zself_nanZ other_nanZself_keyZ other_keyr'r'r)r-�sf zDecimal.compare_totalcCs&t|dd�}|j�}|j�}|j|�S)NT)r�)r�r�r-)r.r�r/r��or'r'r)�compare_total_mag�szDecimal.compare_total_magcCstd|j|j|j�S)Nr%)r5r7rNrO)r.r'r'r)r��szDecimal.copy_abscCs2|jrtd|j|j|j�Std|j|j|j�SdS)Nr%r-)r6r5r7rNrO)r.r'r'r)r��szDecimal.copy_negatecCs"t|dd�}t|j|j|j|j�S)NT)r�)r�r5r6r7rNrO)r.r�r/r'r'r)� copy_sign�s zDecimal.copy_signcCs�|dkrt�}|j|d�}|r"|S|j�d kr2tS|s:tS|j�dkrNt|�S|j}|j�}|jdkr�|t t |jdd��kr�tdd|jd�}�n0|jdkr�|t t |j �dd��kr�tdd|j �d�}n�|jdko�||k�r tddd|dd|�}n�|jdk�rB||dk�rBtdd|d|d�}n�t|�}|j|j}}|jdk�rj|}d}xFt||||�\} } | dd t t | ��|d�r�P|d7}�qpWtdt | �| �}|j�}|jt�}|j|�}||_|S)N)r/r-r%rZr�rPr=rxr�r�)rr�r�r4rrr?r�r6rer_r@r5r�rhrTrUr<�_dexpr'r(rr�r>)r.r/r:r �adjr)r*r�rr�rUr>r'r'r)rUsJ$( " zDecimal.expcCsdS)NTr')r.r'r'r)�is_canonicalLszDecimal.is_canonicalcCs|jS)N)rO)r.r'r'r)� is_finiteTszDecimal.is_finitecCs |jdkS)NrY)rN)r.r'r'r)r"\szDecimal.is_infinitecCs |jdkS)Nr4rX)r4rX)rN)r.r'r'r)r�`szDecimal.is_nancCs,|js|rdS|dkrt�}|j|j�kS)NF)rOrr!r�)r.r/r'r'r)� is_normalds zDecimal.is_normalcCs |jdkS)Nr4)rN)r.r'r'r)r�lszDecimal.is_qnancCs |jdkS)Nr-)r6)r.r'r'r)� is_signedpszDecimal.is_signedcCs |jdkS)NrX)rN)r.r'r'r)r�tszDecimal.is_snancCs,|js|rdS|dkrt�}|j�|jkS)NF)rOrr�r!)r.r/r'r'r)�is_subnormalxs zDecimal.is_subnormalcCs|jo|jdkS)NrP)rOr7)r.r'r'r)�is_zero�szDecimal.is_zerocCs�|jt|j�d}|dkr4tt|dd��dS|dkrXttd|dd��dSt|�}|j|j}}|dkr�t|d|�}t|�}t|�t|�||kS|ttd||��dS)Nr-�r�r+r%r�r�)rNrer7r_rhrTrU)r.r9r)r*r��num�denr'r'r)� _ln_exp_bound�szDecimal._ln_exp_boundc Cs|dkrt�}|j|d�}|r"|S|s*tS|j�dkr:tS|tkrFtS|jdkr\|jt d�St |�}|j|j}}|j }||j�d}x>t|||�}|ddttt|���|dr�P|d7}q�Wtt|dk�tt|��|�}|j�}|jt�} |j|�}| |_|S) N)r/r-zln of a negative valuer+rxr�rZr%)rr��_NegativeInfinityr�� _Infinityrr4r6rcr rhrTrUr?rC�_dlogrer_rgr5r'r(rr�r>) r.r/r:r)r*r�r r$r�r>r'r'r)�ln�s: $ z Decimal.lncCs�|jt|j�d}|dkr,tt|��dS|dkrHttd|��dSt|�}|j|j}}|dkr�t|d|�}td|�}t|�t|�||kdStd||�}t|�||dkdS) Nr-r+r%r���Z231r�r�)rNrer7r_rhrTrU)r.r9r)r*r�rArBr'r'r)r�szDecimal._log10_exp_boundc CsH|dkrt�}|j|d�}|r"|S|s*tS|j�dkr:tS|jdkrP|jtd�S|jddkr�|jdd�dt |j�dkr�t |jt |j�d�}n�t|�}|j |j}}|j}||j�d}x>t|||�}|dd t tt|���|dr�P|d 7}q�Wtt |dk�tt|��|�}|j�}|jt�} |j|�}| |_|S)N)r/r-zlog10 of a negative valuer%r�rPr+rxr�rZ)rr�rDr�rEr6rcr r7rerrNrhrTrUr?r�_dlog10r_rgr5r'r(rr�r>) r.r/r:r)r*r�r r$r�r>r'r'r)�log10�s: .$ z Decimal.log10cCsV|j|d�}|r|S|dkr"t�}|j�r.tS|s@|jtdd�St|j��}|j|�S)N)r/zlogb(0)r-) r�rr�rErcr rr�r�)r.r/r:r'r'r)�logb s zDecimal.logbcCs8|jdks|jdkrdSx|jD]}|dkr dSq WdS)Nr%FZ01T)r6rNr7)r.�digr'r'r)� _islogical> szDecimal._islogicalcCs�|jt|�}|dkr$d||}n|dkr<||jd�}|jt|�}|dkr`d||}n|dkrx||jd�}||fS)Nr%rP)r?re)r.r/�opa�opbZdifr'r'r)� _fill_logicalL szDecimal._fill_logicalcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t d|j d�pxdd�S)NT)r�rRcSs$g|]\}}tt|�t|�@��qSr')r_rT)�.0r�br'r'r)� <listcomp>g sz'Decimal.logical_and.<locals>.<listcomp>r%rP)rr�rMrcr rPr7rm�zipr5rf)r.r�r/rNrOr�r'r'r)�logical_andY s zDecimal.logical_andcCs(|dkrt�}|jtdd|jd�|�S)Nr%r�)r�logical_xorr5r?)r.r/r'r'r)�logical_invertj szDecimal.logical_invertcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t d|j d�pxdd�S)NT)r�rRcSs$g|]\}}tt|�t|�B��qSr')r_rT)rQrrRr'r'r)rS sz&Decimal.logical_or.<locals>.<listcomp>r%rP)rr�rMrcr rPr7rmrTr5rf)r.r�r/rNrOr�r'r'r)� logical_orq s zDecimal.logical_orcCs~|dkrt�}t|dd�}|j�s.|j�r8|jt�S|j||j|j�\}}djdd�t||�D��}t d|j d�pxdd�S)NT)r�rRcSs$g|]\}}tt|�t|�A��qSr')r_rT)rQrrRr'r'r)rS� sz'Decimal.logical_xor.<locals>.<listcomp>r%rP)rr�rMrcr rPr7rmrTr5rf)r.r�r/rNrOr�r'r'r)rV� s zDecimal.logical_xorcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j�j|j��}|dkr�|j|�}|dkr�|}n|}|j|�S)NT)r�r-r%r�) r�rrOr�r�r�r�r�r-)r.r�r/r.r/r*r:r'r'r)�max_mag� s& zDecimal.max_magcCs�t|dd�}|dkrt�}|js&|jr~|j�}|j�}|s>|r~|dkrX|dkrX|j|�S|dkrr|dkrr|j|�S|j||�S|j�j|j��}|dkr�|j|�}|dkr�|}n|}|j|�S)NT)r�r-r%r�) r�rrOr�r�r�r�r�r-)r.r�r/r.r/r*r:r'r'r)�min_mag� s& zDecimal.min_magcCs�|dkrt�}|j|d�}|r"|S|j�dkr2tS|j�dkrTtdd|j|j��S|j�}|jt �|j �|j|�}||kr�|S|jtdd|j �d�|�S)N)r/r-r%r=r�r�)rr�r�rDr5r?r�rGr(r�_ignore_all_flagsr�r�r�)r.r/r:�new_selfr'r'r)� next_minus� s" zDecimal.next_minuscCs�|dkrt�}|j|d�}|r"|S|j�dkr2tS|j�dkrTtdd|j|j��S|j�}|jt �|j �|j|�}||kr�|S|jtdd|j �d�|�S)N)r/r-r=r%r�r�)rr�r�rEr5r?r�rGr(rr[r�r�r�)r.r/r:r\r'r'r)� next_plus� s" zDecimal.next_pluscCs�t|dd�}|dkrt�}|j||�}|r.|S|j|�}|dkrJ|j|�S|dkr^|j|�}n |j|�}|j�r�|jt d|j �|jt�|jt�nD|j �|jkr�|jt�|jt�|jt�|jt�|s�|jt�|S)NT)r�r%r-z Infinite result from next_towardr�)r�rr�r�r7r^r]r�rcrr6rrr�r!rr r)r.r�r/r:Z comparisonr'r'r)�next_toward� s4 zDecimal.next_towardcCs�|j�rdS|j�rdS|j�}|dkr,dS|d kr8dS|j�rN|jrJdSdS|dkr\t�}|j|d�rv|jrrd Sd S|jr�dSdSdS)Nr�r�r-z +Infinityz -Infinityz-Zeroz+Zero)r/z -Subnormalz +Subnormalz-Normalz+Normalr�)r�r�r�r?r6rr>)r.r/�infr'r'r)�number_class+s,zDecimal.number_classcCstd�S)Nr�)r)r.r'r'r)�radixUsz Decimal.radixcCs�|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�S|jt|�ko^|jknsn|jt�S|j�r~t |�St|�}|j }|jt|�}|dkr�d||}n|dkr�||d�}||d�|d|�}t|j |jd�p�d|j�S)NT)r�r%rP)rr�r�rNrcr r?rTr�rr7rer5r6rf)r.r�r/r:�torot�rotdig�topadZrotatedr'r'r)�rotateYs, " zDecimal.rotatecCs�|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�Sd|j|j}d|j|j}|t|�kox|kns�|jt�S|j �r�t |�St|j|j |jt|��}|j|�}|S)NT)r�r%r+r�)rr�r�rNrcr r@r?rTr�rr5r6r7r�)r.r�r/r:ZliminfZlimsupr~r'r'r)�scalebzs" zDecimal.scalebcCs|dkrt�}t|dd�}|j||�}|r.|S|jdkrB|jt�S|jt|�ko^|jknsn|jt�S|j�r~t |�St|�}|j }|jt|�}|dkr�d||}n|dkr�||d�}|dkr�|d|�}n|d|}||jd�}t|j |jd��pd|j�S)NT)r�r%rP)rr�r�rNrcr r?rTr�rr7rer5r6rf)r.r�r/r:rcrdreZshiftedr'r'r)r��s2 " z Decimal.shiftcCs|jt|�ffS)N)� __class__r_)r.r'r'r)� __reduce__�szDecimal.__reduce__cCst|�tkr|S|jt|��S)N)�typerrhr_)r.r'r'r)�__copy__�szDecimal.__copy__cCst|�tkr|S|jt|��S)N)rjrrhr_)r.�memor'r'r)�__deepcopy__�szDecimal.__deepcopy__cCsN|dkrt�}t||d�}|jrXt|j|�}t|j��}|ddkrL|d7}t|||�S|ddkrvddg|j|d<|ddkr�t |j|j |jd�}|j}|d}|dk �r|ddkr�|j |d |�}nF|dd kr�|j||�}n*|ddk�rt|j �|k�r|j ||�}|�rB|jdk�rB|dd k�rB|jd|�}|jt|j �} |ddk�r�|�r||dk �r|d |} nd } nB|dd k�r�| } n.|ddk�r�|jdk�r�| dk�r�| } nd } | dk�r�d}d| |j }nP| t|j �k�r|j d| t|j �}d}n"|j d| ��p$d}|j | d�}| | } t|j||| |�S)N)�_localeconvrj�%�g�Gr+� precision�eEr-zfF%ZgGr%r�rPrRi����)r�_parse_format_specifierrO�_format_signr6r_r�� _format_alignr�r5r7rNr>r%r�re�_format_number)r.Z specifierr/rn�specr<�bodyr>rrr�r�rurvrUr'r'r)� __format__�sZ " zDecimal.__format__)rNr7r6rO)rPN)NN)N)N)N)N)N)N)FN)N)N)N)TN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)N)N)NN)N)NN)NN)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)NN)�r1r2r3� __slots__r]�classmethodrpr�r�r�r�r�r�r�r�r�r�r�r�r�r�r{r�r�r�r�r�r�r��__radd__r�r�r��__rmul__r�r�r�r�r�r�r�r�r�r�r�r�� __trunc__r��propertyr�r�r�r8r�r�r�r�r�r�r�r�r��dictr�r�r�r�r�rrrrr r�r#r�r%r&r��to_integralr,r�r�r�r�r�r1r2r-r6r�r�r7rUr:r;r"r�r<r�r=r�r>r?rCrGrrJrKrMrPrUrWrXrVrYrZr]r^r_rarbrfrgr�rirkrmrzr'r'r'r)r+s ( !@ 2 4 V7;!$K f >,UnY="c*" IK23 .*!'FcCs&tjt�}||_||_||_||_|S)N)r\r]rr6r7rNrO)r<Zcoefficientr�Zspecialr.r'r'r)r5s r5c@s$eZdZdd�Zdd�Zdd�ZdS)rMcCs|j�|_dS)N)rG�new_context)r.r�r'r'r)�__init__9sz_ContextManager.__init__cCst�|_t|j�|jS)N)r� saved_contextrr�)r.r'r'r)� __enter__;s z_ContextManager.__enter__cCst|j�dS)N)rr�)r.�t�v�tbr'r'r)�__exit__?sz_ContextManager.__exit__N)r1r2r3r�r�r�r'r'r'r)rM3srMc @s�eZdZd�dd�Zdd�Zdd�Zdd �Zd d�Zdd �Zdd�Z dd�Z dd�Zdd�Zdd�Z e Zd�dd�Zdd�Zdd�Zdd�ZdZd d!�Zd"d#�Zd$d%�Zd�d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Z d;d<�Z!d=d>�Z"d?d@�Z#dAdB�Z$dCdD�Z%dEdF�Z&dGdH�Z'dIdJ�Z(dKdL�Z)dMdN�Z*dOdP�Z+dQdR�Z,dSdT�Z-dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d_d`�Z3dadb�Z4dcdd�Z5dedf�Z6dgdh�Z7didj�Z8dkdl�Z9dmdn�Z:dodp�Z;dqdr�Z<dsdt�Z=dudv�Z>dwdx�Z?dydz�Z@d{d|�ZAd}d~�ZBdd��ZCd�d��ZDd�d��ZEd�d��ZFd�d�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUeUZVdS)�rNc s>yt} Wntk rYnX|dk r*|n| j|_|dk r>|n| j|_|dk rR|n| j|_|dk rf|n| j|_|dk rz|n| j|_|dk r�|n| j|_| dkr�g|_n| |_�dkr�| j j �|_ n.t�t�s�t�fdd�t �D��|_ n�|_ �dk�r tjt d�|_n0t�t��s4t�fdd�t �D��|_n�|_dS)Nc3s|]}|t|�k�fVqdS)N)rT)rQr�)rr'r)� <genexpr>nsz#Context.__init__.<locals>.<genexpr>r%c3s|]}|t|�k�fVqdS)N)rT)rQr�)rr'r)r�us)r� NameErrorr?r>r!r@r�r��_ignored_flagsrrGr^r�r�fromkeysr)r.r?r>r!r@r�r�rrr�Zdcr')rrr)r�Us. zContext.__init__cCs�t|t�std|��|dkr<||kr�td||||f��nJ|dkrb||kr�td||||f��n$||ksr||kr�td||||f��tj|||�S)Nz%s must be an integerz-infz%s must be in [%s, %d]. got: %sr`z%s must be in [%d, %s]. got: %sz%s must be in [%d, %d]. got %s)r^rTrqrkr\�__setattr__)r.�namersZvminZvmaxr'r'r)�_set_integer_checkys zContext._set_integer_checkcCsht|t�std|��x |D]}|tkrtd|��qWx tD]}||kr>td|��q>Wtj|||�S)Nz%s must be a signal dictz%s is not a valid signal dict)r^r�rqr�KeyErrorr\r�)r.r�r~�keyr'r'r)�_set_signal_dict�s zContext._set_signal_dictcCs�|dkr|j||dd�S|dkr0|j||dd�S|dkrH|j||dd�S|dkr`|j||dd�S|d krx|j||dd�S|d kr�|tkr�td|��tj|||�S|dks�|d kr�|j||�S|dkr�tj|||�Std|��dS)Nr?r-r`r!z-infr%r@r�r�r>z%s: invalid rounding moderrr�z.'decimal.Context' object has no attribute '%s')r��_rounding_modesrqr\r�r�rK)r.r�rsr'r'r)r��s(zContext.__setattr__cCstd|��dS)Nz%s cannot be deleted)rK)r.r�r'r'r)�__delattr__�szContext.__delattr__c CsNdd�|jj�D�}dd�|jj�D�}|j|j|j|j|j|j|j ||ffS)NcSsg|]\}}|r|�qSr'r')rQ�sigr�r'r'r)rS�sz&Context.__reduce__.<locals>.<listcomp>cSsg|]\}}|r|�qSr'r')rQr�r�r'r'r)rS�s) r�itemsrrhr?r>r!r@r�r�)r.rrr'r'r)ri�s zContext.__reduce__cCs|g}|jdt|��dd�|jj�D�}|jddj|�d�dd�|jj�D�}|jddj|�d�dj|�d S) NzrContext(prec=%(prec)d, rounding=%(rounding)s, Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d, clamp=%(clamp)dcSsg|]\}}|r|j�qSr')r1)rQr}r�r'r'r)rS�sz$Context.__repr__.<locals>.<listcomp>zflags=[z, �]cSsg|]\}}|r|j�qSr')r1)rQr�r�r'r'r)rS�sztraps=[�))rl�varsrr�rmr)r.r��namesr'r'r)r��szContext.__repr__cCsx|jD]}d|j|<qWdS)Nr%)r)r.�flagr'r'r)rH�szContext.clear_flagscCsx|jD]}d|j|<qWdS)Nr%)r)r.r�r'r'r)�clear_traps�szContext.clear_trapsc Cs.t|j|j|j|j|j|j|j|j|j � }|S)N) rr?r>r!r@r�r�rrr�)r.�ncr'r'r)r'�szContext._shallow_copyc Cs6t|j|j|j|j|j|j|jj�|j j�|j � }|S)N)rr?r>r!r@r�r�rrGrr�)r.r�r'r'r)rG�s zContext.copycGsZtj||�}||jkr(|�j|f|��Sd|j|<|j|sN|�j|f|��S||��dS)Nr-)�_condition_map�getr�r0rr)r.Z conditionZexplanationr(�errorr'r'r)rc�s zContext._raise_errorcCs |jt�S)N)� _ignore_flagsr)r.r'r'r)r[�szContext._ignore_all_flagscGs|jt|�|_t|�S)N)r�ri)r.rr'r'r)r��szContext._ignore_flagscGs<|rt|dttf�r|d}x|D]}|jj|�q$WdS)Nr%)r^rjrir��remove)r.rr�r'r'r)� _regard_flags�s zContext._regard_flagscCst|j|jd�S)Nr-)rTr!r?)r.r'r'r)r�sz Context.EtinycCst|j|jd�S)Nr-)rTr@r?)r.r'r'r)r�szContext.EtopcCs|j}||_|S)N)r>)r.rjr>r'r'r)r(szContext._set_roundingrPcCsjt|t�r*||j�ksd|kr*|jtd�St||d�}|j�r`t|j�|j |j kr`|jtd�S|j|�S)NrQzAtrailing or leading whitespace and underscores are not permitted.)r/zdiagnostic info too long in NaN)r^r_rarcrrr�rer7r?r�r�)r.rAr~r'r'r)�create_decimal#szContext.create_decimalcCstj|�}|j|�S)N)rrpr�)r.r}r~r'r'r)�create_decimal_from_float4s z!Context.create_decimal_from_floatcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)rgFszContext.abscCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)�add[s zContext.addcCst|j|��S)N)r_r�)r.rr'r'r)�_applypszContext._applycCst|t�std��|j�S)Nz,canonical requires a Decimal as an argument.)r^rrqr1)r.rr'r'r)r1ss zContext.canonicalcCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r��s!zContext.comparecCst|dd�}|j||d�S)NT)r�)r/)r�r2)r.rrRr'r'r)r2�s zContext.compare_signalcCst|dd�}|j|�S)NT)r�)r�r-)r.rrRr'r'r)r-�szContext.compare_totalcCst|dd�}|j|�S)NT)r�)r�r6)r.rrRr'r'r)r6�szContext.compare_total_magcCst|dd�}|j�S)NT)r�)r�r�)r.rr'r'r)r��s zContext.copy_abscCst|dd�}t|�S)NT)r�)r�r)r.rr'r'r)�copy_decimal�s zContext.copy_decimalcCst|dd�}|j�S)NT)r�)r�r�)r.rr'r'r)r�s zContext.copy_negatecCst|dd�}|j|�S)NT)r�)r�r7)r.rrRr'r'r)r7szContext.copy_signcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)�divide+s zContext.dividecCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)� divide_intPs zContext.divide_intcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)r�gs zContext.divmodcCst|dd�}|j|d�S)NT)r�)r/)r�rU)r.rr'r'r)rU|szContext.expcCst|dd�}|j|||d�S)NT)r�)r/)r�r�)r.rrRr*r'r'r)r��szContext.fmacCst|t�std��|j�S)Nz/is_canonical requires a Decimal as an argument.)r^rrqr:)r.rr'r'r)r:�s zContext.is_canonicalcCst|dd�}|j�S)NT)r�)r�r;)r.rr'r'r)r;�szContext.is_finitecCst|dd�}|j�S)NT)r�)r�r")r.rr'r'r)r"�szContext.is_infinitecCst|dd�}|j�S)NT)r�)r�r�)r.rr'r'r)r��s zContext.is_nancCst|dd�}|j|d�S)NT)r�)r/)r�r<)r.rr'r'r)r<�szContext.is_normalcCst|dd�}|j�S)NT)r�)r�r�)r.rr'r'r)r�szContext.is_qnancCst|dd�}|j�S)NT)r�)r�r=)r.rr'r'r)r=szContext.is_signedcCst|dd�}|j�S)NT)r�)r�r�)r.rr'r'r)r�$s zContext.is_snancCst|dd�}|j|d�S)NT)r�)r/)r�r>)r.rr'r'r)r>4szContext.is_subnormalcCst|dd�}|j�S)NT)r�)r�r?)r.rr'r'r)r?JszContext.is_zerocCst|dd�}|j|d�S)NT)r�)r/)r�rG)r.rr'r'r)rG[sz Context.lncCst|dd�}|j|d�S)NT)r�)r/)r�rJ)r.rr'r'r)rJqsz Context.log10cCst|dd�}|j|d�S)NT)r�)r/)r�rK)r.rr'r'r)rK�szContext.logbcCst|dd�}|j||d�S)NT)r�)r/)r�rU)r.rrRr'r'r)rU�szContext.logical_andcCst|dd�}|j|d�S)NT)r�)r/)r�rW)r.rr'r'r)rW�szContext.logical_invertcCst|dd�}|j||d�S)NT)r�)r/)r�rX)r.rrRr'r'r)rX�szContext.logical_orcCst|dd�}|j||d�S)NT)r�)r/)r�rV)r.rrRr'r'r)rV�szContext.logical_xorcCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r�szContext.maxcCst|dd�}|j||d�S)NT)r�)r/)r�rY)r.rrRr'r'r)rY&szContext.max_magcCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r�7szContext.mincCst|dd�}|j||d�S)NT)r�)r/)r�rZ)r.rrRr'r'r)rZRszContext.min_magcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)�minuscsz Context.minuscCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)�multiplyts zContext.multiplycCst|dd�}|j|d�S)NT)r�)r/)r�r])r.rr'r'r)r]�szContext.next_minuscCst|dd�}|j|d�S)NT)r�)r/)r�r^)r.rr'r'r)r^�szContext.next_pluscCst|dd�}|j||d�S)NT)r�)r/)r�r_)r.rrRr'r'r)r_�s zContext.next_towardcCst|dd�}|j|d�S)NT)r�)r/)r�r )r.rr'r'r)r �szContext.normalizecCst|dd�}|j|d�S)NT)r�)r/)r�ra)r.rr'r'r)ra�s/zContext.number_classcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)�plus)szContext.pluscCs:t|dd�}|j|||d�}|tkr2td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�rr�rq)r.rrRr�r�r'r'r)�power:s Iz Context.powercCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r��s7zContext.quantizecCstd�S)Nr�)r)r.r'r'r)rb�sz Context.radixcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)r��s zContext.remaindercCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r��szContext.remainder_nearcCst|dd�}|j||d�S)NT)r�)r/)r�rf)r.rrRr'r'r)rfszContext.rotatecCst|dd�}|j|�S)NT)r�)r�r#)r.rrRr'r'r)r#1szContext.same_quantumcCst|dd�}|j||d�S)NT)r�)r/)r�rg)r.rrRr'r'r)rgIszContext.scalebcCst|dd�}|j||d�S)NT)r�)r/)r�r�)r.rrRr'r'r)r�\sz Context.shiftcCst|dd�}|j|d�S)NT)r�)r/)r�r,)r.rr'r'r)r,zszContext.sqrtcCs8t|dd�}|j||d�}|tkr0td|��n|SdS)NT)r�)r/zUnable to convert %s to Decimal)r�r�r�rq)r.rrRr�r'r'r)�subtract�s zContext.subtractcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)r��szContext.to_eng_stringcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)� to_sci_string�szContext.to_sci_stringcCst|dd�}|j|d�S)NT)r�)r/)r�r&)r.rr'r'r)r&�szContext.to_integral_exactcCst|dd�}|j|d�S)NT)r�)r/)r�r�)r.rr'r'r)r��szContext.to_integral_value) NNNNNNNNN)N)rP)N)Wr1r2r3r�r�r�r�r�rir�rHr�r'rGrkrcr[r�r�r�r�r�r(r�r�rgr�r�r1r�r2r-r6r�r�r�r7r�r�r�rUr�r:r;r"r�r<r�r=r�r>r?rGrJrKrUrWrXrVr�rYr�rZr�r�r]r^r_r rar�r�r�rbr�r�rfr#rgr�r,r�r�r�r&r�r�r'r'r'r)rBs� " $# % #2 P:&" c@s&eZdZd Zd dd�Zdd�ZeZdS)rhr<rTrUNcCsf|dkrd|_d|_d|_nFt|t�rD|j|_t|j�|_|j|_n|d|_|d|_|d|_dS)Nr%r-r+)r<rTrUr^rr6r7rN)r.rsr'r'r)r�s z_WorkRep.__init__cCsd|j|j|jfS)Nz(%r, %r, %r))r<rTrU)r.r'r'r)r�(sz_WorkRep.__repr__)r<rTrU)N)r1r2r3r{r�r�r�r'r'r'r)rhs rhcCs�|j|jkr|}|}n|}|}tt|j��}tt|j��}|jtd||d�}||jd|krpd|_||_|jd|j|j9_|j|_||fS)Nr-r+r�r�)rUrer_rTr�)r�r�r?Ztmpr�Ztmp_lenZ other_lenrUr'r'r)r�/sr�cCsb|dkrdS|dkr |d|Stt|��}t|�t|jd��}||krPdS|d|SdS)Nr%r�rP)r_rgre�rstrip)r4r�Zstr_nZval_nr'r'r)rOsrcCsF|dks|dkrtd��d}x$||kr@||||d?}}qW|S)Nr%z3Both arguments to _sqrt_nearest should be positive.r-)rk)r4rrRr'r'r)� _sqrt_nearestds r�cCs2d|>||?}}|d||d@|d@|kS)Nr-r+r')rr�rRr�r'r'r)�_rshift_nearestssr�cCs&t||�\}}|d||d@|kS)Nr+r-)r�)rrRr�r�r'r'r)�_div_nearest{sr�rc Cs�||}d}xn||kr*t|�||>|ksF||krzt|�||?|krzt||d>|t||t||�|��}|d7}qWtdtt|��d|�}t||�}t||�}x0t|ddd�D]}t||�t|||�}q�Wt|||�S)Nr%r-r�rZi����r�)rgr�r�r�rTrer_r�) r�M�Lr�R�TZyshift�wrr'r'r)�_ilog�s r�c Cs�|d7}tt|��}||||dk}|dkr�d|}|||}|dkrZ|d|9}nt|d|�}t||�}t|�}t|||�}||} nd}t|d|�} t| |d�S)Nr+r-r%r�r)rer_r�r�� _log10_digits) r*r�r r+r}r�r�log_dZlog_10Zlog_tenpowerr'r'r)rI�s rIc Cs�|d7}tt|��}||||dk}|dkrr|||}|dkrR|d|9}nt|d|�}t|d|�}nd}|r�ttt|���d}||dkr�t|t||�d|�}q�d}nd}t||d�S)Nr+r-r%r�r)rer_r�r�rgr�) r*r�r r+r}rr�rZ f_log_tenr'r'r)rF�s"rFc@seZdZdd�Zdd�ZdS)� _Log10MemoizecCs d|_dS)NZ/23025850929940456840179914546843642076011014886)rw)r.r'r'r)r�sz_Log10Memoize.__init__cCs�|dkrtd��|t|j�kr�d}xLd||d}tttd||�d��}||d�d|krdP|d7}q$W|jd�dd �|_t|jd|d��S) Nr%zp should be nonnegativerZr�r+rrPr-r�)rkrerwr_r�r�r�rT)r.r rr�rwr'r'r)� getdigitss z_Log10Memoize.getdigitsN)r1r2r3r�r�r'r'r'r)r�sr�c Cs�t||>|�}tdtt|��d|�}t||�}||>}x.t|ddd�D]}t|||||�}qRWx6t|ddd �D]"}||d>}t||||�}q�W||S) Nr�rZr-r%r+i����r�r�r�)rrTrer_r�r�) rr�r�r�r�rZMshiftr�rr'r'r)�_iexp&s r�c Cs�|d7}td|tt|��d�}||}||}|dkrH|d|}n|d|}t|t|��\}}t|d|�}tt|d|�d�||dfS)Nr+r%r-r�i�rZ)r�rer_r�r�r�r�) r*r�r rr�r�ZcshiftZquotrr'r'r)r8Ksr8cCs�ttt|���|}t||||d�}||}|dkrJ||d|}nt||d|�}|dkr�tt|��|dk|dkkr�d|ddd|} } q�d|d|} } n,t||d|d�\} } t| d�} | d7} | | fS)Nr-r%r�)rer_rgrFr�r8)rr rrr rRZlxcr�Zpcr�rUr'r'r)ros rr�F�5�(�r@�r�rx) r��2�3�4�5�6�7�8r=cCs0|dkrtd��t|�}dt|�||dS)Nr%z0The argument to _log10_lb should be nonnegative.r)rkr_re)r*Z correctionZstr_cr'r'r)r �sr cCsLt|t�r|St|t�r t|�S|r8t|t�r8tj|�S|rHtd|��tS)NzUnable to convert %s to Decimal)r^rrTrorprqr�)r�r�Zallow_floatr'r'r)r��s r�cCs�t|t�r||fSt|tj�rR|jsDt|jtt|j �|j �|j�}|t|j�fS|rrt|tj �rr|jdkrr|j}t|t�r�t�}|r�d|jt<n|jtd�|tj|�fSttfS)Nr%r-z;strict semantics for mixing floats and Decimals are enabled)r^r�_numbersZRationalrOr5r6r_rTr7�denominatorrN� numeratorZComplexr�r�rorrrrcrpr�)r.r�r�r/r'r'r)r��s$ r�ri?B)r?r>rrr@r!r�r�r[)r?r>rra� # A numeric string consists of: # \s* (?P<sign>[-+])? # an optional sign, followed by either... ( (?=\d|\.\d) # ...a number (with at least one digit) (?P<int>\d*) # having a (possibly empty) integer part (\.(?P<frac>\d*))? # followed by an optional fractional part (E(?P<exp>[-+]?\d+))? # followed by an optional exponent, or... | Inf(inity)? # ...an infinity, or... | (?P<signal>s)? # ...an (optionally signaling) NaN # NaN (?P<diag>\d*) # with (possibly empty) diagnostic info. ) # \s* \Z z0*$z50*$z�\A (?: (?P<fill>.)? (?P<align>[<>=^]) )? (?P<sign>[-+ ])? (?P<alt>\#)? (?P<zeropad>0)? (?P<minimumwidth>(?!0)\d+)? (?P<thousands_sep>,)? (?:\.(?P<precision>0|(?!0)\d+))? (?P<type>[eEfFgGn%])? \Z cCs�tj|�}|dkrtd|��|j�}|d}|d}|ddk |d<|drv|dk rbtd|��|dk rvtd|��|p|d|d<|p�d|d<|d dkr�d |d <t|dp�d�|d<|d dk r�t|d �|d <|d dkr�|ddks�|ddkr�d|d <|ddk�rfd|d<|dk�r&tj�}|ddk �r@td|��|d|d<|d|d<|d|d<n*|ddk�r|d|d<ddg|d<d|d<|S)NzInvalid format specifier: �fill�align�zeropadz7Fill character conflicts with '0' in format specifier: z2Alignment conflicts with '0' in format specifier: � �>r<rS�minimumwidthrPrrr%rjZgGnr-r4rp� thousands_sepzJExplicit thousands separator conflicts with 'n' type in format specifier: �grouping� decimal_pointrRrZr�)�_parse_format_specifier_regex�matchrk� groupdictrT�_locale� localeconv)�format_specrnrtZformat_dictr�r�r'r'r)rtDsN rtc Cs�|d}|d}||t|�t|�}|d}|dkrF|||}nj|dkr\|||}nT|dkrr|||}n>|dkr�t|�d}|d|�||||d�}ntd ��|S) Nr�r�r��<r��=�^r+zUnrecognised alignment field)rerk) r<ryrxr�r�Zpaddingr�r�Zhalfr'r'r)rv�s"rvcCspddlm}m}|sgS|ddkrJt|�dkrJ||dd�||d��S|d tjkrd|dd �Std��dS)Nr%)�chain�repeatr-r+z unrecognised format for groupingr�r�r�r�r�)� itertoolsr�r�rer��CHAR_MAXrk)r�r�r�r'r'r)�_group_lengths�s r�cCs�|d}|d}g}x�t|�D]�}|dkr2td��ttt|�|d�|�}|jd|t|�||d��|d|�}||8}|r�|dkr�P|t|�8}qWtt|�|d�}|jd|t|�||d��|jt|��S)Nr�r�r%zgroup length should be positiver-rP)r�rkr�r�rerlrm�reversed)rwrx� min_width�sepr��groupsr+r'r'r)�_insert_thousands_sep�s $$r�cCs$|rdS|ddkr|dSdSdS)NrSr<z +rRr')�is_negativerxr'r'r)ru�s rucCs�t||�}|s|dr"|d|}|dks6|ddkr\ddddd�|d}|d j||�7}|dd krp|d 7}|dr�|dt|�t|�}nd}t|||�}t||||�S) NZaltr�r%rjrsr�r�)r�r�rqrpz{0}{1:+}ror�r�)ru�formatrer�rv)r�rurvrUrxr<Zecharr�r'r'r)rw�s rwZInfz-Infr�ll����l������N�Zoi���)N)F)r%)r)r)FF)Fi���)N)r-r�)|�__all__r1rC�__version__Z__libmpdec_version__ZmathryZnumbersr�rD�collectionsr&Z_namedtupler�ImportErrorrrrrrrrrr$�maxsizer r!r"r#�ArithmeticErrorrrr r�ZeroDivisionErrorr rrrrrr rrrqrrr�r�rIr\rArErK�hasattrrJrFrrrrr5�Number�registerrMrrhr�rTr|rrr�r�r�r�rIrFr�r�r�r�r8rr r�r�rrr�re�compile�VERBOSE� IGNORECASEr�r`r�r��DOTALLr�Zlocaler�rtrvr�r�rurwrErDr9r4rr3r;� hash_info�modulusr�r`r�r�r�r�r�r'r'r'r)�<module>us~ & . ^ 0",# %$+ * P % )
/home/../lib64/cifs-utils/../enchant/../python3.6/__pycache__/_pydecimal.cpython-36.opt-2.pyc