Ë
    Æªb¾  ã                   óv  — 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                  j                  ej                  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j8                  «      Zy)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y| j                  «       j                  «       } t	        j
                  t        t        «       g«      D ]  }| |j                  «       k(  sŒ|c S  y)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 $¬Ô,ØØ�:‰:‹<×ÑÓ€DÜ×(Ñ(¬&Ô2DÓ2FÐ)GÓHò ˆ	Ø�9—?‘?Ó$Ó$ØÒñó    c                 ó:  — t         j                  j                  | «      } t        j                  dk(  rCt
        j                  t         j                  j                  | «      d   «      rt        d| z  «      ‚t         j                  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   +   sv   € ô �7‰7×Ñ˜DÓ!€Dô ‡|�|�wÒÔ#<×#BÑ#BÄ2Ç7Á7×CSÑCSÐTXÓCYÐZ[ÑC\Ô#]ÜÐ8¸4Ñ?Ó@Ð@ô �7‰7�<‰<œ (¨T¡/Ó2Ð2r   c                 óº   — | rt        | t        «      sy| t        v ryt        j                  j                  t        | «      «      }|rdS 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!   ;   sM   € ñ ”z $¬Ô,ØØŒv�~ØÜ—‘—‘Ô 7¸Ó =Ó>€JÙˆ4Ð?¤4Ô(8¸Ó(>Ó#?Ð?r   c                  óÈ   — t        t        dd«      } | €Hd„ t        j                  t        «      D «       D ��cg c]  \  }}|dk(  r|dk7  r|‘Œ c}}xt        _        } | S c c}}w )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              3   óZ   K  — | ]#  }t         j                  j                  |«      –— Œ% y ­w©N)r   r   r   )Ú.0Úfilenames     r   ú	<genexpr>z%locale_identifiers.<locals>.<genexpr>\   s   è ø€ ÒM¨HŒR�W‰W×Ñ˜h×'ÑMùs   ‚)+z.datÚroot)Úgetattrr   r   Úlistdirr   r%   )ÚdataÚstemÚ	extensions      r   r   r   J   sj   € ô Ô% w°Ó5€DØ€|ñ N¼¿
¹
Ä8Ó8LÔM÷+
á��ià˜FÒ" t¨v¢~ò ó+
ð 	
ÔÔ  4ð €Kùó+
s   ·Ac                 óÈ  — t         j                  j                  | «      } t        j	                  «        	 t
        j                  | «      }|sÝ| dk(  s|si }nnddlm}  |d«      j                  | «      }|s6| j                  d«      }t        |«      dk(  rd}ndj                  |dd «      }t        |«      j                  «       }t        | «      }t        |d	«      5 }| dk7  r"|r t!        |t#        j                  |«      «       nt#        j                  |«      }ddd«       |t
        | <   |t        j%                  «        S # 1 sw Y   Œ(xY w# t        j%                  «        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.corer2   ÚsplitÚlenr   ÚloadÚcopyr   ÚopenÚmergeÚpickleÚrelease)r   Úmerge_inheritedr.   r2   ÚparentÚpartsr)   Úfileobjs           r   r>   r>   b   s%  € ô2 �7‰7×Ñ˜DÓ!€DÜ×ÑÔðÜ�z‰z˜$ÓˆÙà�vŠ~¡_Ø‘å1Ù#Ð$7Ó8×<Ñ<¸TÓB�ÙØ ŸJ™J s›O�EÜ˜5“z Q’Ø!'™à!$§¡¨%°°¨*Ó!5˜Ü˜F“|×(Ñ(Ó*�Ü.¨tÓ4ˆHÜ�h Ó%ð 0¨Ø˜6’>¡oÜ˜$¤§¡¨GÓ 4Õ5ä!Ÿ;™; wÓ/�D÷	0ð
  ŒF�4‰LØä×ÑÕ÷0ð 0ûô 	×ÑÕús$   µB&E Ã=D?ÄE Ä?EÅE ÅE!c                 ób  — |j                  «       D ]œ  \  }}|€Œ	| j                  |«      }t        |t        «      rl|€i }t        |t        «      r||f}nUt        |t
        «      r&|\  }}|j                  «       }t        ||«       ||f}n|j                  «       }t        ||«       n|}|| |<   Œž y)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Útupler?   rA   )Údict1Údict2ÚkeyÚval2Úval1ÚaliasÚotherss          r   rA   rA   ™   s«   € ð —[‘[“]ò ‰	ˆˆTØÑØ—9‘9˜S“>ˆDÜ˜$¤Ô%Ø�<Ø�DÜ˜d¤EÔ*Ø  $˜<‘DÜ ¤eÔ,Ø$(‘M�E˜6Ø#Ÿ[™[›]�FÜ˜& $Ô'Ø! 6˜?‘DàŸ9™9›;�DÜ˜$ Õ%à�ØˆE�#ŠJñ%r   c                   ó"   — e Zd ZdZd„ Zd„ Zd„ Zy)rK   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        |«      | _        y r'   )rL   Úkeys)ÚselfrV   s     r   Ú__init__zAlias.__init__Á   s   € Ü˜$“Kˆ�	r   c                 óN   — dt        | «      j                  ›d| j                  ›d�S )Nú<ú ú>)ÚtypeÚ__name__rV   ©rW   s    r   Ú__repr__zAlias.__repr__Ä   s   � Ü  ›J×/Ó/°·³Ð;Ð;r   c                 óÈ   — |}| j                   D ]  }||   }Œ	 t        |t        «      r|j                  |«      }|S t        |t        «      r|\  }}|j                  |«      }|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`
        )rV   r   rK   ÚresolverL   )rW   r.   ÚbaserO   rR   rS   s         r   rb   zAlias.resolveÇ   sl   € ð ˆØ—9‘9ò 	ˆCØ˜‘9‰Dð	ä�dœEÔ"Ø—<‘< Ó%ˆDð ˆô ˜œeÔ$Ø ‰MˆE�6Ø—=‘= Ó&ˆDØˆr   N)r^   Ú
