ó
    ¡“,jí÷  ã                  óÖ  • S r SSKJr  SSKrSSKrSSKrSSKrSSKJrJ	r	J
r
Jr  SSKJrJrJr  SSKJr  \" S5      r\" S5      r " S	 S
\5      rS=S>S jjrS=S?S jjrS=S@S jjrS=SAS jjr  SB       SCS jjrS=SDS jjrSES jr  SB       SCS jjr\     SF             SGS jj5       r\     SF             SHS jj5       r     SI             SJS jjr SK     SLS jjrSS.     SMS jjr  " S S\5      r! S=SS.     SNS jjjr" S=SS.     SNS jjjr# S=SS.     SNS jjjr$ S=SS.     SNS jjjr% S=SS.     SNS  jjjr& S=SS.     SNS! jjjr' S=     SOS" jjr(SPS# jr)SQS$ jr*    SRSS.             SSS% jjjr+S&SSSS'.           STS( jjr,          SUS) jr- " S* S+\.5      r/      SVSS.                   SWS, jjjr0                  SXS- jr1S&SSSS'.             SYS. jjr2    SRSS.             SSS/ jjjr3   SZSS.           S[S0 jjjr4 " S1 S2\55      r61 S3kr7\Rp                  " S4Rs                  \75      5      r: S=SS.       S\S5 jjjr;  S]SS.         S^S6 jjjr<S_S7 jr=\Rp                  " S85      r>S`S9 jr?SaS; jr@ " S< S:5      rAg)ba–  
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_MONETARY`` for currency related functions,
 * ``LC_NUMERIC``, and
 * ``LC_ALL``, and
 * ``LANG``

