Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/__pycache__/test_c_locale_coercion.cpython-312.opt-1.pyc

�

'Μg�S��6�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddgZdZ
dZdZgd	�Zej"j%d
�r#e	j&rdZ
dZniej)d�nWej"j%d
�rdZ
dZn7ej"dk(rdZn%ej"dk(rdZnej"dk(rdZ
dZd	Zeej"dvxreed�xr	eed��Zd�ZdZede�ZGd�de�ZdZdZdada da!d�Z"Gd�dejF�Z$Gd�d e$�Z%e	jLejNejPd!�d"�Gd#�d$e$���Z)d%�Z*e+d&k(rejX�yy)'�N)�
namedtuple)�support)�run_python_until_end�Cz
invalid.ascii�asciiT)zC.UTF-8zC.utf8�UTF-8�linux�utf-8�POSIX�aixz	iso8859-1�darwin�cygwinF�vxworks)r
r	�nl_langinfo�CODESETc�~�d}tr|dz
}|j|�}td|d��\}}|jdk(S)Nz=import locale; print(locale.setlocale(locale.LC_CTYPE, '{}'))z>; import sys; sys.exit(not locale.nl_langinfo(locale.CODESET))�-c���PYTHONCOERCECLOCALEr)�_check_nl_langinfo_CODESET�formatr�rc)�locale_name�cmd_fmt�cmd�result�py_cmds     �8/usr/local/lib/python3.12/test/test_c_locale_coercion.py�_set_locale_in_subprocessr WsC��M�G�!��S�S��
�.�.��
%�C�)�$���L�N�F�F��9�9��>��zBfsencoding stdin_info stdout_info stderr_info lang lc_ctype lc_all�EncodingDetailsc�R�eZdZdjgd��Zed��Zed��Zy)r"�;)zimport sys, osz"print(sys.getfilesystemencoding())z2print(sys.stdin.encoding + ':' + sys.stdin.errors)z4print(sys.stdout.encoding + ':' + sys.stdout.errors)z4print(sys.stderr.encoding + ':' + sys.stderr.errors)z(print(os.environ.get('LANG', 'not set'))z,print(os.environ.get('LC_CTYPE', 'not set'))z*print(os.environ.get('LC_ALL', 'not set'))c�J�|dz}|�d}|j|�gdz}|j|jd��|jdd�}|rt}	n|jdd�}	|jdd�}
||	|
f}t	||g|�|���j��S)	z;Returns expected child process details for a given encodingz:{}�surrogateescape��backslashreplace�LANGznot set�LC_CTYPE�LC_ALL)r�append�get�CLI_COERCION_TARGET�dict�_asdict)�cls�coercion_expected�fs_encoding�stream_encoding�
stream_errors�env_vars�_stream�stream_info�
expected_lang�expected_lc_ctype�expected_lc_all�env_infos            r�get_expected_detailsz$EncodingDetails.get_expected_detailsrs���"�E�)��� �.�M��~�~�m�4�5��9��	���7�>�>�*<�=�>� ���V�Y�7�
�� 3�� (���Z�� C��"�,�,�x��;�� �"3�_�D���C��=�k�=�H�=�E�E�G�H�Hr!c�z�tddd|jfi|��\}}|jdk(s|j|�|jjd�j
�}t||�j��}|jjd�j�j
�}||fS)ajRetrieves fsencoding and standard stream details from a child process

        Returns (encoding_details, stderr_lines):

        - encoding_details: EncodingDetails for eager decoding
        - stderr_lines: result of calling splitlines() on the stderr output

        The child is run in isolated mode if the current interpreter supports
        that.
        z-Xzutf8=0rrr)r�CHILD_PROCESS_SCRIPTr�fail�out�decode�
