§
    Æªb¾  ã                   ód  — d Z ddlZddlZddlZddlZddlZddlmZ ddlm	Z	 i Z
 ej        ¦   «         Zej                             ej                             e¦  «        d¦  «        Z ej        dej        ¦  «        Zd„ Zd„ Zd	„ Zd
„ Zdd„Zd„ Z G d„ d¦  «        Z G d„ dej        ¦  «        ZdS )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)Úchainzlocale-dataz%^(con|prn|aux|nul|com[0-9]|lpt[0-9])$c                 ó  — | rt          | t          ¦  «        sdS |                      ¦   «                              ¦   «         } t	          j        t          t          ¦   «         g¦  «        D ]}| |                     ¦   «         k    r|c S ŒdS )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        dk    rOt
                               t           j                             | ¦  «        d         ¦  «        rt          d| z  ¦  «        ‚t           j         	                    t          d| z  ¦  «        S )z?
    Resolve a locale identifier to a `.dat` path on disk.
    Úwin32r   zName %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                 óâ   — | rt          | t          ¦  «        sdS | t          v rdS t          j                             t          | ¦  «        ¦  «        }|rdnt          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          dd¦  «        } | €9d„ d„ t          j        t          ¦  «        D ¦   «         D ¦   «         x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)
    ÚcacheNc                 ó0   — g | ]\  }}|d k    ¯|dk    ¯|‘Œ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| dk    s|si }n�ddlm}  |d¦  «                             | ¦  «        }|sH|  	                    d¦  «        }t          |¦  «        dk    rd}nd                     |dd…         ¦  «        }t          |¦  «                             ¦   «         }t          | ¦  «        }t          |d	¦  «        5 }| dk    r%|r#t!          |t#          j        |¦  «        ¦  «         nt#          j        |¦  «        }ddd¦  «         n# 1 swxY w Y   |t
          | <   |t                               ¦   «          S # t                               ¦   «          w xY w)
ae  Load 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
    r'   r   )Ú