:copyright: (c) 2013-2026 by the Babel Team.
:license: BSD, see LICENSE for more details.
é    )ÚannotationsN)ÚAnyÚLiteralÚcastÚoverload)ÚLocaleÚdefault_localeÚ
get_global)ÚLocaleDataDict)ÚLC_MONETARYÚ
LC_NUMERICr   c                  ó"   • \ rS rSrSrSS jrSrg)ÚUnknownCurrencyErroré%   zMException thrown when a currency is requested for which no data is available.c                óF   • [         R                  U SU< S35        Xl        g)z[Create the exception.
:param identifier: the identifier string of the unsupported currency
zUnknown currency Ú.N)Ú	ExceptionÚ__init__Ú
identifier)Úselfr   s     Ú›C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\babel/numbers.pyr   ÚUnknownCurrencyError.__init__(   s%   € ô 	×Ñ˜4Ð#4°Z±NÀ!Ð!DÔEð %�ó    )r   N)r   ÚstrÚreturnÚNone)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__static_attributes__© r   r   r   r   %   s
   † ÙW÷%r   r   c                óŠ   • U (       a)  [        [        R                  " U 5      R                  5      $ [        [	        S5      5      $ )a4  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)Úsetr   ÚparseÚ
currenciesr
   ©Úlocales    r   Úlist_currenciesr+   2   s2   € ö Ü”6—<’< Ó'×2Ñ2Ó3Ð3ÜŒzÐ*Ó+Ó,Ð,r   c                ó8   • U [        U5      ;  a  [        U 5      eg)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)r+   r   ©Úcurrencyr*   s     r   Úvalidate_currencyr/   B   s!   € ð ” vÓ.Ó.Ü" 8Ó,Ð,ð /r   c                óv   • U (       a  [        U [        5      (       d  g [        X5        g! [         a     gf = f)zpReturns `True` only if a currency is recognized by Babel.

This method always return a Boolean and never raise.
FT)Ú
isinstancer   r/   r   r-   s     r   Úis_currencyr2   N   s<   € ö
 œ: h´×4Ñ4ØðÜ˜(Ô+ð øô  ó Ùðús   Ÿ+ «
8·8c                ór   • [        U [        5      (       a  U R                  5       n [        X5      (       d  gU $ )zëReturns the normalized identifier 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)r1   r   Úupperr2   r-   s     r   Únormalize_currencyr5   \   s0   € ô �(œC× Ñ Ø—>‘>Ó#ˆÜ�x×(Ñ(ØØ€Or   c                ó0  • [         R                  " U=(       d    [        5      nUb>   UR                  U5      nUR                  S   nX;   a  XP   nXF;   a  Xd   $ SU;   a  US   $ UR                  R                  X 5      $ ! [        [
        4 a    Sn N[f = f)a·  Return the name used by the locale for the specified currency.

>>> get_currency_name('USD', locale='en_US')
'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.
               Defaults to the system currency locale or numeric locale.
ÚotherÚcurrency_names_plural)	r   r'   r   Úplural_formÚOverflowErrorÚ
ValueErrorÚ_datar(   Úget)r.   Úcountr*   Úlocr9   Úplural_namesÚcurrency_plural_namess          r   Úget_currency_namerB   k   s£   € ô$ �,Š,�v×,¤Ó
-€CØÑð	"ØŸ/™/¨%Ó0ˆKð —y‘yÐ!8Ñ9ˆØÓ#Ø$0Ñ$:Ð!ØÓ3Ø,Ñ9Ð9ØÐ/Ó/Ø,¨WÑ5Ð5Ø�>‰>×Ñ˜hÓ1Ð1øô œzÐ*ó 	"Ø!ŠKð	"ús   ¨B  Â BÂBc                óz   • [         R                  " U=(       d    [        5      R                  R	                  X 5      $ )a  Return the symbol used by the locale for the specified currency.

>>> get_currency_symbol('USD', locale='en_US')
'$'

:param currency: the currency code.
:param locale: the `Locale` object or locale identifier.
               Defaults to the system currency locale or numeric locale.
)r   r'   r   Úcurrency_symbolsr=   r-   s     r   Úget_currency_symbolrE   �   s)   € ô �<Š<˜×-¤+Ó.×?Ñ?×CÑCÀHÓWÐWr   c                óF   • [        S5      nUR                  XS   5      S   $ )zÀReturn 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_fractionsÚDEFAULTr   )r
   r=   )r.   Ú
precisionss     r   Úget_currency_precisionrJ   š   s(   € ô Ð0Ó1€JØ�>‰>˜(¨yÑ$9Ó:¸1Ñ=Ð=r   c                óÚ   • [         R                  " U=(       d    [        5      nUb$  UR                  U5      n UR                  S   U   $ UR                  S   S   $ ! [
         a     Nf = f)aj  
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)
'{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.
               Defaults to the system currency locale or numeric locale.
Úcurrency_unit_patternsr7   )r   r'   r   r9   r<   ÚLookupError)r.   r>   r*   r?   r9   s        r   Úget_currency_unit_patternrN   ¨   sp   € ô. �,Š,�v×,¤Ó
-€CØÑØ—o‘o eÓ,ˆð	Ø—9‘9Ð5Ñ6°{ÑCÐCð
 �9‰9Ð-Ñ.¨wÑ7Ð7øô	 ó 	áð	ús   ¹A Á
A*Á)A*c                ó   • g ©Nr#   ©Ú	territoryÚ
start_dateÚend_dateÚtenderÚ
non_tenderÚinclude_detailss         r   Úget_territory_currenciesrX   Ë   s   € ð r   c                ó   • g rP   r#   rQ   s         r   rX   rX   Ö   s   € ð r   c                ó¾  ^^• [        S5      nTc  [        R                  R                  5       mO/[	        T[        R                  5      (       a  TR                  5       mTc  TmO/[	        T[        R                  5      (       a  TR                  5       mUR                  U R                  5       S5      nUU4S jn/ n	U Hš  u  p«pÍU(       a  [        R                  " U6 nU(       a  [        R                  " U6 nU(       a  U(       d  U(       a  MQ  U(       d  MZ  U" UU5      (       d  Mj  U(       a  U	R                  U
UUUS.5        M‰  U	R                  U
5        Mœ     U	$ )a×  Returns 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_currenciesr#   c                óR   >• U S L =(       d    U T:*  =(       a    US L =(       d    UT:¬  $ rP   r#   )ÚstartÚendrT   rS   s     €€r   Ú
_is_activeÚ,get_territory_currencies.<locals>._is_active'  s*   ø€ Ø˜�×2 ¨(Ñ!2×Z¸À¸×9YÈÈzÑHYÐZr   )r.   ÚfromÚtorU   )r
   ÚdatetimeÚdateÚtodayr1   r=   r4   Úappend)rR   rS   rT   rU   rV   rW   r(   Úcursr_   ÚresultÚcurrency_coder]   r^   Ú	is_tenders    ``           r   rX   rX   á   s  ù€ ôr Ð2Ó3€JØÑÜ—]‘]×(Ñ(Ó*‰
Ü	�J¤× 1Ñ 1×	2Ñ	2Ø—_‘_Ó&ˆ
ØÑØ‰Ü	�Hœh×/Ñ/×	0Ñ	0Ø—=‘=“?ˆà�>‰>˜)Ÿ/™/Ó+¨RÓ0€Dö[ð €FÛ04Ñ,ˆ˜cÞÜ—M’M 5Ð)ˆEÞÜ—-’- Ð%ˆCÞž6¯9¨9¿¸É*ØØ÷K
ó K
ö Ø—‘à$1Ø %Ø!Ø"+ñ	öð —‘˜mÖ,ñ' 15ð* €Mr   Úlatnc                ó*   • US:X  a  U R                   $ U$ )NÚdefault)Údefault_numbering_system©r*   Únumbering_systems     r   Ú_get_numbering_systemrq   C  s   € ð ˜9Ó$Ø×.Ñ.Ð.àÐr   ©rp   c               ó‚   • [        X5      n U R                  U   $ ! [         a  n[        SU SU  S35      UeS nAff = f)NzUnknown numbering system z for Locale r   )rq   Únumber_symbolsÚKeyErrorÚUnsupportedNumberingSystemError)r*   rp   Úerrors      r   Ú_get_number_symbolsrx   M  sZ   € ô
 -¨VÓFÐðØ×$Ñ$Ð%5Ñ6Ð6øÜó Ü-Ø'Ð(8Ð'9¸ÀfÀXÈQÐOó
àð	ûðús   � œ
>¦9¹>c                  ó   • \ rS rSrSrSrg)rv   i[  zXException thrown when an unsupported numbering system is requested for the given Locale.r#   N©r   r   r   r    r!   r"   r#   r   r   rv   rv   [  s   † Ùbâr   rv   c               óz   • [         R                  " U =(       d    [        5      n [        XS9R	                  SS5      $ )ut  Return the symbol used by the locale to separate decimal fractions.

>>> get_decimal_symbol('en_US')
'.'
>>> get_decimal_symbol('ar_EG', numbering_system='default')
'Ù«'
>>> get_decimal_symbol('ar_EG', numbering_system='latn')
'.'

:param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
:param numbering_system: The numbering system used for fetching the symbol. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: If the numbering system is not supported by the locale.
rr   Údecimalr   ©r   r'   r   rx   r=   ro   s     r   Úget_decimal_symbolr~   a  s0   € ô& �\Š\˜&×.¤JÓ/€FÜ˜vÑI×MÑMÈiÐY\Ó]Ð]r   c               óz   • [         R                  " U =(       d    [        5      n [        XS9R	                  SS5      $ )ay  Return the plus sign symbol used by the current locale.

>>> get_plus_sign_symbol('en_US')
'+'
>>> get_plus_sign_symbol('ar_EG', numbering_system='default')
'\u061c+'
>>> get_plus_sign_symbol('ar_EG', numbering_system='latn')
'\u200e+'

:param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
:param numbering_system: The numbering system used for fetching the symbol. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: if the numbering system is not supported by the locale.
rr   ÚplusSignÚ+r}   ro   s     r   Úget_plus_sign_symbolr‚   x  s0   € ô& �\Š\˜&×.¤JÓ/€FÜ˜vÑI×MÑMÈjÐZ]Ó^Ð^r   c               óz   • [         R                  " U =(       d    [        5      n [        XS9R	                  SS5      $ )a|  Return the plus sign symbol used by the current locale.

>>> get_minus_sign_symbol('en_US')
'-'
>>> get_minus_sign_symbol('ar_EG', numbering_system='default')
'\u061c-'
>>> get_minus_sign_symbol('ar_EG', numbering_system='latn')
'\u200e-'

:param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
:param numbering_system: The numbering system used for fetching the symbol. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: if the numbering system is not supported by the locale.
rr   Ú	minusSignÚ-r}   ro   s     r   Úget_minus_sign_symbolr†   �  s0   € ô& �\Š\˜&×.¤JÓ/€FÜ˜vÑI×MÑMÈkÐ[^Ó_Ð_r   c               óz   • [         R                  " U =(       d    [        5      n [        XS9R	                  SS5      $ )u†  Return the symbol used by the locale to separate mantissa and exponent.

>>> get_exponential_symbol('en_US')
'E'
>>> get_exponential_symbol('ar_EG', numbering_system='default')
'Ø£Ø³'
>>> get_exponential_symbol('ar_EG', numbering_system='latn')
'E'

:param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
:param numbering_system: The numbering system used for fetching the symbol. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: if the numbering system is not supported by the locale.
rr   ÚexponentialÚEr}   ro   s     r   Úget_exponential_symbolrŠ   ¦  s0   € ô& �\Š\˜&×.¤JÓ/€FÜ˜vÑI×MÑMÈmÐ]`ÓaÐar   c               óz   • [         R                  " U =(       d    [        5      n [        XS9R	                  SS5      $ )up  Return the symbol used by the locale to separate groups of thousands.

>>> get_group_symbol('en_US')
','
>>> get_group_symbol('ar_EG', numbering_system='default')
'Ù¬'
>>> get_group_symbol('ar_EG', numbering_system='latn')
','

:param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
:param numbering_system: The numbering system used for fetching the symbol. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: if the numbering system is not supported by the locale.
rr   ÚgroupÚ,r}   ro   s     r   Úget_group_symbolrŽ   ½  s0   € ô& �\Š\˜&×.¤JÓ/€FÜ˜vÑI×MÑMÈgÐWZÓ[Ð[r   c               óz   • [         R                  " U =(       d    [        5      n [        XS9R	                  SS5      $ )ut  Return the symbol used by the locale to represent infinity.

>>> get_infinity_symbol('en_US')
'âˆž'
>>> get_infinity_symbol('ar_EG', numbering_system='default')
'âˆž'
>>> get_infinity_symbol('ar_EG', numbering_system='latn')
'âˆž'

:param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
:param numbering_system: The numbering system used for fetching the symbol. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: if the numbering system is not supported by the locale.
rr   Úinfinityu   âˆžr}   ro   s     r   Úget_infinity_symbolr‘   Ô  s0   € ô& �\Š\˜&×.¤JÓ/€FÜ˜vÑI×MÑMÈjÐZ_Ó`Ð`r   c                óH   • [         R                  " S[        SS9  [        XS9$ )aŒ  Return the given number formatted for a specific locale.

>>> format_number(1099, locale='en_US')  # doctest: +SKIP
'1,099'
>>> format_number(1099, locale='de_DE')  # doctest: +SKIP
'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. Defaults to the system numeric locale.


z+Use babel.numbers.format_decimal() instead.é   ©Ú
stacklevelr)   )ÚwarningsÚwarnÚDeprecationWarningÚformat_decimal)Únumberr*   s     r   Úformat_numberr›   ë  s&   € ô( ‡M‚MØ5ÜØòô
 ˜&Ñ0Ð0r   c                ó
  • [        U [        R                  5      (       d   eU R                  5       R	                  5       n[        UR
                  [        5      (       a  UR
                  S:¼  a  g[        UR
                  5      $ )zyReturn maximum precision of a decimal instance's fractional part.

Precision is extracted from the fractional part only.
r   )r1   r|   ÚDecimalÚ	normalizeÚas_tupleÚexponentÚintÚabs)rš   Údecimal_tuples     r   Úget_decimal_precisionr¤     sg   € ô �fœgŸo™o×.Ñ.Ð.Ð.Ø×$Ñ$Ó&×/Ñ/Ó1€Mä�m×,Ñ,¬c×2Ñ2°m×6LÑ6LÐPQÓ6QØÜˆ}×%Ñ%Ó&Ð&r   c                ó„   • [        U [        [        R                  45      (       d   e[        R                  " S5      U * -  $ )z<Return minimal quantum of a number, as defined by precision.é
   )r1   r¡   r|   r�   )Ú	precisions    r   Úget_decimal_quantumr¨     s4   € ä�i¤#¤w§¡Ð!7×8Ñ8Ð8Ð8Ü�?Š?˜2Ó I :Ñ.Ð.r   c               ó¨   • [         R                  " U=(       d    [        5      nUc  UR                  U   n[	        U5      nUR                  U UUUUS9$ )u&  Return the given decimal number formatted for a specific locale.

>>> format_decimal(1.2345, locale='en_US')
'1.234'
>>> format_decimal(1.2346, locale='en_US')
'1.235'
>>> format_decimal(-1.2346, locale='en_US')
'-1.235'
>>> format_decimal(1.2345, locale='sv_SE')
'1,234'
>>> format_decimal(1.2345, locale='de')
'1,234'
>>> format_decimal(1.2345, locale='ar_EG', numbering_system='default')
'1Ù«234'
>>> format_decimal(1.2345, locale='ar_EG', numbering_system='latn')
'1.234'

The appropriate thousands grouping and the decimal separator are used for
each locale:

>>> format_decimal(12345.5, locale='en_US')
'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')
'1.235'
>>> format_decimal(1.2346, locale='en_US', decimal_quantization=False)
'1.2346'
>>> format_decimal(12345.67, locale='fr_CA', group_separator=False)
'12345,67'
>>> format_decimal(12345.67, locale='en_US', group_separator=True)
'12,345.67'

:param number: the number to format
:param format:
:param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
: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.
:param numbering_system: The numbering system used for formatting number symbols. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: If the numbering system is not supported by the locale.
©Údecimal_quantizationÚgroup_separatorrp   )r   r'   r   Údecimal_formatsÚparse_patternÚapply©rš   Úformatr*   r«   r¬   rp   Úpatterns          r   r™   r™     s\   € ôp �\Š\˜&×.¤JÓ/€FØ�~Ø×'Ñ'¨Ñ/ˆÜ˜FÓ#€GØ�=‰=ØØØ1Ø'Ø)ð ð ð r   Úshort)Úformat_typer*   Úfraction_digitsrp   c               óà   • [         R                  " U=(       d    [        5      nUR                  U   n[	        XX#5      u  pUc  UR
                  S   n[        U5      nUR                  U USUS9$ )u0  Return the given decimal number formatted for a specific locale in compact form.

>>> format_compact_decimal(12345, format_type="short", locale='en_US')
'12K'
>>> format_compact_decimal(12345, format_type="long", locale='en_US')
'12 thousand'
>>> format_compact_decimal(12345, format_type="short", locale='en_US', fraction_digits=2)
'12.34K'
>>> format_compact_decimal(1234567, format_type="short", locale="ja_JP")
'123ä¸‡'
>>> format_compact_decimal(2345678, format_type="long", locale="mk")
'2 Ð¼Ð¸Ð»Ð¸Ð¾Ð½Ð¸'
>>> format_compact_decimal(21000000, format_type="long", locale="mk")
'21 Ð¼Ð¸Ð»Ð¸Ð¾Ð½'
>>> format_compact_decimal(12345, format_type="short", locale='ar_EG', fraction_digits=2, numbering_system='default')
'12Ù«34\xa0Ø£Ù„Ù�'

:param number: the number to format
:param format_type: Compact format to use ("short" or "long")
:param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
:param fraction_digits: Number of digits after the decimal point to use. Defaults to `0`.
:param numbering_system: The numbering system used for formatting number symbols. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: If the numbering system is not supported by the locale.
NF©r«   rp   )r   r'   r   Úcompact_decimal_formatsÚ_get_compact_formatr­   r®   r¯   )rš   r´   r*   rµ   rp   Úcompact_formatr±   r²   s           r   Úformat_compact_decimalr»   `  sw   € ôB �\Š\˜&×.¤JÓ/€FØ×3Ñ3°KÑ@€NÜ(¨ÀÓY�N€Fà�~Ø×'Ñ'¨Ñ-ˆÜ˜FÓ#€GØ�=‰=ØØØ"Ø)ð	 ð ð r   c           
     óö  • [        U [        R                  5      (       d  [        R                  " [        U 5      5      n U R	                  5       (       d  U R                  5       (       a  U S4$ Sn[        US    Vs/ s H  n[        U5      PM     snSS9 HÙ  n[        U 5      U:¼  d  M  US   [        U5         n[        U5      R                  nUS:X  a    X4$ [        [        R                  XSUR                  S5      S-
  -  -  -  5      n [        X5      nUR                  [        U 5      5      n	X‘;  a  Sn	U S:X  a  SU;   a  Sn	[        U5      X   ;  a  Sn	X   [        U5         nUn   X4$    X4$ s  snf )	zÅReturns the number after dividing by the unit and the format pattern to use.
The algorithm is described here:
https://www.unicode.org/reports/tr35/tr35-45/tr35-numbers.html#Compact_Number_Formats.
Nr7   T)ÚreverseÚ0r¦   é   Ú1)r1   r|   r�   r   Úis_nanÚis_infiniteÚsortedr¡   r¢   r®   r²   r   r>   Úroundr9   )
rš   rº   r*   rµ   r±   ÚmÚ	magnituder²   Úroundedr9   s
             r   r¹   r¹   �  sr  € ô �fœgŸo™o×.Ñ.Ü—’¤ V£Ó-ˆØ‡}�}‡�˜&×,Ñ,×.Ñ.Ø�tˆ|ÐØ€FÜ¨^¸GÒ-DÓEÒ-D¨œS žVÑ-DÑEÈtÔTˆ	Üˆv‹;˜)Õ#à# GÑ,¬S°«^Ñ<ˆFÜ# FÓ+×3Ñ3ˆGà˜#‹~Øð( ˆ>Ðô# Ü—‘Ø¨¨w¯}©}¸SÓ/AÀAÑ/EÑ(FÑGÑHóˆFô
 ˜FÓ4ˆGà ×,Ñ,¬S°«[Ó9ˆKØÓ0Ø%�Ø˜‹{˜s nÓ4Ø!�Ü�9‹~ ^Ñ%@Ó@Ø%�Ø#Ñ0´°Y³Ñ@ˆFØˆFØØˆ>Ðñ7 Uð6 ˆ>Ðùò7 Fs   Á;E6c                  ó   • \ rS rSrSrSrg)ÚUnknownCurrencyFormatErrori½  z>Exception raised when an unknown currency format is requested.r#   Nrz   r#   r   r   rÉ   rÉ   ½  s   † ÜHr   rÉ   c               ó   • [         R                  " U=(       d    [        5      nUS:X  a  [        U UUUUUUUS9$ U(       a  [	        U5      n	O UR
                  U   n	U	R                  U UUUUUUS9$ ! [         a    [        U< S35      Sef = f)uÎ  Return formatted currency value.

>>> format_currency(1099.98, 'USD', locale='en_US')
'$1,099.98'
>>> format_currency(1099.98, 'USD', locale='es_CO')
'US$1.099,98'
>>> format_currency(1099.98, 'EUR', locale='de_DE')
'1.099,98\xa0\u20ac'
>>> format_currency(1099.98, 'EGP', locale='ar_EG', numbering_system='default')
'\u200f1Ù¬099Ù«98\xa0Ø¬.Ù….\u200f'

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', '\xa4\xa4 #,##0.00', locale='en_US')
'EUR 1,099.98'
>>> format_currency(1099.98, 'EUR', '#,##0.00 \xa4\xa4\xa4', locale='en_US')
'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')
'\xa51,100'
>>> format_currency(1099.98, 'COP', '#,##0.00', locale='es_ES')
'1.099,98'

However, the number of decimal digits can be overridden from the currency
information, by setting the last parameter to ``False``:

>>> format_currency(1099.98, 'JPY', locale='en_US', currency_digits=False)
'\xa51,099.98'
>>> format_currency(1099.98, 'COP', '#,##0.00', locale='es_ES', currency_digits=False)
'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')
'\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)
'$101299.98'

>>> format_currency(101299.98, 'USD', locale='en_US', group_separator=True)
'$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')
'1.00 US dollar'
>>> format_currency(1099.98, 'USD', locale='en_US', format_type='name')
'1,099.98 US dollars'
>>> format_currency(1099.98, 'USD', locale='ee', format_type='name')
'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')
'$1,099.99'
>>> format_currency(1099.9876, 'USD', locale='en_US', decimal_quantization=False)
'$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.
               Defaults to the system currency locale or numeric locale.
: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.
:param numbering_system: The numbering system used for formatting number symbols. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: If the numbering system is not supported by the locale.
Úname)r*   r±   Úcurrency_digitsr«   r¬   rp   z$ is not a known currency format typeN©r.   rÌ   r«   r¬   rp   )	r   r'   r   Ú_format_currency_long_namer®   Úcurrency_formatsru   rÉ   r¯   )
rš   r.   r±   r*   rÌ   r´   r«   r¬   rp   r²   s
             r   Úformat_currencyrÐ   Á  sÂ   € ôP �\Š\˜&×/¤KÓ0€Fà�fÓÜ)ØØØØØ+Ø!5Ø+Ø-ñ	
