%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/babel/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/babel/__pycache__/localedata.cpython-37.pyc

B

1P�Y[�@s�dZddlZddlZddlmZddlmZddlZddlm	Z	m
Z
dd�ZiZe�
�Zej�e�d�Zd	d
�Zdd�Zd
d�Zddd�Zdd�ZGdd�de�ZGdd�de�ZdS)aB
    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 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�N)�MutableMapping)�chain)�pickle�string_typescCs0ttdd�r ttdd�r tj}ntj�t�}|S)N�frozenF�_MEIPASS)�getattr�sysr�os�path�dirname�__file__)Zbasedir�r�A/opt/alt/python37/lib/python3.7/site-packages/babel/localedata.py�get_base_dirsrzlocale-datacCsL|rt|t�sdS|����}x(t�tt�g�D]}||��kr0|Sq0WdS)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)�nameZ	locale_idrrr�normalize_locale&srcCsL|rt|t�sdS|tkrdStj�tj�td|��}|r@dStt	|��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
    FTz%s.dat)
rrrr
r�exists�join�_dirname�boolr)rZ
file_foundrrrr4srcCsdd�dd�t�t�D�D�S)z�Return a list of all locale identifiers for which locale data is
    available.

    .. versionadded:: 0.8.1

    :return: a list of locale identifiers (strings)
    cSs$g|]\}}|dkr|dkr|�qS)z.dat�rootr)�.0Zstem�	extensionrrr�
<listcomp>Ksz&locale_identifiers.<locals>.<listcomp>cSsg|]}tj�|��qSr)r
r�splitext)r�filenamerrrr Ls)r
�listdirrrrrrrCsrTc	Cs�t��z�t�|�}|s�|dks$|s*i}nXddlm}|d��|�}|sv|�d�}t|�dkrdd}nd�|dd��}t	|��
�}tj�t
d	|�}t|d
��.}|dkr�|r�t|t�	|��n
t�	|�}WdQRX|t|<|St��XdS)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_globalZparent_exceptions�_�N���z%s.dat�rb)�_cache_lock�acquirer�getZ
babel.corer$�split�lenr�load�copyr
rr�open�merger�release)rZmerge_inherited�datar$�parent�partsr"Zfileobjrrrr.Ps,

r.cCs�x�|��D]�\}}|dk	r
|�|�}t|t�r�|dkr:i}t|t�rN||f}q�t|t�r||\}}|��}t||�||f}q�|��}t||�n|}|||<q
WdS)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�tupler/r1)Zdict1Zdict2�keyZval2Zval1�alias�othersrrrr1�s"






r1c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r8z�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|�|_dS)N)r9�keys)�selfr=rrr�__init__�szAlias.__init__cCsdt|�j|jfS)Nz<%s %r>)�type�__name__r=)r>rrr�__repr__�szAlias.__repr__cCsR|}x|jD]}||}qWt|t�r2|�|�}nt|t�rN|\}}|�|�}|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`
        )r=rr8�resolver9)r>r3�baser:r;r<rrrrC�s	


z
Alias.resolveN)rA�
__module__�__qualname__�__doc__r?rBrCrrrrr8�sr8c@sJeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�LocaleDataDictzUDictionary wrapper that automatically resolves aliases to the actual
    values.
    NcCs||_|dkr|}||_dS)N)�_datarD)r>r3rDrrrr?�szLocaleDataDict.__init__cCs
t|j�S)N)r-rI)r>rrr�__len__�szLocaleDataDict.__len__cCs
t|j�S)N)�iterrI)r>rrr�__iter__�szLocaleDataDict.__iter__cCs�|j|}}t|t�r$|�|j�}t|t�rP|\}}|�|j���}t||�t|�t	krjt
||jd�}||k	r|||j|<|S)N)rD)rIrr8rCrDr9r/r1r@r7rH)r>r:Zorig�valr;r<rrr�__getitem__�s



zLocaleDataDict.__getitem__cCs||j|<dS)N)rI)r>r:�valuerrr�__setitem__�szLocaleDataDict.__setitem__cCs|j|=dS)N)rI)r>r:rrr�__delitem__�szLocaleDataDict.__delitem__cCst|j��|jd�S)N)rD)rHrIr/rD)r>rrrr/�szLocaleDataDict.copy)N)rArErFrGr?rJrLrNrPrQr/rrrrrH�s
rH)T)rGr
Z	threading�collectionsr�	itertoolsrr	Z
babel._compatrrrr�RLockr)rrrrrrr.r1�objectr8rHrrrr�<module>
s"	
6!!

Zerion Mini Shell 1.0