§
    tŠtjZ  ã                  óÀ   — d Z ddlmZ ddlmZ ddlZddlZddlZddlZddl	m
Z
mZ ddlmZ e
rddlmZ eej        fdd„¦   «         Zej        fdd„Zdd„Z	 	 dd d„ZdS )!zx
Helpers for configuring locale settings.

Name `localization` is chosen to avoid overlap with builtin `locale` module.
é    )Úannotations)ÚcontextmanagerN)ÚTYPE_CHECKINGÚcast)Úoptions)Ú	GeneratorÚ
new_localeústr | tuple[str, str]Úlc_varÚintÚreturnú Generator[str | tuple[str, str]]c              #  ó  K  — t          j        |¦  «        }	 t          j        || ¦  «         t          j        ¦   «         \  }}|�|�
|› d|› �V — n| V — t          j        ||¦  «         dS # t          j        ||¦  «         w xY w)aE  
    Context manager for temporarily setting a locale.

    Parameters
    ----------
    new_locale : str or tuple
        A string of the form <language_country>.<encoding>. For example to set
        the current locale to US English with a UTF8 encoding, you would pass
        "en_US.UTF-8".
    lc_var : int, default `locale.LC_ALL`
        The category of the locale being set.

    Notes
    -----
    This is useful when you want to run a particular block of code under a
    particular locale, without globally setting the locale. This probably isn't
    thread-safe.
    Nú.)ÚlocaleÚ	setlocaleÚ	getlocale)r	   r   Úcurrent_localeÚnormalized_codeÚnormalized_encodings        úY/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/pandas/_config/localization.pyÚ
set_localer      s¬   è è € õ. Ô% fÑ-Ô-€Nð1ÝÔ˜ Ñ,Ô,Ð,Ý/5Ô/?Ñ/AÔ/AÑ,ˆÐ,ØÐ&Ð+>Ð+JØ$Ð<Ð<Ð':Ð<Ð<Ð<Ð<Ð<Ð<àÐÐÐåÔ˜ Ñ0Ô0Ð0Ð0Ð0ø�Ô˜ Ñ0Ô0Ð0Ð0øøøs   ˜=A, Á,BÚlcÚstrÚboolc                ó–   — 	 t          | |¬¦  «        5  	 ddd¦  «         n# 1 swxY w Y   dS # t          t          j        f$ r Y dS w xY w)aj  
    Check to see if we can set a locale, and subsequently get the locale,
    without raising an Exception.

    Parameters
    ----------
    lc : str
        The locale to attempt to set.
    lc_var : int, default `locale.LC_ALL`
        The category of the locale being set.

    Returns
    -------
    bool
        Whether the passed locale can be set
    )r   NTF)r   Ú
ValueErrorr   ÚError)r   r   s     r   Úcan_set_localer   =   s¤   € ð"Ý˜ 6Ð*Ñ*Ô*ð 	ð 	Øð	ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	ð ˆtøõ	 �œÐ%ð ð ð àˆuˆuðøøøs'   ‚. “!•. ¡%¥. ¨%©. ®AÁAÚlocalesúlist[str] | strÚ	normalizeú	list[str]c                ó4   ‡— d„ ˆfd„| D ¦   «         D ¦   «         S )ar  
    Return a list of normalized locales that do not throw an ``Exception``
    when set.

    Parameters
    ----------
    locales : str
        A string where each locale is separated by a newline.
    normalize : bool
        Whether to call ``locale.normalize`` on each locale.

    Returns
    -------
    valid_locales : list
        A list of valid locales.
    c                ó0   — g | ]}t          |¦  «        ¯|‘ŒS © )r   )Ú.0Úlocs     r   ú
