Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pandas/_config/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pandas/_config/__pycache__/localization.cpython-312.pyc

�

MٜgF����dZddlmZddlmZddlZddlZddlZddlZddl	m
Z
ddlmZe
rddl
mZeejf					dd��Zejfd
d	�Zdd
�Z		d					dd�Zy)zx
Helpers for configuring locale settings.

Name `localization` is chosen to avoid overlap with builtin `locale` module.
�)�annotations)�contextmanagerN)�
TYPE_CHECKING)�options)�	Generatorc#�K�tj|�}	tj||�tj�\}}|�|�
|�d|����n|��tj||�y#tj||�wxYw�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)�
new_locale�lc_var�current_locale�normalized_code�normalized_encodings     �F/usr/local/lib/python3.12/site-packages/pandas/_config/localization.py�
set_localers�����.�%�%�f�-�N�1������,�/5�/?�/?�/A�,��,��&�+>�+J�$�%�Q�':�&;�<�<��������0�������0�s�B
�?A/�B
�/B�B
c��	t||��5	ddd�y#1swYyxYw#ttjf$rYywxYw)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
    )rNTF)r�
ValueErrorr
�Error)�lcrs  r�can_set_localer9sE��"�
��6�
*��+��
+���	
����%����s#�
&��&�#�&�&�A�Ac�V���fd�|D�D�cgc]}t|�r|��c}Scc}w)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.
    c3��K�|]9}�r#tj|j��n|j����;y�w)N)r
�	normalize�strip)�.0�locrs  �r�	<genexpr>z!_valid_locales.<locals>.<genexpr>gs7�����
���.7�F���S�Y�Y�[�)�C�I�I�K�G��s�?A)r)�localesrrs ` r�_valid_localesr!Ts@���&
��
��
�C��#��	�
����s�&c��tj�dvrtjddg�}ngS	|j	d�}g}|D]7}	|jt
|tjj����9	|�t|�Stj|�d��}|jdj!��}t||�S#t$r|jt
|d���Y��wxYw#t$rY��wxYw)	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-1252z.*�
)�platform�system�
subprocess�check_output�split�append�strr�displayr&�UnicodeError�	TypeErrorr!�re�compile�findall�join)�prefixr�raw_locales�split_raw_locales�out_locales�x�pattern�founds        r�get_localesr=os��:����/�/� �-�-�x��.>�?���	�
�(�-�-�e�4����"�A�
D��"�"�3�q�7�?�?�3K�3K�#L�M�#��~��k�9�5�5��j�j�F�8�2��'�G��O�O�D�I�I�k�2�3�E��%��+�+��! �
D��"�"�3�q�>�#B�C�

D���
��
�s5�C?�4C�?C?�%C<�9C?�;C<�<C?�?	D�
D)r
zstr | tuple[str, str]r�int�returnz,Generator[str | tuple[str, str], None, None])rr.rr>r?�bool)r zlist[str] | strrr@r?�	list[str])NT)r6z
str | Nonerr@r?rA)�__doc__�
__future__r�
contextlibrr
r(r2r*�typingr�pandas._config.configr�collections.abcr�LC_ALLrrr!r=��r�<module>rKs����
#�%�
��	�� �)��)��5;�]�]� 1�%� 1�/2� 1�1� 1�� 1�F+1�-�-��6�8��=,��=,��=,��=,rJ

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists