%PDF- %PDF-
| Direktori : /lib/python3.9/site-packages/ansible/module_utils/common/__pycache__/ |
| Current File : //lib/python3.9/site-packages/ansible/module_utils/common/__pycache__/locale.cpython-39.pyc |
a
�)g � @ s2 d dl mZmZmZ eZd dlmZ ddd�ZdS )� )�absolute_import�division�print_function)� to_nativeNFc
C s� d}z�| � d�}|std��g }|du r0g d�}| �|dg�\}}}|dkrt|r^|�� �� }q�td|t|�f ��ntd |t|�f ��|r�|D ]} | |v r�| } q�q�W n> ty� }
z&|r�� n| �d
t|
� � W Y d}
~
n
d}
~
0 0 | �d| � |S )aR
Attempts to return the best possible locale for parsing output in English
useful for scraping output with i18n tools. When this raises an exception
and the caller wants to continue, it should use the 'C' locale.
:param module: an AnsibleModule instance
:param preferences: A list of preferred locales, in order of preference
:param raise_on_locale: boolean that determines if we raise exception or not
due to locale CLI issues
:returns: The first matched preferred locale or 'C' which is the default
�C�localezCould not find 'locale' toolN)zC.utf8zC.UTF-8z
en_US.utf8zen_US.UTF-8r ZPOSIXz-ar z No output from locale, rc=%s: %sz+Unable to get locale information, rc=%s: %sz$Failed to get locale information: %szMatched preferred locale to: %s)Zget_bin_path�RuntimeWarningZrun_command�strip�
splitlinesr �debug)�moduleZpreferencesZraise_on_locale�foundr Z available�rc�out�errZpref�e� r �F/usr/lib/python3.9/site-packages/ansible/module_utils/common/locale.py�get_best_parsable_locale
s2
(r )NF) Z
__future__r r r �typeZ
__metaclass__Zansible.module_utils._textr r r r r r �<module> s