3
X'ícQV ã @ s d Z ddlZddlZdNZdZd d
ZG dd dZd
d Zdd Zdd Z dd Z
dd Zdd ZG dd de
Zdddddd d!d"hZdejd#ejfd$ejd%d&je d'fd(ejd)fd*ejd+fd,ejd-ejfgZd.d/ ZdOd0d1ZdPd2d3Zd4d5 Zd6d7 Zd8d9 Zd:d; ZG d<d= d=Zd>d? Zd@dA ZdBdC ZG dDdE dEZG dFdG dGeZ G dHdI dIeZ!G dJdK dKe!Z"G dLdM dMeZ#dS )Qz°
babel.numbers
~~~~~~~~~~~~~
CLDR Plural support. See UTS #35.
:copyright: (c) 2013-2022 by the Babel Team.
:license: BSD, see LICENSE for more details.
é NÚzeroÚoneÚtwoÚfewÚmanyÚotherc C sÞ t | }t|}t|tr6||kr(|}ntjt|}t|tjr²|j }|j}|dk rf|j |d
nf }dj
dd |D }|jd}t|}t|} t|p d}
t|p¬d}nd } } }
}d }}
|||| |
|||
fS )uö Extract operands from a decimal, a float or an int, according to `CLDR rules`_.
The result is a 8-tuple (n, i, v, w, f, t, c, e), where those symbols are as follows:
====== ===============================================================
Symbol Value
------ ---------------------------------------------------------------
n absolute value of the source number (integer and decimals).
i integer digits of n.
v number of visible fraction digits in n, with trailing zeros.
w number of visible fraction digits in n, without trailing zeros.
f visible fractional digits in n, with trailing zeros.
t visible fractional digits in n, without trailing zeros.
c compact decimal exponent value: exponent of the power of 10 used in compact decimal formatting.
e currently, synonym for âcâ. however, may be redefined in the future.
====== ===============================================================
.. _`CLDR rules`: https://www.unicode.org/reports/tr35/tr35-61/tr35-numbers.html#Operands
:param source: A real number
:type source: int|float|decimal.Decimal
:return: A n-i-v-w-f-t-c-e tuple
:rtype: tuple[decimal.Decimal, int, int, int, int, int, int, int]
r NÚ c s s | ]}t |V qd S )N)Ústr)Ú.0Úd© r ú-/tmp/pip-build-gk9425m9/babel/babel/plural.pyú <genexpr>A s z#extract_operands.<locals>.<genexpr>Ú0)
ÚabsÚintÚ
isinstanceÚfloatÚdecimalÚDecimalr Úas_tupleÚexponentÚdigitsÚjoinÚrstripÚlen)ÚsourceÚnÚiZ dec_tupleÚexpZfraction_digitsZtrailingZno_trailingÚvÚwÚfÚtÚcÚer r r