%PDF- %PDF-
Direktori : /usr/lib/python3/dist-packages/babel/__pycache__/ |
Current File : //usr/lib/python3/dist-packages/babel/__pycache__/units.cpython-312.pyc |
� ƪb�+ � �x � d dl mZ d dlmZmZ G d� de� Zdefd�Zefd�Zddefd �Z efd �Z dddddefd�Zy) � )�Locale)�format_decimal� LC_NUMERICc � � e Zd Zd� Zy)�UnknownUnitErrorc �: � t j | |�d|��� y )Nz is not a known unit in )� ValueError�__init__)�self�unit�locales �-/usr/lib/python3/dist-packages/babel/units.pyr zUnknownUnitError.__init__ s � ����D�D�&�"Q�R� N)�__name__� __module__�__qualname__r � r r r r s � �Sr r �longc � � t j |� }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 :return: The unit display name, or None. �r �r r )r �parse�_find_unit_patternr �unit_display_names�get)�measurement_unit�lengthr r s r � get_unit_namer sT � �, �\�\�&� !�F��.�v�>�D���$4�V�D�D��$�$�(�(��r�2�6�6�v�>�>r c � � t j |� }|j d }| |v r| S t |t �� D ] }|j | � s�|c S y)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)�unit_idr r �unit_patterns r r r '