ð 		
ö Ü Ó'‰ð	Ø×-Ñ-¨kÑ:ˆGð �=‰=ØØØØ'Ø1Ø'Ø)ð ð ð øô ó 	Ü,Ø‘/Ð!EÐFóàðð	ús   ÁA2 Á2Bc          
     óü   • [        U [        5      (       a  [        U 5      OU n[        XUS9n	[	        XUS9n
U(       d  UR
                  S    n[        U5      nUR                  U UUUUUUS9nU	R                  XÊ5      $ )N)r>   r*   rÍ   )	r1   r   ÚfloatrN   rB   r­   r®   r¯   r±   )rš   r.   r*   r±   rÌ   r«   r¬   rp   Únumber_nÚunit_patternÚdisplay_namer²   Únumber_parts                r   rÎ   rÎ   L  s‘   € ô( !+¨6´3× 7Ñ 7Œu�VŒ}¸V€Hô -¨XÈfÑU€Lô % XÀfÑM€Lö Ø×'Ñ'¨Ñ-ˆä˜FÓ#€Gà—-‘-ØØØØ'Ø1Ø'Ø)ð  ð €Kð ×Ñ˜{Ó9Ð9r   c          	     ó  • [         R                  " U=(       d    [        5      n UR                  U   n[        XX45      u  pUb  S[        U5      ;  ad  US    H[  n	US   U	   R                  nSU;  a  M  [        R                  " SSU5      n[        R                  " SSU5      R                  5       n  O   Uc  [        S	5      e[        U5      n
U
R                  U UUS
S
US9$ ! [         a  n[        U< S35      UeSnAff = f)uÚ  Format a number as a currency value in compact form.

>>> format_compact_currency(12345, 'USD', locale='en_US')
'$12K'
>>> format_compact_currency(123456789, 'USD', locale='en_US', fraction_digits=2)
'$123.46M'
>>> format_compact_currency(123456789, 'EUR', locale='de_DE', fraction_digits=1)
'123,5\xa0Mio.\xa0â‚¬'

:param number: the number to format
:param currency: the currency code
:param format_type: the compact format type to use. Defaults to "short".
:param locale: the `Locale` object or locale identifier.
               Defaults to the system currency locale or numeric locale.
:param fraction_digits: Number of digits after the decimal point to use. Defaults to `0`.
:param numbering_system: The numbering system used for formatting number symbols. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: If the numbering system is not supported by the locale.
z, is not a known compact currency format typeNô   Â¤r7   u	   [^0\s\Â¤]Ú z(\s)\s+z\1zANo compact currency format found for the given number and locale.F)r.   rÌ   r«   rp   )r   r'   r   Úcompact_currency_formatsru   rÉ   r¹   r   r²   ÚreÚsubÚstripr;   r®   r¯   )rš   r.   r´   r*   rµ   rp   rº   rw   r±   rÆ   r²   s              r   Úformat_compact_currencyrÞ   {  s  € ô8 �\Š\˜&×/¤KÓ0€FðØ×8Ñ8¸ÑEˆô
 )¨ÀÓY�N€Fà�~˜¤S¨£[Ó0à'¨Ô0ˆIØ# GÑ,¨YÑ7×?Ñ?ˆFØ˜6Ó!Ùä—V’V˜L¨"¨fÓ5ˆFä—V’V˜J¨¨vÓ6×<Ñ<Ó>ˆFÙñ 1ð �~ÜÐ\Ó]Ð]Ü˜FÓ#€GØ�=‰=ØØØØØ"Ø)ð ð ð øô) ó Ü(Ø‰oÐIÐJó
àð	ûðús   ¥C% Ã%
DÃ/C?Ã?Dc               ó°   • [         R                  " U=(       d    [        5      nU(       d  UR                  S   n[	        U5      nUR                  U UUUUS9$ )uz  Return formatted percent value for a specific locale.

>>> format_percent(0.34, locale='en_US')
'34%'
>>> format_percent(25.1234, locale='en_US')
'2,512%'
>>> format_percent(25.1234, locale='sv_SE')
'2\xa0512\xa0%'
>>> format_percent(25.1234, locale='ar_EG', numbering_system='default')
'2Ù¬512%'

The format pattern can also be specified explicitly:

>>> format_percent(25.1234, '#,##0\u2030', locale='en_US')
'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')
'2,399%'
>>> format_percent(23.9876, locale='en_US', decimal_quantization=False)
'2,398.76%'

>>> format_percent(229291.1234, locale='pt_BR', group_separator=False)
'22929112%'

>>> format_percent(229291.1234, locale='pt_BR', group_separator=True)
'22.929.112%'

:param number: the percent number to format
:param format:
:param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
: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.
:param numbering_system: The numbering system used for formatting number symbols. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: If the numbering system is not supported by the locale.
Nrª   )r   r'   r   Úpercent_formatsr®   r¯   r°   s          r   Úformat_percentrá   ¸  sZ   € ôf �\Š\˜&×.¤JÓ/€FÞØ×'Ñ'¨Ñ-ˆÜ˜FÓ#€GØ�=‰=ØØØ1Ø'Ø)ð ð ð r   c               ó®   • [         R                  " U=(       d    [        5      nU(       d  UR                  S   n[	        U5      nUR                  U UUUS9$ )u  Return value formatted in scientific notation for a specific locale.

>>> format_scientific(10000, locale='en_US')
'1E4'
>>> format_scientific(10000, locale='ar_EG', numbering_system='default')
'1Ø£Ø³4'

The format pattern can also be specified explicitly:

>>> format_scientific(1234567, '##0.##E00', locale='en_US')
'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, '#.##E0', locale='en_US')
'1.23E3'
>>> format_scientific(1234.9876, '#.##E0', locale='en_US', decimal_quantization=False)
'1.2349876E3'

:param number: the number to format
:param format:
:param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
:param decimal_quantization: Truncate and round high-precision numbers to
                             the format pattern. Defaults to `True`.
:param numbering_system: The numbering system used for formatting number symbols. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise `UnsupportedNumberingSystemError`: If the numbering system is not supported by the locale.
Nr·   )r   r'   r   Úscientific_formatsr®   r¯   )rš   r±   r*   r«   rp   r²   s         r   Úformat_scientificrä   ø  sW   € ôL �\Š\˜&×.¤JÓ/€FÞØ×*Ñ*¨4Ñ0ˆÜ˜FÓ#€GØ�=‰=ØØØ1Ø)ð	 ð ð r   c                  ó4   ^ • \ rS rSrSrSSU 4S jjjrSrU =r$ )ÚNumberFormatErrori*  z>Exception raised when a string cannot be parsed into a number.c                ó0   >• [         TU ]  U5        X l        g rP   )Úsuperr   Úsuggestions)r   Úmessageré   Ú	__class__s      €r   r   ÚNumberFormatError.__init__-  s   ø€ Ü‰Ñ˜Ô!à&Õr   ©ré   rP   )rê   r   ré   zlist[str] | Noner   r   )r   r   r   r    r!   r   r"   Ú__classcell__)rë   s   @r   ræ   ræ   *  s   ø† ÙH÷'÷ 'r   ræ   >   Ú ô   Â õ   â€¯Ú|c               ó  • [        XS9nU[        ;   a4  X0;  a/  [        R                  U 5      (       a  [        R	                  X05      n  [        U R                  US5      5      $ ! [         a  n[        U < S35      UeSnAff = f)au  Parse 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. Defaults to the system numeric locale.
:param numbering_system: The numbering system used for formatting number symbols. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:return: the parsed number
:raise `NumberFormatError`: if the string can not be converted to a number
:raise `UnsupportedNumberingSystemError`: if the numbering system is not supported by the locale.
rr   rÙ   z is not a valid numberN)	rŽ   ÚSPACE_CHARSÚSPACE_CHARS_REÚsearchrÜ   r¡   Úreplacer;   ræ   )Ústringr*   rp   Úgroup_symbolÚves        r   Úparse_numberrû   <  s„   € ô8 $ FÑN€Lð 	œÓ#àÓ&ä×!Ñ! &×)Ñ)ô  ×#Ñ# LÓ9ˆðMÜ�6—>‘> ,°Ó3Ó4Ð4øÜó MÜ 6¡*Ð,BÐ CÓDÈ"ÐLûðMús   Á	A$ Á$
BÁ.A>Á>Bc               ó\  • [         R                  " U=(       d    [        5      n[        XS9n[	        XS9nU(       d>  U[
        ;   a4  X@;  a/  [        R                  U 5      (       a  [        R                  X@5      n  [        R                  " U R                  US5      R                  US5      5      nU(       a—  X@;   a’  [        UUSUS9nX:w  a�  U[        X5      :w  ar   [        R                  " U R                  US5      R                  US5      5      n	[        U	USUS9n
X¨:X  a  [        U < SU< S	3U/S
9e[        U < SU< SU
< S	3XŠ/S
9eU$ ! [        R                   a  n[        U < S35      UeSnAff = f! [        R                   a  n[        U < SU< S	3U/S
9UeSnAff = f)u²  Parse 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')
>>> parse_decimal('1Ù¬099Ù«98', locale='ar_EG', numbering_system='default')
Decimal('1099.98')

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. Defaults to the system numeric locale.
:param strict: controls whether numbers formatted in a weird way are
               accepted or rejected
:param numbering_system: The numbering system used for formatting number symbols. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:raise NumberFormatError: if the string can not be converted to a
                          decimal number
:raise UnsupportedNumberingSystemError: if the numbering system is not supported by the locale.
rr   rÙ   r   z is not a valid decimal numberNF)r*   r«   rp   z: is not a properly formatted decimal number. Did you mean Ú?rí   z? Or maybe )r   r'   r   rŽ   r~   rô   rõ   rö   rÜ   r|   r�   r÷   ÚInvalidOperationræ   r™   Ú$_remove_trailing_zeros_after_decimal)rø   r*   Ústrictrp   rù   Údecimal_symbolÚparsedÚexcÚproperÚ
parsed_altÚ
proper_alts              r   Úparse_decimalr  k  sæ  € ô` �\Š\˜&×.¤JÓ/€FÜ# FÑN€LÜ'¨ÑR€NæØœÓ#ØÓ&ä×!Ñ! &×)Ñ)ô  ×#Ñ# LÓ9ˆðVÜ—’ §¡°¸bÓ!A×!IÑ!IÈ.ÐZ]Ó!^Ó_ˆö �,Ó(ÜØØØ!&Ø-ñ	
ˆð Ó Ô*NÈvÓ*fÓ fðÜ$Ÿ_š_Ø—N‘N >°2Ó6×>Ñ>¸|ÈSÓQó�
ô ,ØØ!Ø).Ø%5ñ	�
ð Ó'Ü+Ø!™*ð %(Ø(.¡z°ð4à%+ Hñð ô ,Ø!™*ð %(Ø(.¡z°¸Z¹NÈ!ðMà%+Ð$8ñð ð
 €MøôO ×#Ñ#ó VÜ 6¡*Ð,JÐ KÓLÐRUÐUûðVûô ×+Ñ+ó Ü'Ø‘jð !$Ø$*¡:¨Qð0à!' ñð ð	ûðús0   Á<6E Ã6E> ÅE;Å&E6Å6E;Å>F+ÆF&Æ&F+c                ó~   • U R                  U5      u  p#nU(       a!  UR                  S5      nU(       a  X!-   U-   $ U$ U $ )aq  
Remove trailing zeros from the decimal part of a numeric string.

This function takes a string representing a numeric value and a decimal symbol.
It removes any trailing zeros that appear after the decimal symbol in the number.
If the decimal part becomes empty after removing trailing zeros, the decimal symbol
is also removed. If the string does not contain the decimal symbol, it is returned unchanged.

:param string: The numeric string from which to remove trailing zeros.
:type string: str
:param decimal_symbol: The symbol used to denote the decimal point.
:type decimal_symbol: str
:return: The numeric string with trailing zeros removed from its decimal part.
:rtype: str

Example:
>>> _remove_trailing_zeros_after_decimal("123.4500", ".")
'123.45'
>>> _remove_trailing_zeros_after_decimal("100.000", ".")
'100'
>>> _remove_trailing_zeros_after_decimal("100", ".")
'100'
r¾   )Ú	partitionÚrstrip)rø   r  Úinteger_partÚ_Údecimal_parts        r   rÿ   rÿ   Ô  sH   € ð0 %+×$4Ñ$4°^Ó$DÑ!€L�\æØ#×*Ñ*¨3Ó/ˆÞØÑ0°<Ñ?Ð?ØÐà€Mr   zJ(?P<prefix>(?:[^'0-9@#.,]|'[^']*')*)(?P<number>[0-9@#.,E+]*)(?P<suffix>.*)c                ó²   • [        U 5      nU R                  S5      nUS:X  a  gX-
  S-
  nU SU* S-
   R                  S5      nUS:X  a  X"4$ X-
  U-
  S-
  nX#4$ )z�Parse primary and secondary digit grouping

>>> parse_grouping('##')
(1000, 1000)
>>> parse_grouping('#,###')
(3, 3)
>>> parse_grouping('#,####,###')
(3, 4)
r�   éÿÿÿÿ)éè  r  r¿   Nr“   )ÚlenÚrfind)ÚpÚwidthÚg1Úg2s       r   Úparse_groupingr  þ  sp   € ô �‹F€EØ	
�‰�‹€BØ	ˆRƒxØØ	‰�a‰€BØ	
ˆ9ˆbˆS�1‰Wˆ×	Ñ	˜CÓ	 €BØ	ˆRƒxØˆvˆØ	‰�b‰˜1Ñ	€BØˆ6€Mr   ÚNumberPatternc                óD  • [        U [        5      (       a  U $ S nU nSU ;   a+  U R                  SS5      u  p#U" U5      u  pEnU" U5      u  pxn	OU" U5      u  pEnSU 3nUn	SU;   a  UR                  SS5      u  pZOSn
SU;   a  SU;   a  S	U;   a  [        S
5      eSU;   a  UR	                  SS5      u  p¼OUnSnS nU" U5      nU" U5      nU
(       a+  U
R                  S5      nU
R                  S5      n
U" U
5      nOSnSn[        U5      n[        U XG4Xi4UUUUUU5	      $ )zParse number format patternsc                óp   • [         R                  U 5      nUc  [        SU < 35      eUR                  5       $ )NzInvalid number pattern )Ú_number_pattern_rerö   r;   Úgroups)r²   Úrvs     r   Ú_match_numberÚ$parse_pattern.<locals>._match_number  s6   € Ü×&Ñ& wÓ/ˆØ‰:ÜÐ6°w±kÐBÓCÐCØ�y‰y‹{Ðr   Ú;r¿   r…   r‰   NÚ@r   r¾   z5Significant digit patterns can not contain "@" or "0"rÙ   c                ór   • S=pU  H,  nUS;   a  US-  nUS-  nM  US:X  a  US-  nM"  US:X  a  M*    X4$    X4$ )z(Calculate the min and max allowed digitsr   z@0r¿   Ú#r�   r#   )r  ÚminÚmaxÚcs       r   Úparse_precisionÚ&parse_pattern.<locals>.parse_precision6  sY   € àˆˆÛˆAØ�D‹yØ�q‘�Ø�q‘’Ø�c“Ø�q‘’Ø�c“ÙàØˆxˆñ ð ˆxˆr   r�   )r1   r  Úsplitr;   ÚrsplitÚ
startswithÚlstripr  )r²   r  Úpos_patternÚneg_patternÚ
pos_prefixrš   Ú
pos_suffixÚ
neg_prefixr  Ú
neg_suffixÚexpÚintegerÚfractionr'  Úint_precÚ	frac_precÚexp_plusÚexp_precÚgroupings                      r   r®   r®     sd  € ä�'œ=×)Ñ)Øˆòð €Kð ˆgƒ~Ø#*§=¡=°°aÓ#8Ñ ˆÙ)6°{Ó)CÑ&ˆ
˜JÙ$1°+Ó$>Ñ!ˆ
‘zá)6°{Ó)CÑ&ˆ
˜JØ˜˜Ð%ˆ
Øˆ
Ø
ˆfƒ}Ø—l‘l 3¨Ó*‰ˆ�àˆØ
ˆfƒ}˜ ›¨3°&«=ÜÐPÓQÐQØ
ˆfƒ}Ø"ŸM™M¨#¨qÓ1Ñˆ�àˆØˆòñ ˜wÓ'€HÙ Ó)€IÞ
Ø—>‘> #Ó&ˆØ�j‰j˜‹oˆÙ" 3Ó'‰àˆØˆÜ˜gÓ&€HÜØØ	Ð Ø	Ð ØØØØØØó
ð 
r   c                  ó,  • \ rS rSr S                   SS jjrSS jrSS jrSS.       SS jjr     SSS.               SS	 jjjrSS
 jr	            SS jr
            SS jr S         SS jjrSrg)r  i\  Nc
                óš   • Xl         X l        X0l        X�l        X@l        XPl        X`l        Xpl        X€l        U R                  5       U l
        g rP   )r²   ÚprefixÚsuffixÚnumber_patternr:  r6  r7  r9  r8  Úcompute_scaleÚscale)
r   r²   r=  r>  r:  r6  r7  r9  r8  r?  s
             r   r   ÚNumberPattern.__init__]  sB   € ð ŒØŒØŒØ,ÔØ ŒØ ŒØ"ŒØ ŒØ ŒØ×'Ñ'Ó)ˆ�
r   c                óP   • S[        U 5      R                   SU R                  < S3$ )NÚ<rï   Ú>)Útyper   r²   )r   s    r   Ú__repr__ÚNumberPattern.__repr__u  s'   € Ø”4˜“:×&Ñ&Ð' q¨¯©Ñ(8¸Ð:Ð:r   c                óÆ   • SnSSR                  U R                  U R                  -   5      ;   a  SnU$ SSR                  U R                  U R                  -   5      ;   a  SnU$ )uý   Return 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   Ú%rÙ   r“   u   â€°é   )Újoinr=  r>  )r   rA  s     r   r@  ÚNumberPattern.compute_scalex  s]   € ð ˆØ�"—'‘'˜$Ÿ+™+¨¯©Ñ3Ó4Ó4ØˆEð ˆð �b—g‘g˜dŸk™k¨D¯K©KÑ7Ó8Ó8ØˆEØˆr   rk   rr   c               óL  • UR                  5       nU[        U5      -  nUR                  5       S:X  d   e[        S[        U R                  5      /5      S-
  nXE-
  nU[        U* 5      -  nSnUS:  a
  [        X#S9nOU R                  (       a	  [        X#S9n[        U5      nXU4$ )z=Returns normalized scientific notation components of a value.r   r¿   rÙ   rr   )	Úadjustedr¨   r%  r$  r6  r†   r8  r‚   r¢   )r   Úvaluer*   rp   r3  Ú
lead_shiftÚexp_signs          r   Úscientific_notation_elementsÚ*NumberPattern.scientific_notation_elements†  s­   € ð �n‰nÓˆØÔ+¨CÓ0Ñ0ˆØ�~‰~Ó 1Ó$Ð$Ð$ô
 ˜!œS §¡Ó/Ð0Ó1°AÑ5ˆ
ØÑˆØÔ+¨Z¨KÓ8Ñ8ˆð ˆØ�‹7Ü,¨VÑW‰HØ�]�]Ü+¨FÑVˆHô �#‹hˆà˜8Ð#Ð#r   c               óæ  • [        U[        R                  5      (       d  [        R                  " [        U5      5      nUR	                  U R
                  5      n[        UR                  5       5      n	[        U5      R                  5       nU R                  (       a  U R                  UUUS9u  pnU(       a  [        R                  " S[        SS9  UnO*U(       a  U(       a  [        U5      4S-  nOU R                   nU(       a  U R                  (       a$  US:X  a  US   [#        US   [%        U5      /5      4nU R                  (       a_  SR'                  U R)                  XXÇUS9[+        X(S9WU R-                  [        W
5      U R                  S   U R                  S   X(S9/5      nO�S	U R.                  ;   aj  U R1                  XR2                  S   U R2                  S   5      nUR5                  S
5      u  nnnU R-                  USSX(S9nU(       a  U[7        X(S9U-   -  nOU R)                  UUUUUS9nSR'                  U R8                  U	   U R:                  S:w  a  UOSU R<                  U	   45      nSU;   aZ  UbW  UR?                  S[A        X1U5      5      nUR?                  SURC                  5       5      nUR?                  S[E        X25      5      n[F        RH                  " SS U5      nU$ )aë  Renders 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.
:param group_separator: Whether to use the locale's number group separator.
:param numbering_system: The numbering system used for formatting number symbols. Defaults to "latn".
                         The special value "default" will use the default numbering system of the locale.
:return: Formatted decimal string.
:rtype: str
:raise UnsupportedNumberingSystemError: If the numbering system is not supported by the locale.
rr   z@The force_frac parameter to NumberPattern.apply() is deprecated.r“   r”   )r   r   r   r¿   rÙ   r!  r   r  rØ   u   Â¤Â¤Â¤u   Â¤Â¤z	'([^']*)'c                ó6   • U R                  S5      =(       d    S$ )Nr¿   Ú')rŒ   )rÅ   s    r   Ú<lambda>Ú%NumberPattern.apply.<locals>.<lambda>"  s   € °·±¸³
×0A¸cÐ0Ar   )%r1   r|   r�   r   ÚscalebrA  r¡   Ú	is_signedr¢   rž   r9  rS  r–   r—   r˜   rJ   r7  r%  r¤   rL  Ú_quantize_valuerŠ   Ú_format_intr²   Ú_format_significantr6  r	  r~   r=  r?  r>  r÷   rB   r4   rE   rÛ   rÜ   )r   rP  r*   r.   rÌ   r«   Ú
force_fracr¬   rp   Úis_negativer3  rR  r7  rš   ÚtextÚaÚsepÚbÚretvals                      r   r¯   ÚNumberPattern.apply¦  s¹  € ôR ˜%¤§¡×1Ñ1Ü—O’O¤C¨£JÓ/ˆEà—‘˜TŸZ™ZÓ(ˆô ˜%Ÿ/™/Ó+Ó,ˆÜ�E“
×$Ñ$Ó&ˆð �=�=Ø#'×#DÑ#DØØØ!1ð $Eð $Ñ ˆE˜ö ä�MŠMØRÜ"Øòð
 #‰IÞž/Ü/°Ó9Ð;¸aÑ?‰IàŸ™ˆIö $¨¯¯¸)ÀvÓ:MØ" 1™¤s¨I°a©LÔ:OÐPUÓ:VÐ+WÓ'XÐYˆIð �=�=Ø—W‘WØ×$Ñ$ U°IÐaqÐ$ÐrÜ& vÑQØØ× Ñ ¤ S£¨4¯=©=¸Ñ+;¸T¿]¹]È1Ñ=MÈvÐ Ðyð	ó ‰Fð �D—L‘LÓ Ø×+Ñ+¨E·=±=ÀÑ3CÀTÇ]Á]ÐSTÑEUÓVˆDØŸ™ sÓ+‰IˆAˆs�AØ×%Ñ% a¨¨D°&Ð%Ð\ˆFÞØÔ,¨VÑWÐZ[Ñ[Ñ[�øð ×)Ñ)ØØØØØ!1ð *ð ˆFð —‘à—‘˜KÑ(Ø×-Ñ-°Ó3‘¸Ø—‘˜KÑ(ðó
ˆð �6‹>˜hÑ2Ø—^‘^ HÔ.?ÀÐQWÓ.XÓYˆFØ—^‘^ F¨H¯N©NÓ,<Ó=ˆFØ—^‘^ DÔ*=¸hÓ*OÓPˆFô —’˜Ñ&AÀ6ÓJˆàˆr   c           	     ó®  • UR                  5       nUS-
  U-
  n[        UR                  U5      R                  [        R
                  " S5      5      5      nUS::  a  USU* -  -   nU$ US U*  n[        U5      n	U	[        X)-
  S5      -   n
SR                  U=(       d    SS[        US-   S5      * XiU
 XjS  R                  S5      S9R                  S5      nU$ )Nr¿   r   r¾   z-{intpart}.{pad:0<{fill}}{fracpart}{fracextra}rÙ   )ÚintpartÚpadÚfillÚfracpartÚ	fracextrar   )rO  r   rZ  Úquantizer|   r�   r  r%  r±   r$  r
  )r   rP  ÚminimumÚmaximumr3  rA  Údigitsrh   rh  ÚiÚjs              r   r^  Ú!NumberPattern._format_significant:  sê   € Ø�n‰nÓˆØ˜!‘˜cÑ!ˆÜ�U—\‘\ %Ó(×1Ñ1´'·/²/À!Ó2DÓEÓFˆØ�A‹:Ø˜c U F™lÑ*ˆFð ˆð ˜W˜u˜f�oˆGÜ�G“ˆAØ”C˜™ QÓ'Ñ'ˆAØD×KÑKØŸ 3ØÜ˜# ™' 1“oÐ%Ø !˜Ø  ˜*×+Ñ+¨CÓ0ð Lð ÷ ‰f�S‹kð ð ˆr   c               óò   • [        U5      nXb:  a
  SX&-
  -  U-   nU R                  S   nSn[        XES9n	[        U5      U:”  a1  X‘U* S  -   U-   nUS U*  nU R                  S   n[        U5      U:”  a  M1  X-   $ )Nr¾   r   rÙ   rr   r¿   )r  r:  rŽ   )
r   rP  r$  r%  r*   rp   r  ÚgsizeÚretÚsymbols
             r   r]  ÚNumberPattern._format_intM  s”   € ô �E“
ˆØ‹;Ø˜3™;Ñ'¨%Ñ/ˆEØ—‘˜aÑ ˆØˆÜ! &ÑLˆÜ�%‹j˜5Ó Ø %  ˜>Ñ)¨CÑ/ˆCØ˜'˜E˜6�NˆEØ—M‘M !Ñ$ˆEô �%‹j˜5Õ ð ‰{Ðr   c               óR  • UR                  5       (       a	  [        X%S9$ [        US   5      nUR                  U5      nUS R	                  S5      u  p‰n
UnU(       a-  U R                  UU R                  S   U R                  S   UUS9nX°R                  U
=(       d    SUUUS9-   nU$ )Nrr   r¿   Úfr   r   r¾   )r*   r_  rp   )rÂ   r‘   r¨   rm  r	  r]  r6  Ú_format_frac)r   rP  r*   r7  r¬   rp   ÚquantumrÇ   rb  rc  rd  r  rš   s                r   r\  ÚNumberPattern._quantize_valueb  sÃ   € ð ×Ñ×ÑÜ& vÑQÐQÜ% i°¡lÓ3ˆØ—.‘. Ó)ˆØ˜q�k×,Ñ,¨SÓ1‰	ˆ�ØˆÞØ×+Ñ+ØØ—‘˜aÑ Ø—‘˜aÑ ØØ!1ð ,ð ˆLð × 1Ñ 1Ø�H�ØØ Ø-ð	 !2ð !
ñ 
ˆð ˆr   c               ó4  • U=(       d    U R                   u  pV[        U5      U:  a  USU[        U5      -
  -  -  nUS:X  d  US:X  a  [        U5      S:X  a  g[        U5      U:”  a(  US   S:X  a  US S n[        U5      U:”  a  US   S:X  a  M  [        X$S9U-   $ )Nr¾   r   rÙ   r  rr   )r7  r  r¡   r~   )r   rP  r*   r_  rp   r$  r%  s          r   r{  ÚNumberPattern._format_frac‚  s�   € ð ×/ §¡‰ˆÜˆu‹:˜ÓØ�S˜C¤# e£*Ñ,Ñ-Ñ-ˆEØ�!‹8˜˜q›¤S¨£Z°1£_ØÜ�%‹j˜3Ó 5¨¡9°Ó#3Ø˜#˜2�JˆEô �%‹j˜3Ó 5¨¡9°Õ#3ä! &ÑLÈuÑTÐTr   )
r8  r9  r7  r:  r6  r?  r²   r=  rA  r>  rP   )r²   r   r=  útuple[str, str]r>  r€  r:  útuple[int, int]r6  r�  r7  r�  r9  útuple[int, int] | Noner8  zbool | Noner?  ú
str | Noner   r   )r   r   )r   zLiteral[0, 2, 3])rP  údecimal.Decimalr*   úLocale | str | Nonerp   úLiteral['default'] | strr   z tuple[decimal.Decimal, int, str])NTTNT)rP  úfloat | decimal.Decimal | strr*   r…  r.   rƒ  rÌ   Úboolr«   rˆ  r_  r‚  r¬   rˆ  rp   r†  )rP  r„  rn  r¡   ro  r¡   r   r   )rP  r   r$  r¡   r%  r¡   r*   r…  rp   r†  r   r   )rP  r„  r*   r…  r7  r�  r¬   rˆ  rp   r†  r   r   )
rP  r   r*   r…  r_  r‚  rp   r†  r   r   )r   r   r   r    r   rG  r@  rS  r¯   r^  r]  r\  r{  r"   r#   r   r   r  r  \  sì  † ð &*ð*àð*ð  ð*ð  ð	*ð
 "ð*ð "ð*ð #ð*ð )ð*ð ð*ð #ð*ð 
õ*ô0;ôð& 6<ñ$àð$ð $ð$ð
 3ð$ð 
*õ$ðH  $Ø $Ø%)Ø-1Ø $ð~ð 6<ñ~à,ð~ð $ð~ð ð	~ð
 ð~ð #ð~ð +ð~ð ð~ð 3ö~ôhð&àðð ðð ð	ð
 $ðð 3ðð 