get_globalÚparent_exceptionsÚ_é   NéÿÿÿÿÚrb)r   r   r   Ú_cache_lockÚacquirer   ÚgetÚ
babel.corer5   ÚsplitÚlenr   ÚloadÚcopyr   ÚopenÚmergeÚpickleÚrelease)r   Úmerge_inheritedr3   r5   ÚparentÚpartsr/   Úfileobjs           r   rA   rA   b   sÍ  € õ2 Œ7×Ò˜DÑ!Ô!€DÝ×ÒÑÔÐðÝ�zŠz˜$ÑÔˆØñ 	 à�vŠ~ˆ~ _ˆ~Ø��à1Ð1Ð1Ð1Ð1Ð1Ø#˜Ð$7Ñ8Ô8×<Ò<¸TÑBÔB�Øð 6Ø ŸJšJ s™OœO�EÝ˜5‘z”z Q’�Ø!'˜˜à!$§¢¨%°°°¬*Ñ!5Ô!5˜Ý˜F‘|”|×(Ò(Ñ*Ô*�Ý.¨tÑ4Ô4ˆHÝ�h Ñ%Ô%ð 0¨Ø˜6’>�> o�>Ý˜$¥¤¨GÑ 4Ô 4Ñ5Ô5Ð5Ð5å!œ; wÑ/Ô/�Dð	0ð 0ð 0ñ 0ô 0ð 0ð 0ð 0ð 0ð 0ð 0øøøð 0ð 0ð 0ð 0ð
  �F�4‰LØå×ÒÑÔÐÐø�×ÒÑÔÐÐøøøs1   ºCF ÄA EÅF ÅE Å F Å#E Å$F ÆF'c                 ó¬  — |                      ¦   «         D ]¾\  }}|�·|                      |¦  «        }t          |t          ¦  «        r†|€i }t          |t          ¦  «        r||f}njt          |t
          ¦  «        r.|\  }}|                     ¦   «         }t          ||¦  «         ||f}n'|                     ¦   «         }t          ||¦  «         n|}|| |<   Œ¿dS )an  Merge 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ÚtuplerB   rD   )Údict1Údict2ÚkeyÚval2Úval1ÚaliasÚotherss          r   rD   rD   ™   sé   € ð —[’[‘]”]ð ð ‰	ˆˆTØÐØ—9’9˜S‘>”>ˆDÝ˜$¥Ñ%Ô%ð Ø�<Ø�DÝ˜d¥EÑ*Ô*ð 	&Ø  $˜<�D�DÝ ¥eÑ,Ô,ð &Ø$(‘M�E˜6Ø#Ÿ[š[™]œ]�FÝ˜& $Ñ'Ô'Ð'Ø! 6˜?�D�DàŸ9š9™;œ;�DÝ˜$ Ñ%Ô%Ð%Ð%à�ØˆE�#‰Jøð%ð r   c                   ó$   — e Zd ZdZd„ Zd„ Zd„ ZdS )rN   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`.
    c                 ó.   — t          |¦  «        | _        d S r.   )rO   Úkeys)ÚselfrY   s     r   Ú__init__zAlias.__init__Á   s   € Ý˜$‘K”KˆŒ	ˆ	ˆ	r   c                 óB   — dt          | ¦  «        j        ›d| j        ›d�S )Nú<ú ú>)ÚtypeÚ__name__rY   ©rZ   s    r   Ú__repr__zAlias.__repr__Ä   s$   € € Ý  ™JœJÔ/Ð/Ð/°´°°Ð;Ð;r   c                 óâ   — |}| j         D ]
}||         }Œt          |t          ¦  «        r|                     |¦  «        }n/t          |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`
        )rY   r   rN   ÚresolverO   )rZ   r3   ÚbaserR   rU   rV   s         r   re   zAlias.resolveÇ   s{   € ð ˆØ”9ð 	ð 	ˆCØ˜”9ˆDˆDÝ�d�EÑ"Ô"ð 	'Ø—<’< Ñ%Ô%ˆDˆDÝ˜�eÑ$Ô$ð 	'Ø ‰MˆE�6Ø—=’= Ñ&Ô&ˆDØˆr   N)ra   Ú
__module__Ú__qualname__Ú__doc__r[   rc   re   r(   r   r   rN   rN   º   sK   € € € € € ðð ð ð  ð  ð<ð <ð <ðð ð ð ð r   rN   c                   ó>   — e Zd ZdZd
d„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
dS )ÚLocaleDataDictzUDictionary wrapper that automatically resolves aliases to the actual
    values.
    Nc                 ó*   — || _         |€|}|| _        d S r.   )Ú_datarf   )rZ   r3   rf   s      r   r[   zLocaleDataDict.__init__à   s   € ØˆŒ
Øˆ<ØˆDØˆŒ	ˆ	ˆ	r   c                 ó*   — t          | j        ¦  «        S r.   )r@   rm   rb   s    r   Ú__len__zLocaleDataDict.__len__æ   s   € Ý�4”:‰ŒÐr   c                 ó*   — t          | j        ¦  «        S r.   )Úiterrm   rb   s    r   Ú__iter__zLocaleDataDict.__iter__é   s   € Ý�D”JÑÔÐr   c                 ó¢  — | j         |         x}}t          |t          ¦  «        r|                     | j        ¦  «        }t          |t
          ¦  «        rA|\  }}|                     | j        ¦  «                             ¦   «         }t          ||¦  «         t          |¦  «        t          u rt          || j        ¬¦  «        }||ur
|| j         |<   |S ©N)rf   )rm   r   rN   re   rf   rO   rB   rD   r`   rM   rk   )rZ   rR   ÚorigÚvalrU   rV   s         r   Ú__getitem__zLocaleDataDict.__getitem__ì   s¿   € Ø”Z ”_Ð$ˆˆsÝ�c�5Ñ!Ô!ð 	)Ø—+’+˜dœiÑ(Ô(ˆCÝ�c�5Ñ!Ô!ð 	Ø‰MˆE�6Ø—-’- ¤	Ñ*Ô*×/Ò/Ñ1Ô1ˆCÝ�#�vÑÔÐÝ�‰9Œ9�ÐÐÝ  ¨4¬9Ð5Ñ5Ô5ˆCØ�dˆ?ˆ?Ø!ˆDŒJ�s‰OØˆ
r   c                 ó   — || j         |<   d S r.   ©rm   )rZ   rR   Úvalues      r   Ú__setitem__zLocaleDataDict.__setitem__ú   s   € ØˆŒ
�3‰ˆˆr   c                 ó   — | j         |= d S r.   ry   )rZ   rR   s     r   Ú__delitem__zLocaleDataDict.__delitem__ý   s   € ØŒJ�sˆOˆOˆOr   c                 ó\   — t          | j                             ¦   «         | j        ¬¦  «        S rt   )rk   rm   rB   rf   rb   s    r   rB   zLocaleDataDict.copy   s#   € Ý˜dœjŸošoÑ/Ô/°d´iÐ@Ñ@Ô@Ð@r   r.   )ra   rg   rh   ri   r[   ro   rr   rw   r{   r}   rB   r(   r   r   rk   rk   Û   s‘   € € € € € ðð ðð ð ð ðð ð ð ð  ð  ðð ð ð ð  ð  ðð ð ðAð Að Að Að Ar   rk   )T)ri   rE   r   Úrer   Ú	threadingÚcollectionsr   Ú	itertoolsr   r   ÚRLockr;   r   r   ÚdirnameÚ__file__r   ÚcompileÚIr   r   r   r!   r   rA   rD   rN   ÚMutableMappingrk   r(   r   r   ú<module>r‰      s…  ððð ð €€€Ø 	€	€	€	Ø 	€	€	€	Ø 
€
€
€
Ø Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ð 
€ØˆiŒoÑÔ€ØŒ7�<Š<˜œŸš¨Ñ1Ô1°=ÑAÔA€Ø&˜BœJÐ'NÐPRÔPTÑUÔUÐ ðð ð ð3ð 3ð 3ð @ð @ð @ðð ð ð04ð 4ð 4ð 4ðnð ð ðBð ð ð ð ñ ô ð ðB&Að &Að &Að &Að &A�SÔ'ñ &Aô &Að &Að &Að &Ar   