<listcomp>z"_valid_locales.<locals>.<listcomp>i   s8   € ð ð ð àõ ˜#ÑÔðØðð ð ó    c              3  ó�   •K  — | ]@}‰r&t          j        |                     ¦   «         ¦  «        n|                     ¦   «         V — ŒAd S )N)r   r"   Ústrip)r'   r(   r"   s     €r   ú	<genexpr>z!_valid_locales.<locals>.<genexpr>k   s\   øè è € ð 
ð 
àð .7ÐG�FÔ˜SŸYšY™[œ[Ñ)Ô)Ð)¸C¿IºI¹K¼Kð
ð 
ð 
ð 
ð 
ð 
r*   r&   )r    r"   s    `r   Ú_valid_localesr.   X   sG   ø€ ð"ð ð
ð 
ð 
ð 
àð
ñ 
ô 
ðñ ô ð r*   TÚprefixú
str | Nonec           
     ór  — t          j        ¦   «         dv rt          j        ddg¦  «        }ng S 	 |                     d¦  «        }g }|D ]}}	 |                     t          |t          t          t          j	        j
        ¦  «        ¬¦  «        ¦  «         ŒJ# t          $ r' |                     t          |d¬¦  «        ¦  «         Y Œzw xY wn# t          $ r Y nw xY w| €t          ||¦  «        S t          j        | › d�¦  «        }|                     d	                     |¦  «        ¦  «        }t          ||¦  «        S )
a)  
    Get all the locales that are available on the system.

    Parameters
    ----------
    prefix : str
        If not ``None`` then return only those locales with the prefix
        provided. For example to get all English language locales (those that
        start with ``"en"``), pass ``prefix="en"``.
    normalize : bool
        Call ``locale.normalize`` on the resulting list of available locales.
        If ``True``, only locales that can be set without throwing an
        ``Exception`` are returned.

    Returns
    -------
    locales : list of strings
        A list of locale strings that can be set with ``locale.setlocale()``.
        For example::

            locale.setlocale(locale.LC_ALL, locale_string)

    On error will return an empty list (no locale available, e.g. Windows)

    )ÚLinuxÚDarwinr   z-aó   
)Úencodingzwindows-1252Nz.*ú
)ÚplatformÚsystemÚ
subprocessÚcheck_outputÚsplitÚappendr   r   r   Údisplayr5   ÚUnicodeErrorÚ	TypeErrorr.   ÚreÚcompileÚfindallÚjoin)r/   r"   Úraw_localesÚsplit_raw_localesÚout_localesÚxÚpatternÚfounds           r   Úget_localesrJ   s   si  € õ: „ÑÔÐ/Ð/Ð/Ý Ô-¨x¸Ð.>Ñ?Ô?ˆˆð ˆ	ðð (×-Ò-¨eÑ4Ô4ÐØˆØ"ð 		Dð 		DˆAðDØ×"Ò"¥3 qµ4½½W¼_Ô=UÑ3VÔ3VÐ#WÑ#WÔ#WÑXÔXÐXÐXøÝð Dð Dð Dð ×"Ò"¥3 q°>Ð#BÑ#BÔ#BÑCÔCÐCÐCÐCðDøøøð		Døõ ð ð ð Øˆðøøøð €~Ý˜k¨9Ñ5Ô5Ð5åŒj˜F˜˜˜Ñ'Ô'€GØ�OŠO˜DŸIšI kÑ2Ô2Ñ3Ô3€EÝ˜% Ñ+Ô+Ð+s6   °C ÁABÂC Â.CÃC ÃCÃC Ã
CÃC)r	   r
   r   r   r   r   )r   r   r   r   r   r   )r    r!   r"   r   r   r#   )NT)r/   r0   r"   r   r   r#   )Ú__doc__Ú
__future__r   Ú
contextlibr   r   r7   r@   r9   Útypingr   r   Úpandas._config.configr   Úcollections.abcr   ÚLC_ALLr   r   r.   rJ   r&   r*   r   ú<module>rR      s<  ððð ð #Ð "Ð "Ð "Ð "Ð "à %Ð %Ð %Ð %Ð %Ð %Ø €€€Ø €€€Ø 	€	€	€	Ø Ð Ð Ð ðð ð ð ð ð ð ð ð
 *Ð )Ð )Ð )Ð )Ð )àð *Ø)Ð)Ð)Ð)Ð)Ð)ð à5;´]ð 1ð  1ð  1ð  1ñ „ð 1ðF +1¬-ð ð ð ð ð ð6ð ð ð ð8 Øð=,ð =,ð =,ð =,ð =,ð =,ð =,r*   