ôð*àðð $ðð #ð	ð
 ðð 3ðð 
ôðH .2ð	UàðUð $ðUð +ð	Uð 3ðUð 
÷Uð Ur   rP   )r*   r…  r   zset[str])r.   r   r*   r…  r   r   )r.   r   r*   r…  r   rˆ  )r.   r   r*   r…  r   rƒ  )NN)r.   r   r>   zfloat | decimal.Decimal | Noner*   r…  r   r   )r.   r   r*   r…  r   r   )r.   r   r   r¡   ).....)rR   r   rS   údatetime.date | NonerT   r‰  rU   rˆ  rV   rˆ  rW   zLiteral[False]r   z	list[str])rR   r   rS   r‰  rT   r‰  rU   rˆ  rV   rˆ  rW   zLiteral[True]r   zlist[dict[str, Any]])NNTFF)rR   r   rS   r‰  rT   r‰  rU   rˆ  rV   rˆ  rW   rˆ  r   z list[str] | list[dict[str, Any]])rk   )r*   r   rp   r†  r   r   )r*   r   rp   r†  r   r   )r*   r…  rp   r†  r   r   )rš   r‡  r*   r…  r   r   )rš   r„  r   r¡   )r§   zint | decimal.Decimalr   r„  )NNTT)rš   r‡  r±   ústr | NumberPattern | Noner*   r…  r«   rˆ  r¬   rˆ  rp   r†  r   r   )rš   r‡  r´   zLiteral['short', 'long']r*   r…  rµ   r¡   rp   r†  r   r   )
rš   r‡  rº   r   r*   r   rµ   r¡   r   z,tuple[decimal.Decimal, NumberPattern | None])NNTÚstandardTT)rš   r‡  r.   r   r±   rŠ  r*   r…  rÌ   rˆ  r´   z)Literal['name', 'standard', 'accounting']r«   rˆ  r¬   rˆ  rp   r†  r   r   )rš   r‡  r.   r   r*   r   r±   rŠ  rÌ   rˆ  r«   rˆ  r¬   rˆ  rp   r†  r   r   )rš   r‡  r.   r   r´   zLiteral['short']r*   r…  rµ   r¡   rp   r†  r   r   )NNT)rš   r‡  r±   rŠ  r*   r…  r«   rˆ  rp   r†  r   r   )rø   r   r*   r…  rp   r†  r   r¡   )NF)
rø   r   r*   r…  r   rˆ  rp   r†  r   r„  )rø   r   r  r   r   r   )r  r   r   r�  )r²   zNumberPattern | strr   r  )Br!   Ú
__future__r   rc   r|   rÛ   r–   Útypingr   r   r   r   Ú
babel.corer   r	   r
   Úbabel.localedatar   r   r   r   r   r+   r/   r2   r5   rB   rE   rJ   rN   rX   rq   rx   rv   r~   r‚   r†   rŠ   rŽ   r‘   r›   r¤   r¨   r™   r»   r¹   ru   rÉ   rÐ   rÎ   rÞ   rá   rä   r;   ræ   rô   ÚcompilerL  rõ   rû   r  rÿ   r  r  r®   r  r#   r   r   Ú<module>r‘     s›  ðñõ* #ã Û Û 	Û ß /Ó /ç 9Ñ 9Ý +áÐ:Ó;€Ù˜LÓ)€
