Ë
    4]jž6  ã                  ó  — d dl mZ d dlZd dlmZ d dlmZ d dlmZm	Z	  G d„ de
«      Z	 	 d	 	 	 	 	 	 	 dd„Zddd	„Z	 	 	 dd
dœ	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z	 d	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 dd
dœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zy)é    )ÚannotationsN)ÚLiteral)ÚLocale)Ú
LC_NUMERICÚformat_decimalc                  ó   — e Zd Zdd„Zy)ÚUnknownUnitErrorc                ó:   — t         j                  | |› d|› �«       y )Nz is not a known unit in )Ú
ValueErrorÚ__init__)ÚselfÚunitÚlocales      úB/var/www/zogu/zoguvenv/lib/python3.12/site-packages/babel/units.pyr   zUnknownUnitError.__init__   s   € Ü×Ñ˜D T FÐ*BÀ6À(Ð"KÕLó    N)r   Ústrr   r   ÚreturnÚNone)Ú__name__Ú
__module__Ú__qualname__r   © r   r   r	   r	   
   s   „ ôMr   r	   c                óÊ   — t        j                  |xs t        «      }t        | |¬«      }|st	        | |¬«      ‚|j
                  j                  |i «      j                  |«      S )a  
    Get the display name for a measurement unit in the given locale.

    >>> get_unit_name("radian", locale="en")
    'radians'

    Unknown units will raise exceptions:

    >>> get_unit_name("battery", locale="fi")
    Traceback (most recent call last):
        ...
    UnknownUnitError: battery/long is not a known unit/length in fi

    :param measurement_unit: the code of a measurement unit.
                             Known units can be found in the CLDR Unit Validity XML file:
                             https://unicode.org/repos/cldr/tags/latest/common/validity/unit.xml

    :param length: "short", "long" or "narrow"
    :param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
    :return: The unit display name, or None.
    ©r   ©r   r   )r   Úparser   Ú_find_unit_patternr	   Úunit_display_namesÚget)Úmeasurement_unitÚlengthr   r   s       r   Úget_unit_namer"      sY   € ô4 �\‰\˜&Ò.¤JÓ/€FÜÐ.°vÔ>€DÙÜÐ$4¸VÔDÐDØ×$Ñ$×(Ñ(¨¨rÓ2×6Ñ6°vÓ>Ð>r   c                ó¾   — t        j                  |xs t        «      }|j                  d   }| |v r| S t	        |t
        ¬«      D ]  }|j                  | «      sŒ|c S  y)aÇ  
    Expand a unit into a qualified form.

    Known units can be found in the CLDR Unit Validity XML file:
    https://unicode.org/repos/cldr/tags/latest/common/validity/unit.xml

    >>> _find_unit_pattern("radian", locale="en")
    'angle-radian'

    Unknown values will return None.

    >>> _find_unit_pattern("horse", locale="en")

    :param unit_id: the code of a measurement unit.
    :return: A key to the `unit_patterns` mapping, or None.
    Úunit_patterns)ÚkeyN)r   r   r   Ú_dataÚsortedÚlenÚendswith)Úunit_idr   r$   Úunit_patterns       r   r   r   0   sa   € ô" �\‰\˜&Ò.¤JÓ/€FØ$*§L¡L°Ñ$A€MØ�-ÑØˆÜ˜}´#Ô6ò  ˆØ× Ñ  Õ)ØÒð ð r   Úlatn©Únumbering_systemc               ó„  — t        j                  |xs t        «      }t        ||¬«      }|st	        ||¬«      ‚|j
                  d   |   j                  |i «      }t        | t        «      r| }d}	n t        | |||¬«      }|j                  | «      }	|	|v r||	   j                  |«      S t        |||¬«      }
