%PDF- %PDF-
| Direktori : /usr/lib/python3.9/site-packages/babel/__pycache__/ |
| Current File : //usr/lib/python3.9/site-packages/babel/__pycache__/core.cpython-39.pyc |
a
�`+� � ( @ s d Z ddlZddlmZ ddlmZmZ ddlmZ g d�Z da
ei �Zdd� Zd d
� Z
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2�'ZG d3d4� d4e�ZG d5d6� d6e�Zdefd7d8�Zd9efd:d;�Zd@d<d=�ZdAd>d?�ZdS )Bz�
babel.core
~~~~~~~~~~
Core locale representation and locale data access.
:copyright: (c) 2013-2021 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��d S )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.9/site-packages/babel/core.py�_raise_no_data_error s r c C s| t du rptj�tj�t��}tj�|d�}tj�|�s<t� t|d��}t �
|�a W d � n1 sf0 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 �filenameZfileobjr r r
�
get_global# s #(r �ar_SY�bg_BG�bs_BA�ca_ES�cs_CZ�da_DK�de_DE�el_GR�en_US�es_ES�et_EE�fa_IR�fi_FI�fr_FR�gl_ES�he_IL�hu_HU�id_ID�is_IS�it_IT�ja_JPZkm_KH�ko_KR�lt_LT�lv_LV�mk_MK�nl_NL�nn_NO�nb_NO�pl_PL�pt_PT�ro_RO�ru_RU�sk_SK�sl_SI�sv_SE�th_TH�tr_TR�uk_UA)'�ar�bg�bs�ca�cs�da�de�el�en�es�et�fa�fi�fr�gl�he�hu�id�is�it�jaZkm�ko�lt�lv�mk�nl�nn�no�pl�pt�ro�ru�sk�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)�selfrk r r r
rj a s zUnknownLocaleError.__init__N)�__name__�
__module__�__qualname__�__doc__rj 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�Zdudd�Zeedd�Zdvd d!�Zeed"d�Zdwd#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 )xr 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<