__module__Ú__qualname__Ú__doc__rX   r`   rb   © r   r   rK   rK   º   s   „ ñò ò<ór   rK   c                   ó<   — e Zd ZdZd
d„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
y)ÚLocaleDataDictzUDictionary wrapper that automatically resolves aliases to the actual
    values.
    Nc                 ó(   — || _         |€|}|| _        y r'   )Ú_datarc   )rW   r.   rc   s      r   rX   zLocaleDataDict.__init__à   s   € ØˆŒ
Øˆ<ØˆDØˆ�	r   c                 ó,   — t        | j                  «      S r'   )r=   rk   r_   s    r   Ú__len__zLocaleDataDict.__len__æ   s   € Ü�4—:‘:‹Ðr   c                 ó,   — t        | j                  «      S r'   )Úiterrk   r_   s    r   Ú__iter__zLocaleDataDict.__iter__é   s   € Ü�D—J‘JÓÐr   c                 óˆ  — | j                   |   x}}t        |t        «      r|j                  | j                  «      }t        |t
        «      r:|\  }}|j                  | j                  «      j                  «       }t        ||«       t        |«      t        u rt        || j                  ¬«      }||ur|| j                   |<   |S ©N)rc   )rk   r   rK   rb   rc   rL   r?   rA   r]   rJ   ri   )rW   rO   ÚorigÚvalrR   rS   s         r   Ú__getitem__zLocaleDataDict.__getitem__ì   s�   € Ø—Z‘Z ‘_Ð$ˆˆsÜ�cœ5Ô!Ø—+‘+˜dŸi™iÓ(ˆCÜ�cœ5Ô!Ø‰MˆE�6Ø—-‘- §	¡	Ó*×/Ñ/Ó1ˆCÜ�#�vÔÜ�‹9œÑÜ  ¨4¯9©9Ô5ˆCØ�d‰?Ø!ˆD�J‰J�s‰OØˆ
r   c                 ó"   — || j                   |<   y r'   ©rk   )rW   rO   Úvalues      r   Ú__setitem__zLocaleDataDict.__setitem__ú   s   € Øˆ�
‰
�3Šr   c                 ó   — | j                   |= y r'   rw   )rW   rO   s     r   Ú__delitem__zLocaleDataDict.__delitem__ý   s   € Ø�J‰J�s‰Or   c                 ó`   — t        | j                  j                  «       | j                  ¬«      S rr   )ri   rk   r?   rc   r_   s    r   r?   zLocaleDataDict.copy   s   € Ü˜dŸj™jŸo™oÓ/°d·i±iÔ@Ð@r   r'   )r^   rd   re   rf   rX   rm   rp   ru   ry   r{   r?   rg   r   r   ri   ri   Û   s+   „ ñóòò òò òóAr   ri   )T)rf   rB   r   Úrer   Ú	threadingÚcollectionsr   Ú	itertoolsr   r   ÚRLockr8   r   r   ÚdirnameÚ__file__r   ÚcompileÚIr   r   r   r!   r   r>   rA   rK   ÚMutableMappingri   rg   r   r   ú<module>r‡      s²   ðñó Û 	Û 	Û 
Û Ý Ý ð 
€Øˆi�o‰oÓ€Ø�7‰7�<‰<˜Ÿ™Ÿ™¨Ó1°=ÓA€Ø&˜BŸJ™JÐ'NÐPR×PTÑPTÓUÐ òò3ò @òó04òn÷Bñ ôB&A�S×'Ñ'õ &Ar   