HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/babel/__pycache__/localedata.cpython-310.pyc
o

!we/ �@s"UdZddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
ddlmZddlmZddlmZiZd	ed
<e��Zej�ej�e�d�Ze�dej�Zd,dd�Z d-dd�Z!d.dd�Z"edd�d/dd��Z#d0d1dd �Z$d2d&d'�Z%Gd(d)�d)�Z&Gd*d+�d+e	j
�Z'dS)3aG
    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-2023 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�)�annotationsN)�abc)�Iterator�Mapping�MutableMapping)�	lru_cache)�chain)�Any�dict[str, Any]�_cachezlocale-dataz%^(con|prn|aux|nul|com[0-9]|lpt[0-9])$�name�str�return�
str | NonecCsL|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_iterabler�locale_identifiers)r�	locale_id�r�I/home/arjun/projects/env/lib/python3.10/site-packages/babel/localedata.py�normalize_locale!s��r�os.PathLike[str] | strcCsPtj�|�}tjdkrt�tj�|�d�rtd|�d���tj�	t
|�d��S)z?
    Resolve a locale identifier to a `.dat` path on disk.
    �win32rzName z is invalid on Windows�.dat)�os�path�basename�sys�platform�_windows_reserved_name_re�match�splitext�
ValueError�join�_dirname)rrrr�resolve_locale_filename/s r'�boolcCsB|rt|t�s	dS|tvrdStj�t|��}|rdStt|��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)	rr
rrr�existsr'r(r)r�
file_foundrrrr)?sr))�maxsize�	list[str]cCsdd�dd�t�t�D�D�S)a&Return a list of all locale identifiers for which locale data is
    available.

    This data is cached after the first invocation.
    You can clear the cache by calling `locale_identifiers.cache_clear()`.

    .. versionadded:: 0.8.1

    :return: a list of locale identifiers (strings)
    cSs$g|]\}}|dkr|dkr|�qS)r�rootr)�.0�stem�	extensionrrr�
<listcomp>Zs
�z&locale_identifiers.<locals>.<listcomp>css�|]	}tj�|�VqdS�N)rrr#)r.�filenamerrr�	<genexpr>]s�z%locale_identifiers.<locals>.<genexpr>)r�listdirr&rrrrrNs�rT�merge_inheritedcCstj�|�}t��zst�|�}|sw|dks|si}n+ddlm}|d��|�}|s@|�	d�}t
|�dkr7dnd�|dd��}t|��
�}t|�}t|d	��}|dkr_|r_t|t�|��nt�|�}Wd�n1snwY|t|<|Wt��St��w)
afLoad 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
                      identifier, or one of the locales it inherits from
    r-r)�
get_global�parent_exceptions�_�N����rb)rrr�_cache_lock�acquirer�get�
babel.corer7�split�lenr%�load�copyr'�open�merge�pickle�release)rr6�datar7�parent�partsr3�fileobjrrrrCbs.

"
��rC�dict1�MutableMapping[Any, Any]�dict2�Mapping[Any, Any]�NonecCs�|��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�tuplerDrF)rMrO�key�val2�val1�alias�othersrrrrF�s&






��rFc@s.eZdZdZddd�Zdd	d
�Zdd
d�ZdS)rTz�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`.
    �keys�tuple[str, ...]rrQcCst|�|_dSr2)rUr[)�selfr[rrr�__init__��zAlias.__init__r
cCsdt|�j�d|j�d�S)N�<� �>)�type�__name__r[�r]rrr�__repr__�szAlias.__repr__rI�Mapping[str | int | None, Any]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`
        )r[rrT�resolverU)r]rI�baserVrYrZrrrrh�s	




�
z
Alias.resolveN)r[r\rrQ)rr
)rIrgrrg)rd�
__module__�__qualname__�__doc__r^rfrhrrrrrT�s


rTc@sXeZdZdZdddd�Zddd�Zd dd�Zd!dd�Zd"dd�Zd#dd�Z	d$dd�Z
dS)%�LocaleDataDictzUDictionary wrapper that automatically resolves aliases to the actual
    values.
    NrI�%MutableMapping[str | int | None, Any]ri�%Mapping[str | int | None, Any] | NonecCs||_|dur	|}||_dSr2)�_datari)r]rIrirrrr^�s
zLocaleDataDict.__init__r�intcC�
t|j�Sr2)rBrprerrr�__len__��
zLocaleDataDict.__len__�Iterator[str | int | None]cCrrr2)�iterrprerrr�__iter__�rtzLocaleDataDict.__iter__rV�str | int | Noner	cCs~|j|}}t|t�r|�|j�}t|t�r(|\}}|�|j���}t||�t|t�r4t	||jd�}||ur=||j|<|S�N)ri)
rprrTrhrirUrDrFrSrm)r]rV�orig�valrYrZrrr�__getitem__�s




zLocaleDataDict.__getitem__�valuerQcCs||j|<dSr2�rp)r]rVr}rrr�__setitem__�r_zLocaleDataDict.__setitem__cCs|j|=dSr2r~)r]rVrrr�__delitem__�szLocaleDataDict.__delitem__cCst|j��|jd�Sry)rmrprDrirerrrrD�szLocaleDataDict.copyr2)rIrnriro)rrq)rru)rVrxrr	)rVrxr}r	rrQ)rVrxrrQ)rrm)rdrjrkrlr^rsrwr|rr�rDrrrrrm�s




rm)rr
rr)rrrr
)rr
rr()rr,)T)rrr6r(rr
)rMrNrOrPrrQ)(rl�
__future__rrrG�rer�	threading�collectionsr�collections.abcrrr�	functoolsr�	itertoolsr�typingr	r�__annotations__�RLockr=rr%�dirname�__file__r&�compile�Ir!rr'r)rrCrFrTrmrrrr�<module>s2




4!!