
    ̆h;                    6   % S r SSKJr  SSKrSSKrSSKJrJr  SSKJ	r	J
r
Jr  SSKJr  SSKJr  / SQr\	(       a  SS	KJr  \S
   rS\S'   S\S'   Sq\" 0 5      rS rSdS jr0 SS_SS_SS_SS_SS_SS_SS_SS _S!S"_S#S$_S%S&_S'S(_S)S*_S+S,_S-S._S/S0_S1S2_0 S3S4_S5S6_S7S8_S9S:_S;S<_S=S>_S?S@_SASB_SCSD_SESF_SGSH_SISJ_SKSL_SMSN_SOSP_SQSR_SSST_ESUSVSWSXSYSZ.Er " S[ S\\5      r " S] S^5      rS\4     SeS_ jjrS`\4SfSa jjr Sg     ShSb jjr Sg     SiSc jjr g)jz
babel.core
~~~~~~~~~~

Core locale representation and locale data access.

:copyright: (c) 2013-2025 by the Babel Team.
:license: BSD, see LICENSE for more details.
    )annotationsN)IterableMapping)TYPE_CHECKINGAnyLiteral)
localedata)
PluralRule)LocaleUnknownLocaleErrordefault_locale
get_globalget_locale_identifiernegotiate_localeparse_locale)	TypeAlias)all_currenciescurrency_fractionslanguage_aliaseslikely_subtags
meta_zonesparent_exceptionsscript_aliasesterritory_aliasesterritory_currenciesterritory_languagesterritory_zonesvariant_aliaseswindows_zone_mappingzone_aliaseszone_territoriesr   _GLOBAL_KEYz.Mapping[_GLOBAL_KEY, Mapping[str, Any]] | None_global_datac                     [        S5      e)NzThe babel data files are not available. This usually happens because you are using a source checkout from Babel and you did not build the data files.  Just make sure to run "python setup.py import_cldr" before installing the library.)RuntimeError     B/opt/services/DDDS/venv/lib/python3.13/site-packages/babel/core.py_raise_no_data_errorr)   :   s    
 1 2 2r'   c                   [         c  [        R                  R                  [        R                  R	                  [
        5      5      n[        R                  R                  US5      n[        R                  R                  U5      (       d
  [        5         [        US5       n[        R                  " U5      q [         c   e SSS5        [         R                  U 0 5      $ ! , (       d  f       N$= f)a  Return the dictionary for the given key in the global data.

The global data is stored in the ``babel/global.dat`` file and contains
information independent of individual locales.

>>> get_global('zone_aliases')['UTC']
u'Etc/UTC'
>>> get_global('zone_territories')['Europe/Berlin']
u'DE'

The keys available are:

- ``all_currencies``
- ``currency_fractions``
- ``language_aliases``
- ``likely_subtags``
- ``parent_exceptions``
- ``script_aliases``
- ``territory_aliases``
- ``territory_currencies``
- ``territory_languages``
- ``territory_zones``
- ``variant_aliases``
- ``windows_zone_mapping``
- ``zone_aliases``
- ``zone_territories``

.. note:: The internal structure of the data may change between versions.

.. versionadded:: 0.9

:param key: the data key
Nz
global.datrb)r#   ospathjoindirname__file__isfiler)   openpickleloadget)keyr/   filenamefileobjs       r(   r   r   C   s    F '',,rwwx8977<<6ww~~h'' "(D!W!;;w/L+++ " C$$ "!s   " C!!
C/arar_SYbgbg_BGbsbs_BAcaca_EScscs_CZdada_DKdede_DEelel_GRenen_USeses_ESetet_EEfafa_IRfifi_FIfrfr_FRglgl_EShehe_ILhuhu_HUidid_IDisis_ISitit_ITjaja_JPkmkm_KHkoko_KRltlt_LTlvlv_LVmkmk_MKnlnl_NLnnnn_NOnonb_NOplpl_PLptpt_PTroro_ROruru_RUsksk_SKsl_SIsv_SEth_THtr_TRuk_UA)slsvthtrukc                  "    \ rS rSrSrSS jrSrg)r   }   zSException thrown when a locale is requested for which no locale data
is available.
c                D    [         R                  U SU< 35        Xl        g)zZCreate the exception.

:param identifier: the identifier string of the unsupported locale
zunknown locale N)	Exception__init__
identifier)selfr   s     r(   r   UnknownLocaleError.__init__   s"    
 	4?:.!AB %r'   )r   N)r   strreturnNone)__name__
__module____qualname____firstlineno____doc__r   __static_attributes__r&   r'   r(   r   r   }   s    %r'   r   c                     \ rS rSrSr    SC           SDS jjr\S\4SES jj5       r\S\4         SFS jj5       r	\  SG       SHS jj5       r
SIS	 jrSIS
 jrSJS jrSKS jrSKS jr\SLS j5       rSMSNS jjr\" \SS9rSMSNS jjr\" \SS9rSMSNS jjr\" \SS9rSMSNS jjr\" \SS9r\SOS j5       r\SLS j5       r\SLS j5       r\SLS j5       r\SLS j5       r\SLS j5       r\SLS j5       r \SLS j5       r!\SLS  j5       r"\SKS! j5       r#\SLS" j5       r$\SLS# j5       r%\SLS$ j5       r&\SLS% j5       r'\SLS& j5       r(\SLS' j5       r)\SLS( j5       r*\SLS) j5       r+\SLS* j5       r,\SLS+ j5       r-\SLS, j5       r.\SLS- j5       r/\SLS. j5       r0\SLS/ j5       r1\SLS0 j5       r2\SLS1 j5       r3\SJS2 j5       r4\SJS3 j5       r5\SJS4 j5       r6\SJS5 j5       r7\SLS6 j5       r8\SLS7 j5       r9\SLS8 j5       r:\SLS9 j5       r;\SLS: j5       r<\SPS; j5       r=\SLS< j5       r>\SPS= j5       r?\SLS> j5       r@\SKS? j5       rA\SKS@ j5       rB\SLSA j5       rCSBrDg)Qr      a  Representation of a specific locale.

>>> locale = Locale('en', 'US')
>>> repr(locale)
"Locale('en', territory='US')"
>>> locale.display_name
u'English (United States)'

A `Locale` object can also be instantiated from a raw locale string:

>>> locale = Locale.parse('en-US', sep='-')
>>> repr(locale)
"Locale('en', territory='US')"

`Locale` objects provide access to a collection of locale data, such as
territory and language names, number and date format patterns, and more:

>>> locale.number_symbols['latn']['decimal']
u'.'

If a locale is requested for which no locale data is available, an
`UnknownLocaleError` is raised:

>>> Locale.parse('en_XX')
Traceback (most recent call last):
    ...
UnknownLocaleError: unknown locale 'en_XX'

For more information see :rfc:`3066`.
Nc                (   Xl         X l        X0l        X@l        XPl        SU l        [        U 5      nUR                  S5      S   n[        R                  " U5      (       a  X`l
        g[        R                  " U5      (       a  Xpl
        g[        U5      e)a  Initialize the locale object from the given identifier components.

>>> locale = Locale('en', 'US')
>>> locale.language
'en'
>>> locale.territory
'US'

:param language: the language code
:param territory: the territory (country or region) code
:param script: the script code
:param variant: the variant code
:param modifier: a modifier (following the '@' symbol, sometimes called '@variant')
:raise `UnknownLocaleError`: if no locale data is available for the
                             requested locale
N@r   )language	territoryscriptvariantmodifier_Locale__datar   	partitionr	   exists_Locale__data_identifierr   )r   r   r   r   r   r   r   identifier_without_modifiers           r(   r   Locale.__init__   s}    2 !" 8<Y
&0&:&:3&?&B#Z((%/":;;%@"$Z00r'   c                6    [        XS9nU R                  U5      $ )a  Return the system default locale for the specified category.

>>> for name in ['LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LC_MESSAGES']:
...     os.environ[name] = ''
>>> os.environ['LANG'] = 'fr_FR.UTF-8'
>>> Locale.default('LC_MESSAGES')
Locale('fr', territory='FR')

The following fallbacks to the variable are always considered:

- ``LANGUAGE``
- ``LC_ALL``
- ``LC_CTYPE``
- ``LANG``

:param category: one of the ``LC_XXX`` environment variable names
:param aliases: a dictionary of aliases for locale identifiers
)aliases)r   parse)clscategoryr   locale_strings       r(   defaultLocale.default   s    , 'xAyy''r'   _c                N    [        XUUS9nU(       a  [        R                  XSS9$ g)a>  Find the best match between available and requested locale strings.

>>> Locale.negotiate(['de_DE', 'en_US'], ['de_DE', 'de_AT'])
Locale('de', territory='DE')
>>> Locale.negotiate(['de_DE', 'en_US'], ['en', 'de'])
Locale('de')
>>> Locale.negotiate(['de_DE', 'de'], ['en_US'])

You can specify the character used in the locale identifiers to separate
the different components. This separator is applied to both lists. Also,
case is ignored in the comparison:

>>> Locale.negotiate(['de-DE', 'de'], ['en-us', 'de-de'], sep='-')
Locale('de', territory='DE')

:param preferred: the list of locale identifiers preferred by the user
:param available: the list of locale identifiers available
:param aliases: a dictionary of aliases for locale identifiers
:param sep: separator for parsing; e.g. Windows tends to use '-' instead of '_'.
)sepr   r   N)r   r   r   )r   	preferred	availabler   r   r   s         r(   	negotiateLocale.negotiate   s,    8 &i.57
<<
<44r'   c                .  ^ ^ [        U[        5      (       a  U$ U(       d3  SU< S34n[        U[        5      (       a  [        U5      e[	        U5      e[        U[        5      (       d  [	        SU< 35      e[        XS9n[        U5      nU 4S jmU4S jnT" U5      nUb  U$ U(       d  [        U5      e[        U5      S:X  a  Uu  ppnOUu  ppSn[        S	5      R                  X5      n	[        S
5      R                  U
=(       d    SU
45      S   n
[        S5      R                  U=(       d    SU5      n[        S5      R                  U=(       d    SU5      nU
S:X  a  Sn
US:X  a  SnXXU4n[        U5      n[        S5      R                  U5      nUb  U" [        U5      5      nUb  U$ [        S5      R                  U	5      nUb>  [        U5      n[        U5      S:X  a	  Uu  nnnnnO	Uu  nnnnSnU" UU
UUU45      nUb  U$ [        U5      e)aS  Create a `Locale` instance for the given locale identifier.

>>> l = Locale.parse('de-DE', sep='-')
>>> l.display_name
u'Deutsch (Deutschland)'

If the `identifier` parameter is not a string, but actually a `Locale`
object, that object is returned:

>>> Locale.parse(l)
Locale('de', territory='DE')

If the `identifier` parameter is neither of these, such as `None`
or an empty string, e.g. because a default locale identifier
could not be determined, a `TypeError` is raised:

>>> Locale.parse(None)
Traceback (most recent call last):
    ...
TypeError: ...

This also can perform resolving of likely subtags which it does
by default.  This is for instance useful to figure out the most
likely locale for a territory you can use ``'und'`` as the
language tag:

>>> Locale.parse('und_AT')
Locale('de', territory='AT')

Modifiers are optional, and always at the end, separated by "@":

>>> Locale.parse('de_AT@euro')
Locale('de', territory='AT', modifier='euro')

:param identifier: the locale identifier string
:param sep: optional component separator
:param resolve_likely_subtags: if this is specified then a locale will
                               have its likely subtag resolved if the
                               locale otherwise does not exist.  For
                               instance ``zh_TW`` by itself is not a
                               locale that exists but Babel can
                               automatically expand it to the full
                               form of ``zh_hant_TW``.  Note that this
                               expansion is only taking place if no
                               locale exists otherwise.  For instance
                               there is a locale ``en`` that can exist
                               by itself.
:raise `ValueError`: if the string does not appear to be a valid locale
                     identifier
:raise `UnknownLocaleError`: if no locale data is available for the
                             requested locale
:raise `TypeError`: if the identifier is not a string or a `Locale`
:raise `ValueError`: if the identifier is not a valid string
zEmpty locale identifier value: z

If you didn't explicitly pass an empty value to a Babel function, this could be caused by there being no suitable locale environment variables for the API you tried to use.z!Unexpected value for identifier: r   c                0   >  T" U 6 $ ! [          a     g f = fN)r   )partsr   s    r(   	_try_loadLocale.parse.<locals>._try_loadf  s$    E{"% s    
c                @   > T" U 5      nUb  U$ T" U S S 5      nUb  U$ g )N   r&   )r   localer   s     r(   _try_load_reducing(Locale.parse.<locals>._try_load_reducingl  s:    u%F! uRay)F! "r'   N   r   r    r   r   r   ZZZzzzr   )
isinstancer   r   
ValueError	TypeErrorr   r   r   lenr   r5   )r   r   r   resolve_likely_subtagsmsgr   input_idr   r   r   r   r   r   r   new_idlikely_subtagparts2	language2r   script2variant2	modifier2r   s   `                     @r(   r   Locale.parse  s@   z j&))1* @: ;C *c** o%C. *c**?
~NOOZ1(/			 5!M%$X.. u:?=B:H(380HH0155hI2377	R)VWXY	,-11&,BG./33GMr7KIVFVh> 'u-"#3488@$'](CDF! ##3488B$!-0F6{a=C:	1gx28/	1gx 	'IwR[(\]F! **r'   c                j   S H  n[        X5      (       a  M    g   U R                  [        US5      :H  =(       ay    U R                  [        US5      :H  =(       aY    U R                  [        US5      :H  =(       a9    U R
                  [        US5      :H  =(       a    U R                  [        US5      :H  $ )N)r   r   r   r   r   Fr   r   r   r   r   )hasattrr   getattrr   r   r   r   )r   otherr6   s      r(   __eq__Locale.__eq__  s    MC5&& N MMWUJ77 8NNge[998KK75(338 LLGE9558 MMWUJ77	
r'   c                .    U R                  U5      (       + $ r   )r   )r   r   s     r(   __ne__Locale.__ne__  s    ;;u%%%r'   c                    [        U R                  U R                  U R                  U R                  U R
                  45      $ r   )hashr   r   r   r   r   r   s    r(   __hash__Locale.__hash__  s3    T]]DNNDKK\\4==2 3 	3r'   c                    S/nS H*  n[        X5      nUc  M  UR                  U SU< 35        M,     SU R                  < SR                  U5       S3$ )Nr   )r   r   r   r   =zLocale(, ))r   appendr   r.   )r   
parametersr6   values       r(   __repr__Locale.__repr__  sa    T
ACD&E !!SE5)"45 B )$))J*?)@BBr'   c                    [        U R                  U R                  U R                  U R                  U R
                  45      $ r   )r   r   r   r   r   r   r   s    r(   __str__Locale.__str__  s4    $dmmT^^&*kk4<<&*mm&5 6 	6r'   c                    U R                   c9  [        R                  " [        R                  " U R                  5      5      U l         U R                   $ r   )r   r	   LocaleDataDictr4   r   r   s    r(   _dataLocale._data  s7    ;;$33JOODDZDZ4[\DK{{r'   c                F   Uc  U n[         R                  U5      nUR                  R                  U R                  5      nU(       GaY  U R
                  (       d#  U R                  (       d  U R                  (       Ga%  / nU R                  (       a4  UR                  UR                  R                  U R                  5      5        U R
                  (       a4  UR                  UR                  R                  U R
                  5      5        U R                  (       a4  UR                  UR                  R                  U R                  5      5        U R                  (       a  UR                  U R                  5        SR                  S U 5       5      nU(       a	  USU S3-  nU$ )a  Return the display name of the locale using the given locale.

The display name will include the language, territory, script, and
variant, if those are specified.

>>> Locale('zh', 'CN', script='Hans').get_display_name('en')
u'Chinese (Simplified, China)'

Modifiers are currently passed through verbatim:

>>> Locale('it', 'IT', modifier='euro').get_display_name('en')
u'Italian (Italy, euro)'

:param locale: the locale to use
r   c              3  6   #    U  H  o(       d  M  Uv   M     g 7fr   r&   ).0atoms     r(   	<genexpr>*Locale.get_display_name.<locals>.<genexpr>  s     %Gwt$ddws   
	z (r   )r   r   	languagesr5   r   r   r   r   r   scriptsterritoriesvariantsr   r.   )r   r   retvaldetailsdetail_strings        r(   get_display_nameLocale.get_display_name  s     >Ff%!!%%dmm4t~~G{{v~~11$++>?~~v1155dnnEF||v224<<@A}}t}}- II%Gw%GGMB}oQ//r'   a          The localized display name of the locale.

        >>> Locale('en').display_name
        u'English'
        >>> Locale('en', 'US').display_name
        u'English (United States)'
        >>> Locale('sv').display_name
        u'svenska'

        :type: `unicode`
        )docc                    Uc  U n[         R                  U5      nUR                  R                  U R                  5      $ )zReturn the language of this locale in the given locale.

>>> Locale('zh', 'CN', script='Hans').get_language_name('de')
u'Chinesisch'

.. versionadded:: 1.0

:param locale: the locale to use
)r   r   r   r5   r   r   r   s     r(   get_language_nameLocale.get_language_name  s7     >Ff%##DMM22r'   zx        The localized language name of the locale.

        >>> Locale('en', 'US').language_name
        u'English'
    c                    Uc  U n[         R                  U5      nUR                  R                  U R                  =(       d    S5      $ )z.Return the territory name in the given locale.r   )r   r   r   r5   r   r  s     r(   get_territory_nameLocale.get_territory_name  s:    >Ff%!!%%dnn&:;;r'   z        The localized territory name of the locale if available.

        >>> Locale('de', 'DE').territory_name
        u'Deutschland'
    c                    Uc  U n[         R                  U5      nUR                  R                  U R                  =(       d    S5      $ )z+Return the script name in the given locale.r   )r   r   r   r5   r   r  s     r(   get_script_nameLocale.get_script_name'  s8    >Ff%~~!!$++"344r'   z        The localized script name of the locale if available.

        >>> Locale('sr', 'ME', script='Latn').script_name
        u'latinica'
    c                6    U R                  [        S5      5      $ )zThe english display name of the locale.

>>> Locale('de').english_name
u'German'
>>> Locale('de', 'DE').english_name
u'German (Germany)'

:type: `unicode`rI   )r   r   r   s    r(   english_nameLocale.english_name5  s     $$VD\22r'   c                     U R                   S   $ )zMapping of language codes to translated language names.

>>> Locale('de', 'DE').languages['ja']
u'Japanisch'

See `ISO 639 <https://www.loc.gov/standards/iso639-2/>`_ for
more information.
r   r   r   s    r(   r   Locale.languagesC  s     zz+&&r'   c                     U R                   S   $ )zMapping of script codes to translated script names.

>>> Locale('en', 'US').scripts['Hira']
u'Hiragana'

See `ISO 15924 <https://www.unicode.org/iso15924/>`_
for more information.
r   r  r   s    r(   r   Locale.scriptsO  s     zz)$$r'   c                     U R                   S   $ )zMapping of script codes to translated script names.

>>> Locale('es', 'CO').territories['DE']
u'Alemania'

See `ISO 3166 <https://en.wikipedia.org/wiki/ISO_3166>`_
for more information.
r   r  r   s    r(   r   Locale.territories[  s     zz-((r'   c                     U R                   S   $ )z~Mapping of script codes to translated script names.

>>> Locale('de', 'DE').variants['1901']
u'Alte deutsche Rechtschreibung'
r   r  r   s    r(   r   Locale.variantsg       zz*%%r'   c                     U R                   S   $ )aa  Mapping of currency codes to translated currency names.  This
only returns the generic form of the currency name, not the count
specific one.  If an actual number is requested use the
:func:`babel.numbers.get_currency_name` function.

>>> Locale('en').currencies['COP']
u'Colombian Peso'
>>> Locale('de', 'DE').currencies['COP']
u'Kolumbianischer Peso'
currency_namesr  r   s    r(   
currenciesLocale.currenciesr  s     zz*++r'   c                     U R                   S   $ )zMapping of currency codes to symbols.

>>> Locale('en', 'US').currency_symbols['USD']
u'$'
>>> Locale('es', 'CO').currency_symbols['USD']
u'US$'
currency_symbolsr  r   s    r(   r  Locale.currency_symbols  s     zz,--r'   c                     U R                   S   $ )uL  Symbols used in number formatting by number system.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('fr', 'FR').number_symbols["latn"]['decimal']
u','
>>> Locale('fa', 'IR').number_symbols["arabext"]['decimal']
u'٫'
>>> Locale('fa', 'IR').number_symbols["latn"]['decimal']
u'.'
number_symbolsr  r   s    r(   r"  Locale.number_symbols  s     zz*++r'   c                     U R                   S   $ )a0  
Mapping of other numbering systems available for the locale.
See: https://www.unicode.org/reports/tr35/tr35-numbers.html#otherNumberingSystems

>>> Locale('el', 'GR').other_numbering_systems['traditional']
u'grek'

.. note:: The format of the value returned may change between
          Babel versions.
numbering_systemsr  r   s    r(   other_numbering_systemsLocale.other_numbering_systems  s     zz-..r'   c                     U R                   S   $ )ziThe default numbering system used by the locale.
>>> Locale('el', 'GR').default_numbering_system
u'latn'
default_numbering_systemr  r   s    r(   r)  Locale.default_numbering_system  s     zz455r'   c                     U R                   S   $ )zLocale patterns for decimal number formatting.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').decimal_formats[None]
<NumberPattern u'#,##0.###'>
decimal_formatsr  r   s    r(   r,  Locale.decimal_formats       zz+,,r'   c                     U R                   S   $ )zLocale patterns for compact decimal number formatting.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').compact_decimal_formats["short"]["one"]["1000"]
<NumberPattern u'0K'>
compact_decimal_formatsr  r   s    r(   r0  Locale.compact_decimal_formats  s     zz344r'   c                     U R                   S   $ )aC  Locale patterns for currency number formatting.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').currency_formats['standard']
<NumberPattern u'\xa4#,##0.00'>
>>> Locale('en', 'US').currency_formats['accounting']
<NumberPattern u'\xa4#,##0.00;(\xa4#,##0.00)'>
currency_formatsr  r   s    r(   r3  Locale.currency_formats       zz,--r'   c                     U R                   S   $ )u   Locale patterns for compact currency number formatting.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').compact_currency_formats["short"]["one"]["1000"]
<NumberPattern u'¤0K'>
compact_currency_formatsr  r   s    r(   r7  Locale.compact_currency_formats  s     zz455r'   c                     U R                   S   $ )zLocale patterns for percent number formatting.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').percent_formats[None]
<NumberPattern u'#,##0%'>
percent_formatsr  r   s    r(   r:  Locale.percent_formats  r.  r'   c                     U R                   S   $ )zLocale patterns for scientific number formatting.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').scientific_formats[None]
<NumberPattern u'#E0'>
scientific_formatsr  r   s    r(   r=  Locale.scientific_formats  s     zz.//r'   c                z     U R                   S   S   S   $ ! [         a    [        R                  " 0 5      s $ f = f)zZLocale display names for day periods (AM/PM).

>>> Locale('en', 'US').periods['am']
u'AM'
day_periodszstand-alonewide)r   KeyErrorr	   r   r   s    r(   periodsLocale.periods  s@    	1::m,];FCC 	1,,R00	1s     ::c                     U R                   S   $ )zLocale display names for various day periods (not necessarily only AM/PM).

These are not meant to be used without the relevant `day_period_rules`.
r@  r  r   s    r(   r@  Locale.day_periods	  s     zz-((r'   c                b    U R                   R                  S[        R                  " 0 5      5      $ )zCDay period rules for the locale.  Used by `get_period_id`.
        day_period_rules)r   r5   r	   r   r   s    r(   rH  Locale.day_period_rules  s%     zz~~0*2K2KB2OPPr'   c                     U R                   S   $ )zcLocale display names for weekdays.

>>> Locale('de', 'DE').days['format']['wide'][3]
u'Donnerstag'
daysr  r   s    r(   rK  Locale.days  s     zz&!!r'   c                     U R                   S   $ )zaLocale display names for months.

>>> Locale('de', 'DE').months['format']['wide'][10]
u'Oktober'
monthsr  r   s    r(   rN  Locale.months   s     zz(##r'   c                     U R                   S   $ )zgLocale display names for quarters.

>>> Locale('de', 'DE').quarters['format']['wide'][1]
u'1. Quartal'
quartersr  r   s    r(   rQ  Locale.quarters)  r  r'   c                     U R                   S   $ )zLocale display names for eras.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').eras['wide'][1]
u'Anno Domini'
>>> Locale('en', 'US').eras['abbreviated'][0]
u'BC'
erasr  r   s    r(   rT  Locale.eras2  s     zz&!!r'   c                     U R                   S   $ )u+  Locale display names for time zones.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').time_zones['Europe/London']['long']['daylight']
u'British Summer Time'
>>> Locale('en', 'US').time_zones['America/St_Johns']['city']
u'St. John’s'

time_zonesr  r   s    r(   rW  Locale.time_zones@  s     zz,''r'   c                     U R                   S   $ )a  Locale display names for meta time zones.

Meta time zones are basically groups of different Olson time zones that
have the same GMT offset and daylight savings time.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').meta_zones['Europe_Central']['long']['daylight']
u'Central European Summer Time'

.. versionadded:: 0.9
r   r  r   s    r(   r   Locale.meta_zonesN  s     zz,''r'   c                     U R                   S   $ )a#  Patterns related to the formatting of time zones.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').zone_formats['fallback']
u'%(1)s (%(0)s)'
>>> Locale('pt', 'BR').zone_formats['region']
u'Hor\xe1rio %s'

.. versionadded:: 0.9
zone_formatsr  r   s    r(   r\  Locale.zone_formats_  s     zz.))r'   c                &    U R                   S   S   $ )zThe first day of a week, with 0 being Monday.

>>> Locale('de', 'DE').first_week_day
0
>>> Locale('en', 'US').first_week_day
6
	week_data	first_dayr  r   s    r(   first_week_dayLocale.first_week_dayo  s     zz+&{33r'   c                &    U R                   S   S   $ )zYThe day the weekend starts, with 0 being Monday.

>>> Locale('de', 'DE').weekend_start
5
r_  weekend_startr  r   s    r(   rd  Locale.weekend_startz  s     zz+&77r'   c                &    U R                   S   S   $ )zUThe day the weekend ends, with 0 being Monday.

>>> Locale('de', 'DE').weekend_end
6
r_  weekend_endr  r   s    r(   rg  Locale.weekend_end  s     zz+&}55r'   c                &    U R                   S   S   $ )zThe minimum number of days in a week so that the week is counted as
the first week of a year or month.

>>> Locale('de', 'DE').min_week_days
4
r_  min_daysr  r   s    r(   min_week_daysLocale.min_week_days  s     zz+&z22r'   c                     U R                   S   $ )a  Locale patterns for date formatting.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').date_formats['short']
<DateTimePattern u'M/d/yy'>
>>> Locale('fr', 'FR').date_formats['long']
<DateTimePattern u'd MMMM y'>
date_formatsr  r   s    r(   rn  Locale.date_formats       zz.))r'   c                     U R                   S   $ )u  Locale patterns for time formatting.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en', 'US').time_formats['short']
<DateTimePattern u'h:mm a'>
>>> Locale('fr', 'FR').time_formats['long']
<DateTimePattern u'HH:mm:ss z'>
time_formatsr  r   s    r(   rr  Locale.time_formats  rp  r'   c                     U R                   S   $ )zLocale patterns for datetime formatting.

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en').datetime_formats['full']
u'{1}, {0}'
>>> Locale('th').datetime_formats['medium']
u'{1} {0}'
datetime_formatsr  r   s    r(   ru  Locale.datetime_formats  r5  r'   c                     U R                   S   $ )a	  Locale patterns for formatting parts of a datetime.

>>> Locale('en').datetime_skeletons['MEd']
<DateTimePattern u'E, M/d'>
>>> Locale('fr').datetime_skeletons['MEd']
<DateTimePattern u'E dd/MM'>
>>> Locale('fr').datetime_skeletons['H']
<DateTimePattern u"HH 'h'">
datetime_skeletonsr  r   s    r(   rx  Locale.datetime_skeletons  s     zz.//r'   c                     U R                   S   $ )u  Locale patterns for interval formatting.

.. note:: The format of the value returned may change between
          Babel versions.

How to format date intervals in Finnish when the day is the
smallest changing component:

>>> Locale('fi_FI').interval_formats['MEd']['d']
[u'E d. – ', u'E d.M.']

.. seealso::

   The primary API to use this data is :py:func:`babel.dates.format_interval`.


:rtype: dict[str, dict[str, list[str]]]
interval_formatsr  r   s    r(   r{  Locale.interval_formats  s    ( zz,--r'   c                B    U R                   R                  S[        5      $ )zPlural rules for the locale.

>>> Locale('en').plural_form(1)
'one'
>>> Locale('en').plural_form(0)
'other'
>>> Locale('fr').plural_form(0)
'one'
>>> Locale('ru').plural_form(100)
'many'
plural_formr   r5   _default_plural_ruler   s    r(   r~  Locale.plural_form  s     zz~~m-ABBr'   c                     U R                   S   $ )a>  Patterns for generating lists

.. note:: The format of the value returned may change between
          Babel versions.

>>> Locale('en').list_patterns['standard']['start']
u'{0}, {1}'
>>> Locale('en').list_patterns['standard']['end']
u'{0}, and {1}'
>>> Locale('en_GB').list_patterns['standard']['end']
u'{0} and {1}'
list_patternsr  r   s    r(   r  Locale.list_patterns  s     zz/**r'   c                B    U R                   R                  S[        5      $ )zPlural rules for the locale.

>>> Locale('en').ordinal_form(1)
'one'
>>> Locale('en').ordinal_form(2)
'two'
>>> Locale('en').ordinal_form(3)
'few'
>>> Locale('fr').ordinal_form(2)
'other'
>>> Locale('ru').ordinal_form(100)
'other'
ordinal_formr  r   s    r(   r  Locale.ordinal_form  s     zz~~n.BCCr'   c                     U R                   S   $ )zLocalized names for various measurement systems.

>>> Locale('fr', 'FR').measurement_systems['US']
u'am\xe9ricain'
>>> Locale('en', 'US').measurement_systems['US']
u'US'

measurement_systemsr  r   s    r(   r  Locale.measurement_systems  s     zz/00r'   c                     U R                   S   $ )zThe text direction for the language.

>>> Locale('de', 'DE').character_order
'left-to-right'
>>> Locale('ar', 'SA').character_order
'right-to-left'
character_orderr  r   s    r(   r  Locale.character_order  s     zz+,,r'   c                d    SR                  S U R                  R                  S5       5       5      $ )zThe text direction for the language in CSS short-hand form.

>>> Locale('de', 'DE').text_direction
'ltr'
>>> Locale('ar', 'SA').text_direction
'rtl'
r   c              3  *   #    U  H	  oS    v   M     g7f)r   Nr&   )r   words     r(   r   (Locale.text_direction.<locals>.<genexpr>3  s     K+J4Aw+Js   -)r.   r  splitr   s    r(   text_directionLocale.text_direction*  s*     wwK4+?+?+E+Ec+JKKKr'   c                     U R                   S   $ )zDisplay names for units of measurement.

.. seealso::

   You may want to use :py:func:`babel.units.get_unit_name` instead.

.. note:: The format of the value returned may change between
          Babel versions.

unit_display_namesr  r   s    r(   r  Locale.unit_display_names5  s     zz.//r'   )__data__data_identifierr   r   r   r   r   )NNNN)r   r   r   
str | Noner   r  r   r  r   r  r   r   )r   r  r   Mapping[str, str]r   r   )
r   Iterable[str]r   r  r   r   r   r  r   zLocale | None)r   T)r   Locale | str | Noner   r   r   boolr   r   )r   objectr   r  )r   int)r   r   )r   zlocaledata.LocaleDataDictr   )r   r  r   r  )r   r  )r   r
   )Er   r   r   r   r   r   classmethodLOCALE_ALIASESr   r   r   r   r   r   r   r   propertyr   r   display_namer  language_namer  territory_namer  script_namer  r   r   r   r   r  r  r"  r&  r)  r,  r0  r3  r7  r:  r=  rC  r@  rH  rK  rN  rQ  rT  rW  r   r\  ra  rd  rg  rk  rn  rr  ru  rx  r{  r~  r  r  r  r  r  r  r   r&   r'   r(   r   r      s   D !%!"#+1+1 +1 	+1
 +1 +1 
+1Z ,0~ ( (0 
 %3  ! 	
 # 
 B  '+	U+'U+ U+ !%	U+
 
U+ U+n

&3C6
  
!F , 3 L3 . 5 	M< 0 7 	N5 ? 1 	K 	3 	3 	' 	' 	% 	% 	) 	) & & , , . . , , / / 6 6 	- 	- 	5 	5 . . 	6 	6 	- 	- 	0 	0 	1 	1 ) ) Q Q
 " " $ $ & & " " ( ( ( (  * * 4 4 8 8 6 6 3 3 * * * * . . 
0 
0 . .* C C + + D D  	1 	1 - - L L 0 0r'   r   c                   SnU (       aN  [        U [        5      (       a  U /UQ7nO2[        U [        [        45      (       a  / U QUQ7nO[	        SU < 35      eU H  nU(       d  M  [
        R                  " U5      nU(       d  M+  US:X  a  SU;   a  UR                  S5      S   nUR                  S5      S   S;   a  SnOU(       a	  XA;   a  X   n [        [        U5      5      s  $    g	! [         a     M  f = f)
a  Returns the system default locale for a given category, based on
environment variables.

>>> for name in ['LANGUAGE', 'LC_ALL', 'LC_CTYPE']:
...     os.environ[name] = ''
>>> os.environ['LANG'] = 'fr_FR.UTF-8'
>>> default_locale('LC_MESSAGES')
'fr_FR'

The "C" or "POSIX" pseudo-locales are treated as aliases for the
"en_US_POSIX" locale:

>>> os.environ['LC_MESSAGES'] = 'POSIX'
>>> default_locale('LC_MESSAGES')
'en_US_POSIX'

The following fallbacks to the variable are always considered:

- ``LANGUAGE``
- ``LC_ALL``
- ``LC_CTYPE``
- ``LANG``

:param category: one or more of the ``LC_XXX`` environment variable names
:param aliases: a dictionary of aliases for locale identifiers
)LANGUAGELC_ALLLC_CTYPELANGzInvalid type for category: r  :r   .)CPOSIXen_US_POSIXN)r   r   listtupler   r,   getenvr  r   r   r   )r   r   varnamesnamer   s        r(   r   r   D  s    > :Hh$$ ,8,H4-00--H-H9(FGG46z!cVm  c*1-||C #~5&V. ,\&-ABB "   s   C**
C87C8r   c                   U Vs/ s H  oD(       d  M  UR                  5       PM     nnU  H  nUR                  5       nXa;   a  Us  $ U(       aB  UR                  U5      nU(       a*  UR                  SU5      nUR                  5       U;   a  Us  $ UR                  U5      n[	        U5      S:  d  M  US   R                  5       U;   d  M  US   s  $    gs  snf )u  Find the best match between available and requested locale strings.

>>> negotiate_locale(['de_DE', 'en_US'], ['de_DE', 'de_AT'])
'de_DE'
>>> negotiate_locale(['de_DE', 'en_US'], ['en', 'de'])
'de'

Case is ignored by the algorithm, the result uses the case of the preferred
locale identifier:

>>> negotiate_locale(['de_DE', 'en_US'], ['de_de', 'de_at'])
'de_DE'

>>> negotiate_locale(['de_DE', 'en_US'], ['de_de', 'de_at'])
'de_DE'

By default, some web browsers unfortunately do not include the territory
in the locale identifier for many locales, and some don't even allow the
user to easily add the territory. So while you may prefer using qualified
locale identifiers in your web-application, they would not normally match
the language-only locale sent by such browsers. To workaround that, this
function uses a default mapping of commonly used language-only locale
identifiers to identifiers including the territory:

>>> negotiate_locale(['ja', 'en_US'], ['ja_JP', 'en_US'])
'ja_JP'

Some browsers even use an incorrect or outdated language code, such as "no"
for Norwegian, where the correct locale identifier would actually be "nb_NO"
(Bokmål) or "nn_NO" (Nynorsk). The aliases are intended to take care of
such cases, too:

>>> negotiate_locale(['no', 'sv'], ['nb_NO', 'sv_SE'])
'nb_NO'

You can override this default mapping by passing a different `aliases`
dictionary to this function, or you can bypass the behavior althogher by
setting the `aliases` parameter to `None`.

:param preferred: the list of locale strings preferred by the user
:param available: the list of locale strings available
:param sep: character that separates the different parts of the locale
            strings
:param aliases: a dictionary of aliases for locale identifiers
r      r   N)lowerr5   replacer  r   )	r   r   r   r   ar   llaliasr   s	            r(   r   r     s    \ %.3IqII3\\^?MKKOEc3/;;=I- LS!u:>eAhnn.);8O   4s
   
CCc                8   U (       d  [        S5      eU R                  S5      u  pnSU ;   a  U R                  SS5      S   n U R                  U5      nUR                  S5      R	                  5       nUR                  5       (       d  [        SU< 35      eS=n=pxU(       aI  [        US   5      S:X  a7  US   R                  5       (       a  UR                  S5      R                  5       nU(       a  [        US   5      S	:X  a8  US   R                  5       (       a   UR                  S5      R                  5       nO;[        US   5      S
:X  a)  US   R                  5       (       a  UR                  S5      nU(       ax  [        US   5      S:X  a  US   S   R                  5       (       d-  [        US   5      S:  a9  US   S   R                  5       (       a  UR                  5       R                  5       nU(       a  [        U < S35      eU(       a  XWXhU4$ XWXh4$ )ab  Parse a locale identifier into a tuple of the form ``(language,
territory, script, variant, modifier)``.

>>> parse_locale('zh_CN')
('zh', 'CN', None, None)
>>> parse_locale('zh_Hans_CN')
('zh', 'CN', 'Hans', None)
>>> parse_locale('ca_es_valencia')
('ca', 'ES', None, 'VALENCIA')
>>> parse_locale('en_150')
('en', '150', None, None)
>>> parse_locale('en_us_posix')
('en', 'US', None, 'POSIX')
>>> parse_locale('it_IT@euro')
('it', 'IT', None, None, 'euro')
>>> parse_locale('it_IT@custom')
('it', 'IT', None, None, 'custom')
>>> parse_locale('it_IT@')
('it', 'IT', None, None)

The default component separator is "_", but a different separator can be
specified using the `sep` parameter.

The optional modifier is always separated with "@" and at the end:

>>> parse_locale('zh-CN', sep='-')
('zh', 'CN', None, None)
>>> parse_locale('zh-CN@custom', sep='-')
('zh', 'CN', None, None, 'custom')

If the identifier cannot be parsed into a locale, a `ValueError` exception
is raised:

>>> parse_locale('not_a_LOCALE_String')
Traceback (most recent call last):
  ...
ValueError: 'not_a_LOCALE_String' is not a valid locale identifier

Encoding information is removed from the identifier, while modifiers are
kept:

>>> parse_locale('en_US.UTF-8')
('en', 'US', None, None)
>>> parse_locale('de_DE.iso885915@euro')
('de', 'DE', None, None, 'euro')

See :rfc:`4646` for more information.

:param identifier: the locale identifier string
:param sep: character that separates the different components of the locale
            identifier
:raise `ValueError`: if the string does not appear to be a valid locale
                     identifier
zempty locale identifierr   r  r  r   zexpected only letters, got N   r      r   z! is not a valid locale identifier)
r   r   r  popr  isalphar   titleupperisdigit)	r   r   r   r   r   langr   r   r   s	            r(   r   r     s   t 233(2237J8
j%%c1-a0
S!E99Q<D<<>>6th?@@#''F'YU1X!#a(8(8(:(:1##%uQx=A%("2"2"4"4		!**,Iq]aE!H$4$4$6$6		!IE!HuQx{2244E!HuQx{2244))+##%J>)JKLL 99//r'   c           	         [        U SS 5      n U SS[        U 5      -
  -  -   u  p#pEnUR                  [        SX$X545      5      nU(       a  U SU 3$ U$ )a  The reverse of :func:`parse_locale`.  It creates a locale identifier out
of a ``(language, territory, script, variant, modifier)`` tuple.  Items can be set to
``None`` and trailing ``None``\s can also be left out of the tuple.

>>> get_locale_identifier(('de', 'DE', None, '1999', 'custom'))
'de_DE_1999@custom'
>>> get_locale_identifier(('fi', None, None, None, 'custom'))
'fi@custom'


.. versionadded:: 1.0

:param tup: the tuple as returned by :func:`parse_locale`.
:param sep: the separator for the identifier.
Nr   r   r   )r  r   r.   filter)tupr   r  r   r   r   r   rets           r(   r   r     sc    . BQ.C14w!c#h,7O1O.DVh
((6$y BC
DC"*cU!H:33r'   )r6   r"   r   zMapping[str, Any])r   z(str | tuple[str, ...] | list[str] | Noner   r  r   r  )
r   r  r   r  r   r   r   r  r   r  )r   )r   r   r   r   r   zktuple[str, str | None, str | None, str | None] | tuple[str, str | None, str | None, str | None, str | None])r  ztuple[str] | tuple[str, str | None] | tuple[str, str | None, str | None] | tuple[str, str | None, str | None, str | None] | tuple[str, str | None, str | None, str | None, str | None]r   r   r   r   )!r   
__future__r   r,   r3   collections.abcr   r   typingr   r   r   babelr	   babel.pluralr
   __all__typing_extensionsr   r"   __annotations__r#   r  r)   r   r  r   r   r   r   r   r   r   r&   r'   r(   <module>r     s   # 	  - . .  # +$	K $ A@!"~ 2+%\	'		"&	15w	@Dg	'		"&	15w	@Dg	 	'	 	 #'	 26w	 AEg	 	'		 		 #'		 26w		 AEg		
 	'	
 	
 #'	
 26w	
 AEg	 	'	 	 #'	 26w	 AEg	 	'	 	 #'	 26w	 GN
w	% % t0 t0p :>!/9699 9x UX  wE <B ]0]0	]0 q]0L 4
A4 
4 	4r'   