ô
%˜9ô 
%ö-ö 	-ööð" -1Ø"&ð2Øð2à)ð2ð  ð2ð 	õ	2öD
Xô>ð  -1Ø"&ð 8Øð 8à)ð 8ð  ð 8ð 	õ	 8ðF 
ð (+Ø%(ØØØ&)ðØðà$ðð #ðð ð	ð
 ðð $ðð ôó 
ðð 
ð (+Ø%(ØØØ%(ðØðà$ðð #ðð ð	ð
 ðð #ðð ôó 
ðð (,Ø%)ØØØ!ð_Øð_à$ð_ð #ð_ð ð	_ð
 ð_ð ð_ð &õ_ðH 28ð Øð à.ð ð 	õ ð 28ñØðð /ðð õ	ô	 iô 	ð #'ð^ð 28ñ^Øð^ð /ð^ð 	ö	^ð0 #'ð_ð 28ñ_Øð_ð /ð_ð 	ö	_ð0 #'ð`ð 28ñ`Øð`ð /ð`ð 	ö	`ð0 #'ðbð 28ñbØðbð /ðbð 	ö	bð0 #'ð\ð 28ñ\Øð\ð /ð\ð 	ö	\ð0 #'ðað 28ñaØðað /ðað 	ö	að2 #'ð1Ø)ð1àð1ð 	õ1ô8'ô/ð *.Ø"&Ø!%Ø ðBð 28ñBØ)ðBà&ðBð  ðBð ð	Bð
 ðBð /ðBð 	öBðP -4Ø"&ØØ17ñ-Ø)ð-ð *ð-ð  ð	-ð
 ð-ð /ð-ð 	õ-ð`*Ø)ð*à"ð*ð ð*ð ð	*ð
 2ô*ôZI ô Ið *.Ø"&Ø Ø=GØ!%Ø ðHð 28ñHØ)ðHàðHð 'ðHð  ð	Hð
 ðHð ;ðHð ðHð ðHð /ðHð 	öHðV,:Ø)ð,:àð,:ð ð	,:ð
 'ð,:ð ð,:ð ð,:ð ð,:ð /ð,:ð 	ô,:ðf %,Ø"&ØØ17ñ:Ø)ð:àð:ð "ð	:ð
  ð:ð ð:ð /ð:ð 	õ:ð~ *.Ø"&Ø!%Ø ð=ð 28ñ=Ø)ð=à&ð=ð  ð=ð ð	=ð
 ð=ð /ð=ð 	ö=ðD *.Ø"&Ø!%ð	/ð 28ñ/Ø)ð/à&ð/ð  ð/ð ð	/ð /ð/ð 	ö/ôd'˜
ô 'ò€ð —’˜CŸH™H [Ó1Ó2€ð
 #'ð,Mð 28ñ	,MØð,Màð,Mð /ð	,Mð
 	ö,Mðb #'Øðfð
 28ñfØðfàðfð ðfð
 /ðfð öfôR ðF —Z’ZðóÐ ôô,E÷PuUò uUr   