
    Vh                    $    d dl mZ d dlmZ ddZy)    )annotations)	to_nativeNc                   d}	 | j                  d      }|st        d      g }|g d}| j                  |dg      \  }}}|dk(  r;|r|j                         j	                         }n4t        d|d	t        |            t        d
|d	t        |            |r|D ]
  }	|	|v s|	} n | j                  d|z         |S # t        $ r*}
|r | j                  dt        |
      z         Y d}
~
Dd}
~
ww xY w)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localezCould not find 'locale' toolN)zC.utf8zC.UTF-8z
en_US.utf8zen_US.UTF-8r   POSIXz-ar   zNo output from locale, rc=z: z%Unable to get locale information, rc=z$Failed to get locale information: %szMatched preferred locale to: %s)get_bin_pathRuntimeWarningrun_commandstrip
splitlinesr   debug)modulepreferencesraise_on_localefoundr   	availablercouterrprefes              R/home/dcms/DCMS/lib/python3.12/site-packages/ansible/module_utils/common/locale.pyget_best_parsable_localer   	   s    E!P$$X. !?@@	 [K))64.9C7IIK224	$2yY\~%^__ RTV_`cVd!eff# 9$ E LL2U:;L  PLL?)A,NOO	Ps   B"C 'C 	C5 C00C5)NF)
__future__r   +ansible.module_utils.common.text.convertersr   r        r   <module>r      s    # A3r   