|› d|
xs |› �S )u•  Format a value of a given unit.

    Values are formatted according to the locale's usual pluralization rules
    and number formats.

    >>> format_unit(12, 'length-meter', locale='ro_RO')
    '12 metri'
    >>> format_unit(15.5, 'length-mile', locale='fi_FI')
    '15,5 mailia'
    >>> format_unit(1200, 'pressure-millimeter-ofhg', locale='nb')
    '1\xa0200 millimeter kvikks\xf8lv'
    >>> format_unit(270, 'ton', locale='en')
    '270 tons'
    >>> format_unit(1234.5, 'kilogram', locale='ar_EG', numbering_system='default')
    '1Ù¬234Ù«5 ÙƒÙŠÙ„ÙˆØºØ±Ø§Ù…'

    Number formats may be overridden with the ``format`` parameter.

    >>> import decimal
    >>> format_unit(decimal.Decimal("-42.774"), 'temperature-celsius', 'short', format='#.0', locale='fr')
    '-42,8\u202f\xb0C'

    The locale's usual pluralization rules are respected.

    >>> format_unit(1, 'length-meter', locale='ro_RO')
    '1 metru'
    >>> format_unit(0, 'length-mile', locale='cy')
    '0 mi'
    >>> format_unit(1, 'length-mile', locale='cy')
    '1 filltir'
    >>> format_unit(3, 'length-mile', locale='cy')
    '3 milltir'

    >>> format_unit(15, 'length-horse', locale='fi')
    Traceback (most recent call last):
        ...
    UnknownUnitError: length-horse is not a known unit in fi

    .. versionadded:: 2.2.0

    :param value: the value to format. If this is a string, no number formatting will be attempted.
    :param measurement_unit: the code of a measurement unit.
                             Known units can be found in the CLDR Unit Validity XML file:
                             https://unicode.org/repos/cldr/tags/latest/common/validity/unit.xml
    :param length: "short", "long" or "narrow"
    :param format: An optional format, as accepted by `format_decimal`.
    :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.
    :raise `UnsupportedNumberingSystemError`: If the numbering system is not supported by the locale.
    r   r   r$   Úoner-   )r!   r   ú )r   r   r   r   r	   r&   r   Ú
