%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core22/current/lib/python3/dist-packages/babel/__pycache__/
Upload File :
Create Path :
Current File : //snap/core22/current/lib/python3/dist-packages/babel/__pycache__/localedata.cpython-310.pyc

o


p�`��@s�dZddlZddlZddlmZddlmZmZmZiZ	e�
�Zej�
ej�e�d�Zdd�Zdd	�Zd
d�Zdd
d�Zdd�ZGdd�de�ZGdd�dej�ZdS)aG
    babel.localedata
    ~~~~~~~~~~~~~~~~

    Low-level locale data access.

    :note: The `Locale` class, which uses this module under the hood, provides a
           more convenient interface for accessing the locale data.

    :copyright: (c) 2013-2019 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�N)�chain)�pickle�string_types�abczlocale-datacCsL|rt|t�s	dS|����}t�tt�g�D]}||��kr#|SqdS)z�Normalize a locale ID by stripping spaces and apply proper casing.

    Returns the normalized locale ID string or `None` if the ID is not
    recognized.
    N)�
isinstancer�strip�lowerr�
from_iterable�_cache�locale_identifiers)�name�	locale_id�r�2/usr/lib/python3/dist-packages/babel/localedata.py�normalize_locales��rcCsX|rt|t�s	dStj�|�}|tvrdStj�tj�td|��}|r&dSt	t
|��S)z�Check whether locale data is available for the given locale.

    Returns `True` if it exists, `False` otherwise.

    :param name: the locale identifier string
    FT�%s.dat)rr�os�path�basenamer
�exists�join�_dirname�boolr)r�
file_foundrrrr)srcCs<ttdd�}|durdd�dd�t�t�D�D�t_}|S)a�Return a list of all locale identifiers for which locale data is
    available.

    This data is cached after the first invocation in `locale_identifiers.cache`.

    Removing the `locale_identifiers.cache` attribute or setting it to `None`
    will cause this function to re-read the list from disk.

    .. versionadded:: 0.8.1

    :return: a list of locale identifiers (strings)
    �cacheNcSs$g|]\}}|dkr|dkr|�qS)z.dat�rootr)�.0�stem�	extensionrrr�
<listcomp>Hs
�z&locale_identifiers.<locals>.<listcomp>css�|]	}tj�|�VqdS�N)rr�splitext)r�filenamerrr�	<genexpr>Ks�z%locale_identifiers.<locals>.<genexpr>)�getattrrr�listdirrr)�datarrrr9s
�rTcCstj�|�}t��zyt�|�}|s}|dks|si}n,ddlm}|d��|�}|sA|�	d�}t
|�dkr8d}n	d�|dd��}t|��
�}tj�td	|�}t|d
��}|dkre|ret|t�|��nt�|�}Wd�n1stwY|t|<|Wt��St��w)aeLoad the locale data for the given locale.

    The locale data is a dictionary that contains much of the data defined by
    the Common Locale Data Repository (CLDR). This data is stored as a
    collection of pickle files inside the ``babel`` package.

    >>> d = load('en_US')
    >>> d['languages']['sv']
    u'Swedish'

    Note that the results are cached, and subsequent requests for the same
    locale return the same dictionary:

    >>> d1 = load('en_US')
    >>> d2 = load('en_US')
    >>> d1 is d2
    True

    :param name: the locale identifier string (or "root")
    :param merge_inherited: whether the inherited data should be merged into
                            the data of the requested locale
    :raise `IOError`: if no locale data file is found for the given locale
                      identifer, or one of the locales it inherits from
    rr)�
get_global�parent_exceptions�_�N���r�rb)rrr�_cache_lock�acquirer
�get�
babel.corer'�split�lenr�load�copyr�open�merger�release)r�merge_inheritedr&r'�parent�partsr"�fileobjrrrr3Qs2


��r3cCs�|��D]I\}}|durM|�|�}t|t�rG|duri}t|t�r&||f}n#t|t�r=|\}}|��}t||�||f}n|��}t||�n|}|||<qdS)anMerge the data from `dict2` into the `dict1` dictionary, making copies
    of nested dictionaries.

    >>> d = {1: 'foo', 3: 'baz'}
    >>> merge(d, {1: 'Foo', 2: 'Bar'})
    >>> sorted(d.items())
    [(1, 'Foo'), (2, 'Bar'), (3, 'baz')]

    :param dict1: the dictionary to merge into
    :param dict2: the dictionary containing the data that should be merged
    N)�itemsr/r�dict�Alias�tupler4r6)�dict1�dict2�key�val2�val1�alias�othersrrrr6�s&






��r6c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r>z�Representation of an alias in the locale data.

    An alias is a value that refers to some other part of the locale data,
    as specified by the `keys`.
    cCst|�|_dSr )r?�keys)�selfrGrrr�__init__��zAlias.__init__cCsdt|�j|jfS)Nz<%s %r>)�type�__name__rG�rHrrr�__repr__��zAlias.__repr__cCsP|}|jD]}||}qt|t�r|�|�}|St|t�r&|\}}|�|�}|S)z�Resolve the alias based on the given data.

        This is done recursively, so if one alias resolves to a second alias,
        that second alias will also be resolved.

        :param data: the locale data
        :type data: `dict`
        )rGrr>�resolver?)rHr&�baserBrErFrrrrP�s	




�
z
Alias.resolveN)rL�
__module__�__qualname__�__doc__rIrNrPrrrrr>�s
r>c@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�LocaleDataDictzUDictionary wrapper that automatically resolves aliases to the actual
    values.
    NcCs||_|dur	|}||_dSr )�_datarQ)rHr&rQrrrrI�s
zLocaleDataDict.__init__cC�
t|j�Sr )r2rVrMrrr�__len__��
zLocaleDataDict.__len__cCrWr )�iterrVrMrrr�__iter__�rYzLocaleDataDict.__iter__cCs�|j|}}t|t�r|�|j�}t|t�r(|\}}|�|j���}t||�t|�t	ur5t
||jd�}||ur>||j|<|S�N)rQ)rVrr>rPrQr?r4r6rKr=rU)rHrB�orig�valrErFrrr�__getitem__�s



zLocaleDataDict.__getitem__cCs||j|<dSr �rV)rHrB�valuerrr�__setitem__�rJzLocaleDataDict.__setitem__cCs|j|=dSr r`)rHrBrrr�__delitem__�szLocaleDataDict.__delitem__cCst|j��|jd�Sr\)rUrVr4rQrMrrrr4�rOzLocaleDataDict.copyr )rLrRrSrTrIrXr[r_rbrcr4rrrrrU�s
rU)T)rTr�	threading�	itertoolsr�
babel._compatrrrr
�RLockr-rr�dirname�__file__rrrrr3r6�objectr>�MutableMappingrUrrrr�<module>s

7!!

Zerion Mini Shell 1.0