�
ƪb� � �d � d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z i Z
ej � � Zej
� ej
� e� � d� � Z ej dej � � Zd� Zd� Zd � Zd
� Zdd�Zd
� Z G d� d� � Z G d� 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-2022 by the Babel Team.
:license: BSD, see LICENSE for more details.
� N)�abc)�chainzlocale-dataz%^(con|prn|aux|nul|com[0-9]|lpt[0-9])$c � � | rt | t � � sdS | � � � � � � } t j t t � � g� � D ]}| |� � � k r|c S �dS )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)�
isinstance�str�strip�lowerr �
from_iterable�_cache�locale_identifiers)�name� locale_ids �2/usr/lib/python3/dist-packages/babel/localedata.py�normalize_localer s� � � � �z�$��,�,� ��t��:�:�<�<�����D��(�&�2D�2F�2F�)G�H�H� � � ��9�?�?�$�$�$�$����� %�� � c �N � t j � | � � } t j dk rOt
� t j � | � � d � � rt d| z � � �t j � t d| z � � S )z?
Resolve a locale identifier to a `.dat` path on disk.
�win32r zName %s is invalid on Windowsz%s.dat)�os�path�basename�sys�platform�_windows_reserved_name_re�match�splitext�
ValueError�join�_dirname)r
s r �resolve_locale_filenamer + s� � � �7���D�!�!�D� �|�w���#<�#B�#B�2�7�CS�CS�TX�CY�CY�Z[�C\�#]�#]���8�4�?�@�@�@� �7�<�<��(�T�/�2�2�2r c �� � | rt | t � � sdS | t v rdS t j � t
| � � � � }|rdnt 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) r r r r r �existsr �boolr )r
�
file_founds r r! r! ; sl � � � �z�$��,�,� ��u��v�~�~��t����� 7�� =� =�>�>�J��?�4�4�4�(8��(>�(>�#?�#?�?r c � � t t dd� � } | �9d� d� t j t � � D � � D � � xt _ } | 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)
�cacheNc �0 � g | ]\ }}|d k �|dk �|��S )z.dat�root� )�.0�stem� extensions r �
<listcomp>z&locale_identifiers.<locals>.<listcomp>Y s9 � � +
� +
� +
���i��F�"�"�t�v�~�~�
� (6�~�~r c 3 �T K � | ]#}t j � |� � V � �$d S �N)r r r )r) �filenames r � <genexpr>z%locale_identifiers.<locals>.<genexpr>\ s2 � � � �M�M�H�R�W�
�
�h�
'�
'�M�M�M�M�M�Mr )�getattrr r �listdirr r% )�datas r r r J sf � � �%�w��5�5�D��|�+
� +
�
N�M��
�8�8L�8L�M�M�M�+
� +
� +
�
�� �4� �Kr Tc �T � t j � | � � } t � � � t
� | � � }|�s| dk s|si }n�ddlm} |d� � � | � � }|sH| � d� � }t |� � dk rd}nd� |dd� � � }t |� � �
� � }t | � � }t |d � � 5 }| dk r%|r#t! |t# j |� � � � nt# j |� � }ddd� � n# 1 swxY w Y |t
| < |