ƪb'0dZddlZddlZddlmZmZddlZddlm Z m Z m Z  e e dZGddeZd0dZd0d Zd0d Zd0d Zdefd Zefd ZdZdefdZ d1dZefdZefdZefdZefdZefdZefdZ dZ!dZ"deddfdZ#Gdde$Z%deddddfdZ&deddddfd Z'deddfd!Z(dedfd"Z)Gd#d$e*Z+efd%Z,edfd&Z-d'Z.d(Z/d)e.zZ0d*e/zZ1d+Z2ejfe0e1e2Z4d,Z5d-Z6Gd.d/Z7y#e $reZ YwxYw)2a babel.numbers ~~~~~~~~~~~~~ Locale dependent formatting and parsing of numeric data. The default locale for the functions in this module is determined by the following environment variables, in that order: * ``LC_NUMERIC``, * ``LC_ALL``, and * ``LANG`` :copyright: (c) 2013-2022 by the Babel Team. :license: BSD, see LICENSE for more details. N)datedatetime)default_localeLocale get_global LC_NUMERICceZdZdZdZy)UnknownCurrencyErrorzRException thrown when a currency is requested for which no data is available. cDtj|d|z||_y)zkCreate the exception. :param identifier: the identifier string of the unsupported currency zUnknown currency %r.N) Exception__init__ identifier)selfrs //usr/lib/python3/dist-packages/babel/numbers.pyr zUnknownCurrencyError.__init__*s# 4!7*!DE%N)__name__ __module__ __qualname____doc__r rrr r &s %rr c|r8tj|jj}t |St d}t |S)aM Return a `set` of normalized currency codes. .. versionadded:: 2.5.0 :param locale: filters returned currency codes by the provided locale. Expected to be a locale instance or code. If no locale is provided, returns the list of all currencies from all locales. all_currencies)rparse currencieskeysrset)localers rlist_currenciesr4sG\\&)4499;  z? 01 z?rc4|t|vr t|y)a Check the currency code is recognized by Babel. Accepts a ``locale`` parameter for fined-grained validation, working as the one defined above in ``list_currencies()`` method. Raises a `UnknownCurrencyError` exception if the currency is unknown to Babel. N)rr currencyrs rvalidate_currencyr"Fs!v.."8,,/rcb|rt|tsy t||y#t$rYywxYw)zy Returns `True` only if a currency is recognized by Babel. This method always return a Boolean and never raise. FT) isinstancestrr"r r s r is_currencyr&Rs; :h4(F+  s " ..c`t|tr|j}t||sy|S)zReturns the normalized sting of any currency code. Accepts a ``locale`` parameter for fined-grained validation, working as the one defined above in ``list_currencies()`` method. Returns None if the currency is unknown to Babel. N)r$r%upperr&r s rnormalize_currencyr)`s,(C >># x ( Orctj|}|;|j|}|jd}||vr||}||vr||Sd|vr|dS|jj ||S)aReturn the name used by the locale for the specified currency. >>> get_currency_name('USD', locale='en_US') u'US Dollar' .. versionadded:: 0.9.4 :param currency: the currency code. :param count: the optional count. If provided the currency name will be pluralized to that number if possible. :param locale: the `Locale` object or locale identifier. currency_names_pluralother)rr plural_form_datarget)r!countrlocr- plural_namescurrency_plural_namess rget_currency_namer4os ,,v C ooe, yy!89 | #$0$: !33,[99//,W55 >>  h 11rc`tj|jj||S)zReturn the symbol used by the locale for the specified currency. >>> get_currency_symbol('USD', locale='en_US') u'$' :param currency: the currency code. :param locale: the `Locale` object or locale identifier. )rrcurrency_symbolsr/r s rget_currency_symbolr7s& <<  0 0 4 4Xx HHrcHtd}|j||ddS)zReturn currency's precision. Precision is the number of decimals found after the decimal point in the currency's format pattern. .. versionadded:: 2.5.0 :param currency: the currency code. currency_fractionsDEFAULTr)rr/)r! precisionss rget_currency_precisionr<s*01J >>(Jy$9 :1 ==rctj|}|$|j|} |jd|S|jddS#t$rYwxYw)aV Return the unit pattern used for long display of a currency value for a given locale. This is a string containing ``{0}`` where the numeric part should be substituted and ``{1}`` where the currency long display name should be substituted. >>> get_currency_unit_pattern('USD', locale='en_US', count=10) u'{0} {1}' .. versionadded:: 2.7.0 :param currency: the currency code. :param count: the optional count. If provided the unit pattern for that number will be returned. :param locale: the `Locale` object or locale identifier. currency_unit_patternsr,)rrr-r. LookupError)r!r0rr1r-s rget_currency_unit_patternr@sk$ ,,v C ooe,  9956{C C 99- .w 77    sA AATFctd}tjn ttrj n ttrj |j |jd}fd}g} |D]Y\} } } } | rt| } | rt| } | r|s| r#|s&|| | s0|r| j| | | | dI| j| [| S)asReturns the list of currencies for the given territory that are valid for the given date range. In addition to that the currency database distinguishes between tender and non-tender currencies. By default only tender currencies are returned. The return value is a list of all currencies roughly ordered by the time of when the currency became active. The longer the currency is being in use the more to the left of the list it will be. The start date defaults to today. If no end date is given it will be the same as the start date. Otherwise a range can be defined. For instance this can be used to find the currencies in use in Austria between 1995 and 2011: >>> from datetime import date >>> get_territory_currencies('AT', date(1995, 1, 1), date(2011, 1, 1)) ['ATS', 'EUR'] Likewise it's also possible to find all the currencies in use on a single date: >>> get_territory_currencies('AT', date(1995, 1, 1)) ['ATS'] >>> get_territory_currencies('AT', date(2011, 1, 1)) ['EUR'] By default the return value only includes tender currencies. This however can be changed: >>> get_territory_currencies('US') ['USD'] >>> get_territory_currencies('US', tender=False, non_tender=True, ... start_date=date(2014, 1, 1)) ['USN', 'USS'] .. versionadded:: 2.0 :param territory: the name of the territory to find the currency for. :param start_date: the start date. If not given today is assumed. :param end_date: the end date. If not given the start date is assumed. :param tender: controls whether tender currencies should be included. :param non_tender: controls whether non-tender currencies should be included. :param include_details: if set to `True`, instead of returning currency codes the return value will be dictionaries with detail information. In that case each dictionary will have the keys ``'currency'``, ``'from'``, ``'to'``, and ``'tender'``. territory_currenciesrc4|duxs|kxr |duxs|k\SNr)startendend_date start_dates r _is_activez,get_territory_currencies.._is_actives/ 2(!22t 0sj0 2r)r!fromtotender) rdate_todayr$ datetime_rr/r(append) territoryrHrGrL non_tenderinclude_detailsrcursrIresult currency_coderErF is_tenders `` rget_territory_currenciesrXsh23J[[] J *__&  Hi (==? >>)//+R 0D2F04-, uc9 5ME +C 6:Juc4J -!'  m,-" Mrc`tj|jjddS)zReturn the symbol used by the locale to separate decimal fractions. >>> get_decimal_symbol('en_US') u'.' :param locale: the `Locale` object or locale identifier decimal.rrnumber_symbolsr/rs rget_decimal_symbolr_s& <<  . . 2 29d CCrc`tj|jjddS)zReturn the plus sign symbol used by the current locale. >>> get_plus_sign_symbol('en_US') u'+' :param locale: the `Locale` object or locale identifier plusSign+r\r^s rget_plus_sign_symbolrc&s& <<  . . 2 2:t DDrc`tj|jjddS)zReturn the plus sign symbol used by the current locale. >>> get_minus_sign_symbol('en_US') u'-' :param locale: the `Locale` object or locale identifier minusSign-r\r^s rget_minus_sign_symbolrg1s& <<  . . 2 2; EErc`tj|jjddS)zReturn the symbol used by the locale to separate mantissa and exponent. >>> get_exponential_symbol('en_US') u'E' :param locale: the `Locale` object or locale identifier exponentialEr\r^s rget_exponential_symbolrk<s& <<  . . 2 2=$ GGrc`tj|jjddS)zReturn the symbol used by the locale to separate groups of thousands. >>> get_group_symbol('en_US') u',' :param locale: the `Locale` object or locale identifier group,r\r^s rget_group_symbolroGs& <<  . . 2 27D AArcPtjdtt||S)afReturn the given number formatted for a specific locale. >>> format_number(1099, locale='en_US') u'1,099' >>> format_number(1099, locale='de_DE') u'1.099' .. deprecated:: 2.6.0 Use babel.numbers.format_decimal() instead. :param number: the number to format :param locale: the `Locale` object or locale identifier z+Use babel.numbers.format_decimal() instead.r^)warningswarnDeprecationWarningformat_decimal)numberrs r format_numberrvRs!" MM?AST & 00rct|tjsJ|jj }|j dk\ryt |j S)zReturn maximum precision of a decimal instance's fractional part. Precision is extracted from the fractional part only. r)r$rZDecimal normalizeas_tupleexponentabs)ru decimal_tuples rget_decimal_precisionr~gsQ fgoo .. .$$&//1M" }%% &&rct|tttjfsJtjd| zS)z> > ??2 I: ..rctj|}|s|jj|}t |}|j ||||S)aReturn the given decimal number formatted for a specific locale. >>> format_decimal(1.2345, locale='en_US') u'1.234' >>> format_decimal(1.2346, locale='en_US') u'1.235' >>> format_decimal(-1.2346, locale='en_US') u'-1.235' >>> format_decimal(1.2345, locale='sv_SE') u'1,234' >>> format_decimal(1.2345, locale='de') u'1,234' The appropriate thousands grouping and the decimal separator are used for each locale: >>> format_decimal(12345.5, locale='en_US') u'12,345.5' By default the locale is allowed to truncate and round a high-precision number by forcing its format pattern onto the decimal part. You can bypass this behavior with the `decimal_quantization` parameter: >>> format_decimal(1.2346, locale='en_US') u'1.235' >>> format_decimal(1.2346, locale='en_US', decimal_quantization=False) u'1.2346' >>> format_decimal(12345.67, locale='fr_CA', group_separator=False) u'12345,67' >>> format_decimal(12345.67, locale='en_US', group_separator=True) u'12,345.67' :param number: the number to format :param format: :param locale: the `Locale` object or locale identifier :param decimal_quantization: Truncate and round high-precision numbers to the format pattern. Defaults to `True`. :param group_separator: Boolean to switch group separator on/off in a locale's number format. decimal_quantizationgroup_separator)rrdecimal_formatsr/ parse_patternapplyruformatrrrpatterns rrtrtzsYT\\& !F ''++F3F#G ==-ASb  ddrceZdZdZy)UnknownCurrencyFormatErrorz>Exception raised when an unknown currency format is requested.N)rrrrrrrrrsHrrstandardc |dk(rt|||||||Stj|}|r t|}n |j|}|j||||||S#t $rt d|zwxYw)u Return formatted currency value. >>> format_currency(1099.98, 'USD', locale='en_US') u'$1,099.98' >>> format_currency(1099.98, 'USD', locale='es_CO') u'US$\xa01.099,98' >>> format_currency(1099.98, 'EUR', locale='de_DE') u'1.099,98\xa0\u20ac' The format can also be specified explicitly. The currency is placed with the '¤' sign. As the sign gets repeated the format expands (¤ being the symbol, ¤¤ is the currency abbreviation and ¤¤¤ is the full name of the currency): >>> format_currency(1099.98, 'EUR', u'¤¤ #,##0.00', locale='en_US') u'EUR 1,099.98' >>> format_currency(1099.98, 'EUR', u'#,##0.00 ¤¤¤', locale='en_US') u'1,099.98 euros' Currencies usually have a specific number of decimal digits. This function favours that information over the given format: >>> format_currency(1099.98, 'JPY', locale='en_US') u'\xa51,100' >>> format_currency(1099.98, 'COP', u'#,##0.00', locale='es_ES') u'1.099,98' However, the number of decimal digits can be overriden from the currency information, by setting the last parameter to ``False``: >>> format_currency(1099.98, 'JPY', locale='en_US', currency_digits=False) u'\xa51,099.98' >>> format_currency(1099.98, 'COP', u'#,##0.00', locale='es_ES', currency_digits=False) u'1.099,98' If a format is not specified the type of currency format to use from the locale can be specified: >>> format_currency(1099.98, 'EUR', locale='en_US', format_type='standard') u'\u20ac1,099.98' When the given currency format type is not available, an exception is raised: >>> format_currency('1099.98', 'EUR', locale='root', format_type='unknown') Traceback (most recent call last): ... UnknownCurrencyFormatError: "'unknown' is not a known currency format type" >>> format_currency(101299.98, 'USD', locale='en_US', group_separator=False) u'$101299.98' >>> format_currency(101299.98, 'USD', locale='en_US', group_separator=True) u'$101,299.98' You can also pass format_type='name' to use long display names. The order of the number and currency name, along with the correct localized plural form of the currency name, is chosen according to locale: >>> format_currency(1, 'USD', locale='en_US', format_type='name') u'1.00 US dollar' >>> format_currency(1099.98, 'USD', locale='en_US', format_type='name') u'1,099.98 US dollars' >>> format_currency(1099.98, 'USD', locale='ee', format_type='name') u'us ga dollar 1,099.98' By default the locale is allowed to truncate and round a high-precision number by forcing its format pattern onto the decimal part. You can bypass this behavior with the `decimal_quantization` parameter: >>> format_currency(1099.9876, 'USD', locale='en_US') u'$1,099.99' >>> format_currency(1099.9876, 'USD', locale='en_US', decimal_quantization=False) u'$1,099.9876' :param number: the number to format :param currency: the currency code :param format: the format string to use :param locale: the `Locale` object or locale identifier :param currency_digits: use the currency's natural number of decimal digits :param format_type: the currency format type to use :param decimal_quantization: Truncate and round high-precision numbers to the format pattern. Defaults to `True`. :param group_separator: Boolean to switch group separator on/off in a locale's number format. name)rrcurrency_digitsrrz&%r is not a known currency format typer!rrr)_format_currency_long_namerrrcurrency_formatsKeyErrorrr) rur!rrr format_typerrrs rformat_currencyrstf)&(617?Setv v\\& !F ' H--k:G ==?1?  TT  H,8;FH H Hs A""A:cBtj|}t|tr t |}n|}t |||} t |||} |s|jj|}t|} | j||||||} | j| | S)N)r0rr) rrr$r%floatr@r4rr/rrr) rur!rrrrrrnumber_n unit_pattern display_namer number_parts rrrs \\& !F&#=-XXfUL%XXfML ''++F3F#G--?1? TK   {L 99rctj|}|s|jj|}t |}|j ||||S)uDReturn formatted percent value for a specific locale. >>> format_percent(0.34, locale='en_US') u'34%' >>> format_percent(25.1234, locale='en_US') u'2,512%' >>> format_percent(25.1234, locale='sv_SE') u'2\xa0512\xa0%' The format pattern can also be specified explicitly: >>> format_percent(25.1234, u'#,##0‰', locale='en_US') u'25,123‰' By default the locale is allowed to truncate and round a high-precision number by forcing its format pattern onto the decimal part. You can bypass this behavior with the `decimal_quantization` parameter: >>> format_percent(23.9876, locale='en_US') u'2,399%' >>> format_percent(23.9876, locale='en_US', decimal_quantization=False) u'2,398.76%' >>> format_percent(229291.1234, locale='pt_BR', group_separator=False) u'22929112%' >>> format_percent(229291.1234, locale='pt_BR', group_separator=True) u'22.929.112%' :param number: the percent number to format :param format: :param locale: the `Locale` object or locale identifier :param decimal_quantization: Truncate and round high-precision numbers to the format pattern. Defaults to `True`. :param group_separator: Boolean to switch group separator on/off in a locale's number format. r)rrpercent_formatsr/rrrs rformat_percentrAsYN\\& !F ''++F3F#G ==-ASb  ddrctj|}|s|jj|}t |}|j |||S)aReturn value formatted in scientific notation for a specific locale. >>> format_scientific(10000, locale='en_US') u'1E4' The format pattern can also be specified explicitly: >>> format_scientific(1234567, u'##0.##E00', locale='en_US') u'1.23E06' By default the locale is allowed to truncate and round a high-precision number by forcing its format pattern onto the decimal part. You can bypass this behavior with the `decimal_quantization` parameter: >>> format_scientific(1234.9876, u'#.##E0', locale='en_US') u'1.23E3' >>> format_scientific(1234.9876, u'#.##E0', locale='en_US', decimal_quantization=False) u'1.2349876E3' :param number: the number to format :param format: :param locale: the `Locale` object or locale identifier :param decimal_quantization: Truncate and round high-precision numbers to the format pattern. Defaults to `True`. )r)rrscientific_formatsr/rr)rurrrrs rformat_scientificrpsU6\\& !F **..v6F#G ==-A  CCrc$eZdZdZdfd ZxZS)NumberFormatErrorz>Exception raised when a string cannot be parsed into a number.c2t||||_yrD)superr suggestions)rmessager __class__s rr zNumberFormatError.__init__s !&rrD)rrrrr __classcell__)rs@rrrsH''rrc t|jt|dS#t$rt d|zwxYw)aSParse localized number string into an integer. >>> parse_number('1,099', locale='en_US') 1099 >>> parse_number('1.099', locale='de_DE') 1099 When the given string cannot be parsed, an exception is raised: >>> parse_number('1.099,98', locale='de') Traceback (most recent call last): ... NumberFormatError: '1.099,98' is not a valid number :param string: the string to parse :param locale: the `Locale` object or locale identifier :return: the parsed number :raise `NumberFormatError`: if the string can not be converted to a number z%r is not a valid number)rreplacero ValueErrorr)stringrs r parse_numberrsF(E6>>"26":B?@@ E :V CDDEs#&>ctj|}t|}t|}|s|dk(r||vrd|vr|j d|} t j |j |dj |d}|r||vrt||d}||k7r|jd||zk7ru t j |j |dj |d}t||d}||k(rt|d |d |g t|d |d |d ||g |S#t j$rtd|zwxYw#t j$rt|d |d |g wxYw) akParse localized decimal string into a decimal. >>> parse_decimal('1,099.98', locale='en_US') Decimal('1099.98') >>> parse_decimal('1.099,98', locale='de') Decimal('1099.98') >>> parse_decimal('12 345,123', locale='ru') Decimal('12345.123') When the given string cannot be parsed, an exception is raised: >>> parse_decimal('2,109,998', locale='de') Traceback (most recent call last): ... NumberFormatError: '2,109,998' is not a valid decimal number If `strict` is set to `True` and the given string contains a number formatted in an irregular way, an exception is raised: >>> parse_decimal('30.00', locale='de', strict=True) Traceback (most recent call last): ... NumberFormatError: '30.00' is not a properly formatted decimal number. Did you mean '3.000'? Or maybe '30,00'? >>> parse_decimal('0.00', locale='de', strict=True) Traceback (most recent call last): ... NumberFormatError: '0.00' is not a properly formatted decimal number. Did you mean '0'? :param string: the string to parse :param locale: the `Locale` object or locale identifier :param strict: controls whether numbers formatted in a weird way are accepted or rejected :raise NumberFormatError: if the string can not be converted to a decimal number   rr[z %r is not a valid decimal numberF)rr0z: is not a properly formatted decimal number. Did you mean ?)rz ? Or maybe ) rrror_rrZrxInvalidOperationrrtrstrip) rrstrict group_symboldecimal_symbolparsedproper parsed_alt proper_alts r parse_decimalrsJ\\& !F#F+L'/N F" v \2M b!A(/(DF,&(vER V  c 2v7N O 9$__V^^NB-O4;GL#4NP ,Jv\ab '+#V-$*8-- ,5$*J#799 M3  # #M BV KLLM++ )'V% &x)) )s5D*45E*"E (E7z [^0-9@#.,]z [0-9@#.,E+]z(?P(?:'[^']*'|%s)*)z(?P%s*)z(?P.*)ct|}|jd}|dk(ry||z dz }|d| dz jd}|dk(r||fS||z |z dz }||fS)zParse primary and secondary digit grouping >>> parse_grouping('##') (1000, 1000) >>> parse_grouping('#,###') (3, 3) >>> parse_grouping('#,####,###') (3, 4) rn)rN)lenrfind)pwidthg1g2s rparse_groupingrsx FE B Rx aB 8RC!G  3 B Rx2v b1 B r6Mrc &t|tr|Sd}|}d|vr.|jdd\}}||\}}}||\}}} n||\}}}d|z}|} d|vr|jdd\}} nd} d|vrd|vrd |vr td d|vr|j dd\} } n|} d } d } | | }| | }| r+| j d }| j d } | | }nd}d}t| }t|||f|| f|||||S)zParse number format patternscltj|}|td|z|jS)NzInvalid number pattern %r) number_researchrgroups)rrvs r _match_numberz$parse_pattern.._match_number,s4   g & :87BC Cyy{r;rrfrjN@r[rz5Significant digit patterns can not contain "@" or "0"rchdx}}|D]&}|dvr |dz }|dz }|dk(r|dz }|dk(r#||fS||fS)z(Calculate the min and max allowed digitsrz@0r#rnr)rminmaxcs rparse_precisionz&parse_pattern..parse_precisionKsd c ADyqqcqcCx Cxrrb)r$ NumberPatternsplitrrsplit startswithlstripr)rr pos_pattern neg_pattern pos_prefixru pos_suffix neg_prefix_ neg_suffixexpintegerfractionrint_prec frac_precexp_plusexp_precgroupings rrr'sj'=) K g~#*==a#8 [)6{)C& FJ$1+$>! Az)6{)C& FJ:%   f}ll3*  f} &=SF]*+ + f}"MM#q1 w'H)I >>#&jjo"3'g&H :z":$j18!9!8 --rcPeZdZdZdZdZdZ d dZdZdZ d Z d d Z y) rc ||_||_||_||_||_||_||_||_|j|_ yrD) rprefixsuffixrrrrr compute_scalescale) rrrrrrrrrs rr zNumberPattern.__init__lsL       "    '') rcNdt|jd|jdS)N)typerr)rs r__repr__zNumberPattern.__repr__ys J//>>rcd}ddj|j|jzvrd}|Sddj|j|jzvrd}|S)uReturn the scaling factor to apply to the number before rendering. Auto-set to a factor of 2 or 3 if presence of a ``%`` or ``‰`` sign is detected in the prefix or suffix of the pattern. Default is to not mess with the scale at all and keep it to 0. r%rru‰)joinrr)rrs rrzNumberPattern.compute_scale|s] "''$++ 34 4E rwwt{{T[[89 9E rcJ|j}|t|z}|jdk(sJtdt|jgdz }||z }|t| z}d}|dkr t |}n|j r t|}t|}|||fS)zG Returns normalized scientific notation components of a value. rrr) adjustedrrrrrgrrcr|)rvaluerr lead_shiftexp_signs rscientific_notation_elementsz*NumberPattern.scientific_notation_elementssnn+C00~~1$$$ !S/01A5 J+ZK88 7,V4H ]]+F3H#hc8##rNc Ft|tjstjt|}|j |j }t |j}t|j}|jr|j||\}} } |rtjdt|} n |r|rt|fdz} n |j } |r|jr#| dk(r| dt#| dt%|gf} |jrfdj'|j)||| |t+| |j-t |jd|jd|g} nd|j.vrj|j1||j2d|j2d} | j5d\}}}|j-|dd |} |r&| t7||zz } n|j)||| |} dj'|j8|| |j:|g}d |vrY|j=d t?|||}|j=d |jA}|j=d tC||}|S) aRenders into a string a number following the defined pattern. Forced decimal quantization is active by default so we'll produce a number string that is strictly following CLDR pattern definitions. :param value: The value to format. If this is not a Decimal object, it will be cast to one. :type value: decimal.Decimal|float|int :param locale: The locale to use for formatting. :type locale: str|babel.core.Locale :param currency: Which currency, if any, to format as. :type currency: str|None :param currency_digits: Whether or not to use the currency's precision. If false, the pattern's precision is used. :type currency_digits: bool :param decimal_quantization: Whether decimal numbers should be forcibly quantized to produce a formatted output strictly matching the CLDR definition for the locale. :type decimal_quantization: bool :param force_frac: DEPRECATED - a forced override for `self.frac_prec` for a single formatting invocation. :return: Formatted decimal string. :rtype: str z@The force_frac parameter to NumberPattern.apply() is deprecated.r)rrrrrrr[r¤u¤¤¤u¤¤)"r$rZrxr%scalebrr is_signedr|ryrrrqrrrsr<rrr~r_quantize_valuerk _format_intr_format_significantr partitionr_rrrr4r(r7)rrrr!rr force_fracr is_negativerrrrutextasepbretvals rrzNumberPattern.applystF%1OOCJ/E TZZ(%//+, E $$& ==#'#D#DUF#S E3  MM\^p q"I //9Ds+IAsA%%aD&9F,V4q88))%OTF KK $  KK $&' F?^^I$5hv$NPF^^GX^^-=>F^^E+>x+PQF rc |j}|dz |z }t|j|jt j d}|dkr |d| zz}|S|d| }t |} | t|| z dz} dj|xsddt|dzd || | || djdjd}|S)Nrrrz-{intpart}.{pad:0<{fill}}{fracpart}{fracextra}r)intpartpadfillfracpart fracextrar[) rr%r quantizerZrxrrrrr) rrminimummaximumrrdigitsrUrijs rrz!NumberPattern._format_significant!snn! c!U\\%(11'//!2DEF A:cUFl*F WufoGG AC! Q''ADKK3#'1o%! *++C0 L fSk  rct|}||kr d||z z|z}|jd}d}t|}t||kDr0||| dz|z}|d| }|jd}t||kDr0||zS)Nrrrr)rrro) rrrrrrgsizeretsymbols rr zNumberPattern._format_int4sE  3;3;'%/E a !&)%j5 5%>)C/C'E6NEMM!$E%j5 s{rc$t|d}|j|}dj|jd\}}} |} |r.|j ||j d|j d|} | |j | xsd||z} | S)Nrz{:f}r[rr)rrrrr r _format_frac) rrrrrquantumroundedrrr integer_partrus rr zNumberPattern._quantize_valueAs%il3..)MM'*44S9 3 ++At}}Q/?qAQSYZL 1 1!(sFI NN rc|xs |j\}}t||kr|d|t|z zz }|dk(s|dk(rt|dk(ryt||kDr$|ddk(r|dd}t||kDr |ddk(rt||zS)Nrrrr)rrrr_)rrrrrrs rr(zNumberPattern._format_fracKs/S u:  cS3u:-. /E !8qSZ1_%j359#3#2JE%j359#3!&)E11r)NTTNTrD) rrrr rrrrrr r r(rrrrrjsB *? $>!fx& 2rrrD)NNTFF)8rrZrerrrMrOrq babel.corerrrr NameErrorrrr r rr"r&r)r4r7r<r@rXr_rcrgrkrorvr~rrtrrrrrrrrrr PREFIX_END NUMBER_TOKENPREFIX_PATTERNNUMBER_PATTERNSUFFIX_PATTERNcompilerrrrrrrr6s& 999 L )  %9 %$ -  '+:24*4 I >/3:8<CG5:-2Wt)D!+E",F#-H'B",1* '/JT[_/ddII "&j$T4jT\"&j$T4!:JJT[_,d`JT CF' '!+E4",EM`  /*<#l2" BJJNN$24 5 ,@-Fi2i2Y DsD DD