/opt/imunify360/venv/lib/python3.11/site-packages/babel/__pycache__
Edit: /opt/imunify360/venv/lib/python3.11/site-packages/babel/__pycache__/units.cpython-311.pyc (12054B)
§
#ˆšáýqLã óº — d dl mZ d dlZd dlmZ d dlmZ d dlmZm Z erd dl
mZ G d„ de¦ « Z
d efd d„Zefd!d„Zd defd"d„Zefd#d„Zdddd defd$d„ZdS )%é )ÚannotationsN)Ú
TYPE_CHECKING)ÚLocale)Ú
LC_NUMERICÚformat_decimal)ÚLiteralc ó — e Zd Zd d„ZdS )
ÚUnknownUnitErrorÚunitÚstrÚlocaler ÚreturnÚNonec óF — t | |› d|› �¦ « d S )Nz is not a known unit in )Ú
ValueErrorÚ__init__)Úselfr r
s úk/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/babel/units.pyr zUnknownUnitError.__init__ s, € Ý×Ò˜D TÐ"KÐ"KÀ6Ð"KÐ"KÑLÔLÐLÐLÐLó N)r r r
r r r )Ú__name__Ú
__module__Ú__qualname__r © r r r
r
s. € € € € € ðMð Mð Mð Mð Mð Mr r
ÚlongÚmeasurement_unitr Úlengthú"Literal['short', 'long', 'narrow']r
úLocale | str | Noner ú
str | Nonec óÎ — t j |¦ « }t | |¬¦ « }|st | |¬¦ « ‚|j |i ¦ « |¦ « 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
:return: The unit display name, or None.
©r
©r r
)r ÚparseÚ_find_unit_patternr
Úunit_display_namesÚget)r r r
r s r Ú
get_unit_namer' sj € õ4 Œ\˜&Ñ
!Ô
!€FÝÐ.°vÐ>Ñ>Ô>€DØð EÝÐ$4¸VÐDÑDÔDÐDØÔ$×(Ò(¨¨rÑ2Ô2×6Ò6°vÑ>Ô>Ð>r Úunit_idc ó¸ — t j |¦ « }|j d }| |v r| S t |t ¬¦ « D ]}| | ¦ « r|c S ŒdS )aÈ
Expand an 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# Ú_dataÚsortedÚlenÚendswith)r( r
r* Úunit_patterns r r$ r$ 3 s| € õ" Œ\˜&Ñ
!Ô
!€FØ”L Ô1€MØ�-ÐÐØˆÝ˜}µ#Ð6Ñ6Ô6ð ð ˆØ× Ò Ñ)Ô)ð ØÐÐÐð ð ð r Úvalueúfloat | decimal.DecimalÚformatc ó´ — t j |¦ « }t ||¬¦ « }|st ||¬¦ « ‚|j d | |i ¦ « }t
| t ¦ « r| }d}n&t | ||¦ « }| | ¦ « }||v r||
|¦ « S t |||¬¦ « } |› d| p|› �S )aà 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')
u'12 metri'
>>> format_unit(15.5, 'length-mile', locale='fi_FI')
u'15,5 mailia'
>>> format_unit(1200, 'pressure-millimeter-ofhg', locale='nb')
u'1\xa0200 millimeter kvikks\xf8lv'
>>> format_unit(270, 'ton', locale='en')
u'270 tons'
Number formats may be overridden with the ``format`` parameter.
>>> import decimal
>>> format_unit(decimal.Decimal("-42.774"), 'temperature-celsius', 'short', format='#.0', locale='fr')
u'-42,8\u202f\xb0C'
The locale's usual pluralization rules are respected.
>>> format_unit(1, 'length-meter', locale='ro_RO')
u'1 metru'
>>> format_unit(0, 'length-mile', locale='cy')
u'0 mi'
>>> format_unit(1, 'length-mile', locale='cy')
u'1 filltir'
>>> format_unit(3, 'length-mile', locale='cy')
u'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
r! r" r* Úone)r r
ú )r r# r$ r
r, r&