File: //snap/core22/2111/lib/python3/dist-packages/babel/__pycache__/core.cpython-310.pyc
o
V��\+� � @ s� d Z ddlZddlmZ ddlmZmZ ddlmZ g d�Z da
ei �Zdd� Zd d
� Z
i dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�d#d$�d%d&�d'd(�d)d*�d+d,�i d-d.�d/d0�d1d2�d3d4�d5d6�d7d8�d9d:�d;d<�d=d>�d?d@�dAdB�dCdD�dEdF�dGdH�dIdJ�dKdL�dMdN��dOdPdQdRdSdT��ZG dUdV� dVe�ZG dWdX� dXe�ZdefdYdZ�Zd[efd\d]�Zdbd^d_�Zdbd`da�ZdS )cz�
babel.core
~~~~~~~~~~
Core locale representation and locale data access.
:copyright: (c) 2013-2019 by the Babel Team.
:license: BSD, see LICENSE for more details.
� N)�
localedata)�pickle�string_types)�
PluralRule)�UnknownLocaleError�Locale�default_locale�negotiate_locale�parse_localec C s t d��)Nz�The babel data files are not available. This usually happens because you are using a source checkout from Babel and you did not build the data files. Just make sure to run "python setup.py import_cldr" before installing the library.)�RuntimeError� r r �,/usr/lib/python3/dist-packages/babel/core.py�_raise_no_data_error s r c C s| t du r8tj�tj�t��}tj�|d�}tj�|�st� t|d��
}t �
|�a W d � n1 s3w Y t �| i �S )a_ Return the dictionary for the given key in the global data.
The global data is stored in the ``babel/global.dat`` file and contains
information independent of individual locales.
>>> get_global('zone_aliases')['UTC']
u'Etc/UTC'
>>> get_global('zone_territories')['Europe/Berlin']
u'DE'
The keys available are:
- ``all_currencies``
- ``currency_fractions``
- ``language_aliases``
- ``likely_subtags``
- ``parent_exceptions``
- ``script_aliases``
- ``territory_aliases``
- ``territory_currencies``
- ``territory_languages``
- ``territory_zones``
- ``variant_aliases``
- ``windows_zone_mapping``
- ``zone_aliases``
- ``zone_territories``
.. note:: The internal structure of the data may change between versions.
.. versionadded:: 0.9
:param key: the data key
Nz
global.dat�rb)�_global_data�os�path�join�dirname�__file__�isfiler �openr �load�get)�keyr �filename�fileobjr r r
�
get_global# s #�r �ar�ar_SY�bg�bg_BG�bs�bs_BA�ca�ca_ES�cs�cs_CZ�da�da_DK�de�de_DE�el�el_GR�en�en_US�es�es_ES�et�et_EE�fa�fa_IR�fi�fi_FI�fr�fr_FR�gl�gl_ES�he�he_IL�hu�hu_HU�id�id_ID�is�is_IS�it�it_IT�ja�ja_JP�km�km_KH�ko�ko_KR�lt�lt_LT�lv�lv_LV�mk�mk_MK�nl�nl_NL�nn�nn_NO�no�nb_NO�pl�pl_PL�pt�pt_PT�ro�ro_RO�ru�ru_RU�sk�sk_SK�sl_SI�sv_SE�th_TH�tr_TR�uk_UA)�sl�sv�th�tr�ukc @ s e Zd ZdZdd� ZdS )r z[Exception thrown when a locale is requested for which no locale data
is available.
c C s t �| d| � || _dS )zjCreate the exception.
:param identifier: the identifier string of the unsupported locale
zunknown locale %rN)� Exception�__init__�
identifier)�selfrn r r r
rm a s
zUnknownLocaleError.__init__N)�__name__�
__module__�__qualname__�__doc__rm r r r r
r \ s r c @ s� e Zd ZdZdrdd�Zedefdd��Zedefdd ��Zedsdd��Z d
d� Z
dd� Zdd� Zdd� Z
dd� Zedd� �Zdtdd�Zeedd�Zdtdd�Zeedd�Zdtd d!�Zeed"d�Zdtd#d$�Zeed%d�Zed&d'� �Zed(d)� �Zed*d+� �Zed,d-� �Zed.d/� �Zed0d1� �Zed2d3� �Zed4d5� �Z ed6d7� �Z!ed8d9� �Z"ed:d;� �Z#ed<d=� �Z$ed>d?� �Z%ed@dA� �Z&edBdC� �Z'edDdE� �Z(edFdG� �Z)edHdI� �Z*edJdK� �Z+edLdM� �Z,edNdO� �Z-edPdQ� �Z.edRdS� �Z/edTdU� �Z0edVdW� �Z1edXdY� �Z2edZd[� �Z3ed\d]� �Z4ed^d_� �Z5ed`da� �Z6edbdc� �Z7eddde� �Z8edfdg� �Z9edhdi� �Z:edjdk� �Z;edldm� �Z<edndo� �Z=edpdq� �Z>dS )ur aY Representation of a specific locale.
>>> locale = Locale('en', 'US')
>>> repr(locale)
"Locale('en', territory='US')"
>>> locale.display_name
u'English (United States)'
A `Locale` object can also be instantiated from a raw locale string:
>>> locale = Locale.parse('en-US', sep='-')
>>> repr(locale)
"Locale('en', territory='US')"
`Locale` objects provide access to a collection of locale data, such as
territory and language names, number and date format patterns, and more:
>>> locale.number_symbols['decimal']
u'.'
If a locale is requested for which no locale data is available, an
`UnknownLocaleError` is raised:
>>> Locale.parse('en_XX')
Traceback (most recent call last):
...
UnknownLocaleError: unknown locale 'en_XX'
For more information see :rfc:`3066`.
Nc C s<