splitlinesr/r0�err�rstrip)r1r6rr�stdout_lines�child_encoding_details�stderr_liness       r�get_child_detailsz!EncodingDetails.get_child_details�s���.��(�D�#�":�":�
��
�����y�y�A�~��K�K����z�z�(�(��1�<�<�>��!%�c�<�&8�&@�&@�&B�!C���z�z�(�(��1�8�8�:�E�E�G��%�|�3�3r!N)�__name__�
__module__�__qualname__�joinr?�classmethodr=rI�r!rr"r"es@���8�8�	%�	���I��I�*�4��4r!z�Python runtime initialized with LC_CTYPE=C (a locale with default ASCII encoding), which may cause Unicode compatibility problems. Using C.UTF-8, C.utf8, or UTF-8 (if available) as alternative Unicode-compatible locales is recommended.z�Python detected LC_CTYPE=C: LC_CTYPE coerced to {} (set another locale or PYTHONCOERCECLOCALE=0 to disable this locale coercion behavior).c���t�ygatD]#}t|�s�tj|��%tr"tdat
j
t�atjrtdt���tdt���tdt���tdt���tdt���tdt���tdt���yy)	NrzAVAILABLE_TARGETS = z EXPECTED_C_LOCALE_EQUIVALENTS = z$EXPECTED_C_LOCALE_STREAM_ENCODING = z EXPECTED_C_LOCALE_FS_ENCODING = z$EXPECT_COERCION_IN_DEFAULT_LOCALE = z_C_UTF8_LOCALES = z_check_nl_langinfo_CODESET = )�AVAILABLE_TARGETS�_C_UTF8_LOCALESr r,r.�CLI_COERCION_WARNING_FMTr�CLI_COERCION_WARNINGr�verbose�print�EXPECTED_C_LOCALE_EQUIVALENTS�!EXPECTED_C_LOCALE_STREAM_ENCODING�EXPECTED_C_LOCALE_FS_ENCODING�!EXPECT_COERCION_IN_DEFAULT_LOCALEr)�
target_locales r�setUpModuler\�s���
�$����)�
�$�]�3��$�$�]�3�)��/��2��7�>�>�?R�S�����
�$�%6�$9�:�;�
�0�1N�0Q�R�S�
�4�5V�4Y�Z�[�
�0�1N�0Q�R�S�
�4�5V�4Y�Z�[�
�"�?�"5�6�7�
�-�.H�-K�L�M�r!c��eZdZd�Zy)�_LocaleHandlingTestCasec��tj|�}|\}}	tj|||||�}
|j||
�|�g}|j|	|�y)a5Check the C locale handling for the given process environment

        Parameters:
            expected_fs_encoding: expected sys.getfilesystemencoding() result
            expected_stream_encoding: expected encoding for standard streams
            expected_warning: stderr output to expect (if any)
        N)r"rIr=�assertEqual)�selfr6�expected_fs_encoding�expected_stream_encoding�expected_stream_errors�expected_warningsr2r�encoding_detailsrH�expected_detailss           r�_check_child_encoding_detailsz5_LocaleHandlingTestCase._check_child_encoding_details�sp��!�2�2�8�<��)/�&��,�*�?�?�� �$�"��
