HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/babel/__pycache__/localedata.cpython-37.opt-1.pyc
B

�`��@s�dZddlZddlZddlZddlZddlmZddlmZm	Z	m
Z
iZe��Z
ej�ej�e�d�Ze�dej�Zdd�Zd	d
�Zdd�Zd
d�Zddd�Zdd�ZGdd�de�ZGdd�de
j�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-2021 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�N)�chain)�pickle�string_types�abczlocale-dataz%^(con|prn|aux|nul|com[0-9]|lpt[0-9])$cCsL|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_id�r
�A/opt/alt/python37/lib/python3.7/site-packages/babel/localedata.py�normalize_localesrcCsJtj�|�}tjdkr8t�tj�|�d�r8td|��tj�	t
d|�S)z?
    Resolve a locale identifier to a `.dat` path on disk.
    Zwin32rzName %s is invalid on Windowsz%s.dat)�os�path�basename�sys�platform�_windows_reserved_name_re�match�splitext�
ValueError�join�_dirname)rr
r
r�resolve_locale_filename,s rcCsB|rt|t�sdS|tkrdStj�t|��}|r6dStt|��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)	rrr
rr�existsr�boolr)rZ
file_foundr
r
rr<srcCs<ttdd�}|dkr8dd�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
)�.0Zstem�	extensionr
r
r�
<listcomp>[sz&locale_identifiers.<locals>.<listcomp>css|]}tj�|�VqdS)N)rrr)r �filenamer
r
r�	<genexpr>]sz%locale_identifiers.<locals>.<genexpr>)�getattrrr�listdirrr)�datar
r
rrKs

rTc	Cs�tj�|�}t��z�t�|�}|s�|dks0|s6i}nXddlm}|d��|�}|s�|�	d�}t
|�dkrpd}nd�|dd��}t|��
�}t|�}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����rb)rrr�_cache_lock�acquirer
�getZ
babel.corer(�split�lenr�load�copyr�open�merger�release)rZmerge_inheritedr'r(�parent�partsr#Zfileobjr
r
rr2cs.

r2cCs�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�tupler3r5)Zdict1Zdict2�keyZval2Zval1�alias�othersr
r
rr5�s"






r5c@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|�|_dS)N)r<�keys)�selfr@r
r
r�__init__�szAlias.__init__cCsdt|�j|jfS)Nz<%s %r>)�type�__name__r@)rAr
r
r�__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@rr;�resolver<)rAr'�baser=r>r?r
r
rrF�s	


z
Alias.resolveN)rD�
__module__�__qualname__�__doc__rBrErFr
r
r
rr;�sr;c@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)�_datarG)rAr'rGr
r
rrB�szLocaleDataDict.__init__cCs
t|j�S)N)r1rL)rAr
r
r�__len__�szLocaleDataDict.__len__cCs
t|j�S)N)�iterrL)rAr
r
r�__iter__�szLocaleDataDict.__iter__cCs�|j|}}t|t�r$|�|j�}t|t�rP|\}}|�|j���}t||�t|�t	krjt
||jd�}||k	r|||j|<|S)N)rG)rLrr;rFrGr<r3r5rCr:rK)rAr=Zorig�valr>r?r
r
r�__getitem__�s



zLocaleDataDict.__getitem__cCs||j|<dS)N)rL)rAr=�valuer
r
r�__setitem__�szLocaleDataDict.__setitem__cCs|j|=dS)N)rL)rAr=r
r
r�__delitem__�szLocaleDataDict.__delitem__cCst|j��|jd�S)N)rG)rKrLr3rG)rAr
r
rr3szLocaleDataDict.copy)N)rDrHrIrJrBrMrOrQrSrTr3r
r
r
rrK�s
rK)T) rJr�rerZ	threading�	itertoolsrZ
babel._compatrrrr
�RLockr-rr�dirname�__file__r�compile�Irrrrrr2r5�objectr;�MutableMappingrKr
r
r
r�<module>
s$
7!!