Sindbad~EG File Manager
�
MٜgF � �� � d Z ddlmZ ddlmZ ddlZddlZddlZddlZddl m
Z
ddlmZ e
rddl
mZ eej f dd�� Zej fd
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 � t j |� } t j || � t j � \ }}|�|�
|� d|� ��� n| �� t j ||� y# t j ||� w xY w�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_localer s� � �� �. �%�%�f�-�N�1������,�/5�/?�/?�/A�,��,��&�+>�+J�$�%�Q�':�&;�<�<��������0�������0�s �B
�?A/ �B
�/B�B
c � � t | |�� 5 ddd� y# 1 sw Y yxY w# t t j f$ r Y yw xY 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)�lcr s r �can_set_localer 9 sE � �"�
��6�
*�� +� �
+� ��
����%� ���s# �
&