��	
���)�+;�<��$� "������'8�9r!N)rJrKrLrhrOr!rr^r^�s��:r!r^c�(�eZdZed��Zd�Zd�Zy)�LocaleConfigurationTestsc�:�tstjd��y)Nz No C-with-UTF-8 locale available)rQ�unittest�SkipTest)r1s r�
setUpClassz#LocaleConfigurationTests.setUpClass�s��!��#�#�$F�G�G�!r!c��d|_d}d}dddddd�}dD]`}tD]U}|dk(r|dk(r�|j||��5|j�}|||<|j	|||ddd�	�ddd��W�by#1swY�dxYw)
Nr
r�r)r*r+r�PYTHONIOENCODING�r)r*r)r��env_var�configured_localeF�rdrer2��maxDiffrQ�subTest�copyrh�rarbrc�
base_var_dictrt�
locale_to_set�var_dicts       r�)test_external_target_locale_configurationzBLocaleConfigurationTests.test_external_target_locale_configuration�s������&��#*� ����#%� "�
�
�,�G�!2�
��f�$��'�)A���\�\�'�4A�"�C�,�1�1�3�H�(5�H�W�%��6�6�x�7K�7O�NR�IM�IN�7�P�	C�C�"3�,�C�C���-A:�:Bc��d|_d}d}dddddd�}dD]`}tD]U}|dk(r|dk(r�|j||��5|j�}|||<|j	|||ddd	�
�ddd��W�by#1swY�dxYw)Nr
rrrprrr)rs�strictFrvrwr{s       r�test_with_ioencodingz-LocaleConfigurationTests.test_with_ioencodings������&��#*� ����#%� '�
�
�,�G�!2�
��f�$��'�)A���\�\�'�4A�"�C�,�1�1�3�H�(5�H�W�%��6�6�x�7K�7O�NV�IM�IN�7�P�	C�C�"3�,�C�C�r�N)rJrKrLrNrnrr�rOr!rrjrj�s%���H��H�!P�F Pr!rj�PY_COERCE_C_LOCALEz(C locale coercion disabled at build timec�<�eZdZ		d	d�Zd�Zd�Zd�Zd�Zd�Zd�Z	y)
�LocaleCoercionTestsNc�,�d|_tst}t}d}|rtg}dddddd�}|j|�|�||d<|j
d|��5tr|}|}	nd}d}	tjr|tgk(rd}|j|||d||	�ddd�tD]R}
dD]K}|j
||
|d�	�5|j�}|
||<|j|||d||�ddd��M�Ty#1swY�exYw#1swY�fxYw)
aCheck the C locale handling for various configurations

        Parameters:
            fs_encoding: expected sys.getfilesystemencoding() result
            stream_encoding: expected encoding for standard streams
            coerce_c_locale: setting to use for PYTHONCOERCECLOCALE
              None: don't set the variable at all
              str: the value set in the child's environment
            expected_warnings: expected warning lines on stderr
            extra_vars: additional environment variables to set in subprocess
        NFrrprT)�default_localerrr)rt�nominal_localerrq)rxrQrYrX�LEGACY_LOCALE_WARNING�updateryrZr�
is_androidrTrhrWrz)
rar3r4�coerce_c_localerer2�
extra_varsr|�_expected_warnings�_coercion_expectedr}rtr~s
             r�_check_c_locale_coercionz,LocaleCoercionTests._check_c_locale_coercionGsd��"��� �7�K�?�O� %�� �%:�$;�!����#%� "�
�
�	���Z�(��&�3B�M�/�0��\�\��.=��?�0�%6�"�%6�"�%)�"�%*�"�
�"�"�&�+?�*@�@�%)�"��.�.�}�/:�/>�/3�/A�/A�
C�?�.;�M�/���\�\�'�1>�6E�35�"�7� -�1�1�3�H�(5�H�W�%��6�6�x�7B�7F�7;�7H�7H�J�7�7�0�;�/?�?��27�7�s�AC>�,D
�>D�
Dc�,�|jddd��y)Nr
�r��r��ras r� test_PYTHONCOERCECLOCALE_not_setz4LocaleCoercionTests.test_PYTHONCOERCECLOCALE_not_set�s���%�%�g�w��%�Mr!c�:�dD]}|jdd|���y)N)r�1�true�falser
r�r�)ra�settings  r�!test_PYTHONCOERCECLOCALE_not_zeroz5LocaleCoercionTests.test_PYTHONCOERCECLOCALE_not_zero�s#��2�G��)�)�'�7�G�)�T�2r!c�8�|jdddtg��y)Nr
�warn)r�re)r�rTr�s r�$test_PYTHONCOERCECLOCALE_set_to_warnz8LocaleCoercionTests.test_PYTHONCOERCECLOCALE_set_to_warn�s#���%�%�g�w�6<�9M�8N�	&�	Pr!c�z�|jttdd��|jttddd��y)N�0F)r�r2r�r�r+r2)r�rYrXr�s r�$test_PYTHONCOERCECLOCALE_set_to_zeroz8LocaleCoercionTests.test_PYTHONCOERCECLOCALE_set_to_zero�sE���%�%�&C�&G�69�8=�	&�	?�
	
�%�%�&C�&G�69�-0�8=�		&�	?r!c��|jttddd��|jttddtgd��y)NrFr�r�)r�r+rer2)r�rYrXr�r�s r�test_LC_ALL_set_to_Cz(LocaleCoercionTests.test_LC_ALL_set_to_C�sN���%�%�&C�&G�6:�-0�8=�		&�	?�	
�%�%�&C�&G�6<�-0�9N�8O�8=�	&�	?r!c���tjtjd�}|jtjtj|�	tjtjd�}dk(r|jd�|tvr|jd|z�d}ttjd��}tjtjd|gtj|d	�
�}|j!|j"j%�|�y#tj$r$}|jt
|��Yd}~��d}~wwxYw)Nrrz.test requires LC_CTYPE locale different than Czcoerced LC_CTYPE locale: %sz=import locale; print(locale.setlocale(locale.LC_CTYPE, None))r�rrT)�stdout�env�text)�locale�	setlocaler*�
addCleanup�Error�skipTest�str�TARGET_LOCALESr/�os�environ�
subprocess�run�sys�
executable�PIPEr`r�rE)ra�old_loc�loc�e�coder�rs       r�#test_PYTHONCOERCECLOCALE_set_to_onez7LocaleCoercionTests.test_PYTHONCOERCECLOCALE_set_to_one�s���"�"�6�?�?�D�9������(�(�&�/�/�7�C�	"��"�"�6�?�?�B�7�C��#�:��M�M�J�K��.� ��M�M�7�#�=�>�O���2�:�:�3�7���n�n�c�n�n�d�D�9�$.�O�O�!$�"&�(��	
������*�*�,�c�2���|�|�	"��M�M�#�a�&�!�!��	"�s�$D+�+E"�>E�E")NT)
rJrKrLr�r�r�r�r�r�r�rOr!rr�r�As3��48�37�	LJ�\N�U�P�?�
?�3r!r�c�,�tj�y)N)r�
reap_childrenrOr!r�tearDownModuler��s�����r!�__main__)-r�r�r�r��	sysconfigrl�collectionsr�testr�test.support.script_helperrrWrXrYrZr��platform�
startswithr�r,rR�bool�hasattrrr �_fields�_EncodingDetailsr"r�rSrQr.rTr\�TestCaser^rj�cpython_only�
skipUnless�get_config_varr�r�rJ�mainrOr!r�<module>r�s���	��
���"��;�"%�o� 6��%,�!� '��%)�!�/���<�<���7�#����,3�)�(/�%�	&�,�,�W�5��\�\���U�#�(3�%�$/�!��\�\�X��$+�!��\�\�X��).�%��\�\�Y��(/�%�$+�!�1��"��L�L�+�+���F�M�"���F�I�����O���/��9��94�&�94�|��J��������N�<:�h�/�/�:�@MP�6�MP�^	�������-�Y�-�-�.B�C�?�A�S3�1�S3�A��S3�l��z���H�M�M�O�r!

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