isinstancer   r   Úplural_formÚformatr"   )Úvaluer    r!   r4   r   r.   Úq_unitr$   Úformatted_valuer3   Úfallback_names              r   Úformat_unitr9   K   sà   € ôx �\‰\˜&Ò.¤JÓ/€FäÐ 0¸Ô@€FÙÜÐ$4¸VÔDÐDØ—L‘L Ñ1°&Ñ9×=Ñ=¸fÀbÓI€Mä�%œÔØˆØ‰ä(ØØØØ-ô	
ˆð ×(Ñ(¨Ó/ˆà�mÑ#Ø˜[Ñ)×0Ñ0°ÓAÐAô "ØØØô€Mð
 Ð˜a Ò AÐ1AÐBÐCÐCr   c                óò   — t        j                  |xs t        «      }t        | |¬«      }t        ||¬«      }|r|sy|j	                  dd«      d   }|j	                  dd«      d   }t        |› d|› �|¬«      S )a  
    Find a predefined compound unit pattern.

    Used internally by format_compound_unit.

    >>> _find_compound_unit("kilometer", "hour", locale="en")
    'speed-kilometer-per-hour'

    >>> _find_compound_unit("mile", "gallon", locale="en")
    'consumption-mile-per-gallon'

    If no predefined compound pattern can be found, `None` is returned.

    >>> _find_compound_unit("gallon", "mile", locale="en")

    >>> _find_compound_unit("horse", "purple", locale="en")

    :param numerator_unit: The numerator unit's identifier
    :param denominator_unit: The denominator unit's identifier
    :param locale: the `Locale` object or locale identifier. Defaults to the system numeric locale.
    :return: A key to the `unit_patterns` mapping, or None.
    :rtype: str|None
    r   Nú-é   éÿÿÿÿz-per-)r   r   r   r   Úsplit)Únumerator_unitÚdenominator_unitr   Úresolved_numerator_unitÚresolved_denominator_unitÚbare_numerator_unitÚbare_denominator_units          r   Ú_find_compound_unitrE   §   s”   € ô8 �\‰\˜&Ò.¤JÓ/€Fô 1°ÈÔOÐÜ 2Ð3CÈFÔ SÐñ $Ñ(AØð
 2×7Ñ7¸¸QÓ?ÀÑCÐØ5×;Ñ;¸CÀÓCÀBÑGÐô ØÐ
˜uÐ%:Ð$;Ð<Øôð r   c               óø  — t        j                  |xs t        «      }|r(|r&|dk(  r!t        |||¬«      }|rt	        | |||||¬«      S t        | t        «      r| }	n#|rt	        | |||||¬«      }	nt        | |||¬«      }	t        |t        «      r|}
nš|r‰|dk(  r`t        ||¬«      }|j                  d   j                  |i «      j                  |i «      j                  d«      }|r|j                  |	«      S d}t	        ||xs d||||¬«      j                  «       }
nt        ||||¬«      }
|j                  d	   j                  di «      j                  |i «      j                  d
d«      }|j                  |	|
«      S )uÕ	  
    Format a compound number value, i.e. "kilometers per hour" or similar.

    Both unit specifiers are optional to allow for formatting of arbitrary values still according
    to the locale's general "per" formatting specifier.

    >>> format_compound_unit(7, denominator_value=11, length="short", locale="pt")
    '7/11'

    >>> format_compound_unit(150, "kilometer", denominator_unit="hour", locale="sv")
    '150 kilometer per timme'

    >>> format_compound_unit(150, "kilowatt", denominator_unit="year", locale="fi")
    '150 kilowattia / vuosi'

    >>> format_compound_unit(32.5, "ton", 15, denominator_unit="hour", locale="en")
    '32.5 tons per 15 hours'

    >>> format_compound_unit(1234.5, "ton", 15, denominator_unit="hour", locale="ar_EG", numbering_system="arab")
    '1Ù¬234Ù«5 Ø·Ù† Ù„ÙƒÙ„ 15 Ø³Ø§Ø¹Ø©'

    >>> format_compound_unit(160, denominator_unit="square-meter", locale="fr")
    '160 par m\xe8tre carr\xe9'

    >>> format_compound_unit(4, "meter", "ratakisko", length="short", locale="fi")
    '4 m/ratakisko'

    >>> format_compound_unit(35, "minute", denominator_unit="nautical-mile", locale="sv")
    '35 minuter per nautisk mil'

    >>> from babel.numbers import format_currency
    >>> format_compound_unit(format_currency(35, "JPY", locale="de"), denominator_unit="liter", locale="de")
    '35\xa0\xa5 pro Liter'

    See https://www.unicode.org/reports/tr35/tr35-general.html#perUnitPatterns

    :param numerator_value: The numerator value. This may be a string,
                            in which case it is considered preformatted and the unit is ignored.
    :param numerator_unit: The numerator unit. See `format_unit`.
    :param denominator_value: The denominator value. This may be a string,
                              in which case it is considered preformatted and the unit is ignored.
    :param denominator_unit: The denominator unit. See `format_unit`.
    :param length: The formatting length. "short", "long" or "narrow"
    :param format: An optional format, as accepted by `format_decimal`.
    :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: A formatted compound value.
    :raise `UnsupportedNumberingSystemError`: If the numbering system is not supported by the locale.
    r<   r   )r!   r4   r   r.   )r4   r   r.   r$   ÚperÚ )r    r!   r4   r   r.   Úcompound_unit_patternsÚcompoundz{0}/{1})r   r   r   rE   r9   r2   r   r   r   r&   r   r4   Ústrip)Únumerator_valuer?   Údenominator_valuer@   r!   r4   r   r.   Úcompound_unitÚformatted_numeratorÚformatted_denominatorÚper_patterns               r   Úformat_compound_unitrR   Þ   sµ  € ôz �\‰\˜&Ò.¤JÓ/€Fñ Ñ*Ð/@ÀAÒ/EÜ+¨NÐ<LÐU[Ô\ˆÙÜØØØØØØ!1ôð ô �/¤3Ô'Ø-ÑÙ	Ü)ØØØØØØ-ô
Ñô -ØØØØ-ô	
Ðô Ð#¤SÔ)Ø 1ÑÙ	Ø Ò!Ü1Ð2BÈ6ÔRÐà—‘˜_Ñ-ß‘Ð% rÓ*ß‘�V˜R“ß‘�U“ð	 ñ Ø"×)Ñ)Ð*=Ó>Ð>ð !#Ðä +ØØ.Ò4°"ØØØØ-ô!
÷ ‰%‹'ñ 	ô !/ØØØØ-ô	!
Ðð 	�‰Ð-Ñ.ß	‰ˆU�B‹ß	‰ˆV�R‹ß	‰ˆZ˜Ó	#ð	 ð ×ÑÐ1Ð3HÓIÐIr   )ÚlongN)r    r   r!   ú"Literal['short', 'long', 'narrow']r   úLocale | str | Noner   ú
str | None)N)r*   r   r   rU   r   rV   )rS   NN)r5   ústr | float | decimal.Decimalr    r   r!   rT   r4   rV   r   rU   r.   úLiteral['default'] | strr   r   )r?   r   r@   r   r   rU   r   rV   )Nr<   NrS   NN)rL   rW   r?   rV   rM   rW   r@   rV   r!   rT   r4   rV   r   rU   r.   rX   r   rV   )Ú
__future__r   ÚdecimalÚtypingr   Ú
babel.corer   Úbabel.numbersr   r   r   r	   r"   r   r9   rE   rR   r   r   r   ú<module>r^      s†  ðÝ "ã Ý å ß 4ôM�zô Mð 28Ø"&ð?Øð?à.ð?ð  ð?ð ó	?ôBð< 28ØØ"&ðYDð 28ñYDØ(ðYDàðYDð /ðYDð ð	YDð
  ðYDð /ðYDð 	óYDð~ #'ð4Øð4àð4ð  ð4ð ó	4ðr "&Ø78Ø#'Ø17ØØ"&ðLJð 28ñLJØ2ðLJàðLJð 5ðLJð !ð	LJð
 /ðLJð ðLJð  ðLJð /ðLJð ôLJr   