%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/test/libregrtest/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/test/libregrtest/__pycache__/utils.cpython-312.pyc

�

3�+g�T���ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZmZddlmZddlmZddlmZdZeZedzZdZd	Zed
zZeZeZeZ e!edfZ"e#eZ$e#e!ee%fZ&e!edfZ'e(ee'fZ)d�Z*d
e#edzddfd�Z+d8d�Z,d�Z-d9d�Z.d�Z/da0d�Z1d�Z2da3d�Z4d�Z5d�Z6d�Z7d8dedzdefd�Z8d�Z9d:dede%defd �Z:ejvd!��Z<d"ed#e=ddfd$�Z>d"ed%edzdefd&�Z?e@d'�ZAdd(�d)�ZBd*�ZCd+�ZDd,�ZEd-eefd.�ZFd/�ZGd-e!edfd0e!edfdzfd1�ZHdefd2�ZId3d4d5d6�ZJd7�ZKy);�N)�Callable�Iterable)�support)�	os_helper)�threading_helper�test_python_�worker_g^@)
�audio�curses�	largefile�network�decimal�cpu�
subprocess�urlfetch�gui�walltime)�extralargefile�tzdata.c��tj|dz�}t|d�\}}t|d�\}}t|d�\}}g}|r|jd|z�|r|jd|z�|r1|r|jd|z�n|jd||dzzz�|sd|zS|dd	}d
j	|�S)Ng@�@i��<z%s hourz%s minz%s secz%.1f secz%s ms�� )�math�ceil�divmod�append�join)�seconds�ms�minutes�hours�partss     �-/usr/lib/python3.12/test/libregrtest/utils.py�format_durationr%<s���	
���7�S�=�	!�B���T�"�K�G�R��g�r�*��G�W��G�R�(�N�E�7��E��
���Y��&�'��
���X��'�(����L�L��G�+�,�
�L�L��w��d��':�;�<����|���"�1�I�E��8�8�E�?���names�returnc��|syt|�D]2\}}tjj|�\}}|dk(s�.|||<�4y)Nz.py)�	enumerate�os�path�splitext)r'�idx�name�basename�exts     r$�strip_py_suffixr2UsH�����u�%�"�	��T����(�(��.�
��#��%�<�!�E�#�J�"r&c�"�|dk(r|S|�|S|dzS)N��s�)�n�singular�plurals   r$r9r9^s#���A�v���	�	��
��#�~�r&c�*�|dk(r|�d|��S|�d|�d�S)Nr4rr5r6)r7�words  r$�countr<gs+���A�v���A�d�V�}����A�d�V�1�~�r&c
��d|z}ttjdjd�t	|�D��|||��|��y)z�Print the elements of iterable x to stdout.

    Optional arg width (default 70) is the maximum line length.
    Optional arg indent (default 4) is the number of blanks with which to
    begin each line.
    rc3�2K�|]}t|����y�w�N)�str)�.0�elts  r$�	<genexpr>zprintlist.<locals>.<genexpr>xs���� ?�c��S�� ?�s�)�initial_indent�subsequent_indent)�fileN)�print�textwrap�fillr�sorted)�x�width�indentrF�blankss     r$�	printlistrOns@���6�\�F�	�(�-�-���� ?�V�A�Y� ?�?��'-��I��r&c�.�tj|�yr?)r�
print_warning)�msgs r$rQrQ}s�����#�r&c�\�dt_tjd�tj}	tj
�tjjt_t|�tjj�|t_y#|t_wxYw)NTzUnraisable exception)	r�environment_alteredrQ�sys�stderr�flush_std_streams�orig_stderr�orig_unraisablehook�flush)�
unraisable�
old_stderrs  r$�regrtest_unraisable_hookr]�sm��"&�G�����0�1����J� ��!�!�#��*�*�6�6��
��J�'��
�
������
��Z��
�s�A B�
B+c�B�tjatt_yr?)rU�unraisablehookrYr]r6r&r$�setup_unraisable_hookr`�s���,�,��1�C�r&c��dt_tjd|jj���t
j}	tj�tjjt
_t|�t
jj�|t
_y#|t
_wxYw)NTzUncaught thread exception: )rrTrQ�exc_type�__name__rUrVrWrX�orig_threading_excepthookrZ)�argsr\s  r$�regrtest_threading_excepthookrf�s��"&�G�����7��
�
�8N�8N�7O�P�Q����J� ��!�!�#��*�*�6�6��
�!�$�'��
�
������
��Z��
�s
�	A B5�5
Cc�:�ddl}|jat|_y�Nr)�	threading�
excepthookrdrf)ris r$�setup_threading_excepthookrk�s��� )� 4� 4��8�I�r&c��tjj�D]}t|d�s�|`�tj
tjtjtjfD]}|��|j��	tjd}|j�	tjd}|jj�	tjd}|j�	tjd}|j�	tjd}|j!�	tjd}|j#�	tjd}|j$j�	tjd	}	|	j'�	tjd
}
d|
_	tjd}|j+�	tjd}|j,D]	}
|
��		tjd
}|j.j1�	tjd}|j2j1�|j4j�|j6j�	tjd}|j8j:j1�y#t$rY��QwxYw#t$rY��3wxYw#t$rY��wxYw#t$rY��wxYw#t$rY���wxYw#t$rY���wxYw#t$rY���wxYw#t$rY���wxYw#t$rY���wxYw#t$rY���wxYw#t$rY��uwxYw#t$rY��WwxYw#t$rY��wxYw#t$rYywxYw)N�__warningregistry__�re�	_strptimezurllib.parsezurllib.request�	linecache�	mimetypes�filecmp�struct�doctest�ctypes�typing�	fractions�inspectzimportlib.metadata)rU�modules�values�hasattrrm�stdoutrV�
__stdout__�
__stderr__rZ�purge�KeyError�_regex_cache�clear�clear_cache�
urlcleanup�
clearcache�_default_mime_types�_cache�_clearcache�master�_reset_cache�	_cleanups�_hash_algorithm�cache_clear�_shadowed_dict_from_mro_tuple�_filesbymodname�
modulesbyfile�FastPath�__new__)�mod�streamrnro�urllib_parse�urllib_requestrprqrrrsrtrurv�frwrx�importlib_metadatas                 r$�clear_cachesr��s����{�{�!�!�#�(���3�-�.��'�(��:�:�s�z�z�3�>�>�3�>�>�J������L�L�N���
�[�[��
��	���
�'��K�K��,�	�	���$�$�&�#��{�{�>�2��	� � �"�$����%5�6��	�!�!�#���K�K��,�	�	����(��K�K��,�	�	�%�%�'���+�+�i�(��	����������X�&��	������+�+�i�(���������X�&��	��������X�&���!�!�	�A�
�C�	�0��K�K��,�	�	�!�!�-�-�/�&��+�+�i�(��	�-�-�9�9�;����%�%�'����#�#�%�:� �[�[�)=�>��	�#�#�+�+�7�7�9��C�
��
���
��
���
��
���
��
���
��
���
��
���
��
���
��
���
��
���
��
���
��
���
��
���
��
���
��
�s��
K2�.L�L�L"�$L2�M�,M�M"�>M2�N�=N�*N"�N2�:O�2	K?�>K?�	L�L�	L�L�"	L/�.L/�2	L?�>L?�	M�M�	M�M�"	M/�.M/�2	M?�>M?�	N�N�	N�N�"	N/�.N/�2	N?�>N?�	O�
Oc�T�tjd�xsd}tjd�xsd}tjd�xsd}tjd�xsd}g}tjd�r|jd�ttd�r*|jd	�d
||zvrQ|jd�n?|jd�d
|vr|jd�nd
||zvr|jd�tjd�}|r|jd|���ttjd�xsd�}|r|jd�g}d|vr|jd�nd|vr|jd�t
j�r|jd�|r |jdj|��g}t
jd��r|jd�t
jd��r|jd�t
jd��r|jd �t
jd�!�r|jd"�|r |jdj|��ttd#�r|jd$�ttd%�r|jd&�tjd'�r|jd(�tjd)�r|jd*�|S)+N�CONFIG_ARGS��	PY_CFLAGS�PY_CFLAGS_NODIST�PY_LDFLAGS_NODIST�Py_NOGIL�nogil�gettotalrefcount�debugz-DNDEBUG�without_assert�releasez--with-assertions�with_assert�PYTHONFRAMEWORKz
framework=�PY_ENABLE_SHARED�0�sharedz
-flto=thin�ThinLTOz-flto�LTO�PGO�+T��address�ASAN��memory�MSAN��ub�UBSAN��thread�TSAN�
getobjects�	TraceRefs�	_stats_on�pystats�
WITH_VALGRIND�valgrind�WITH_DTRACE�dtrace)
�	sysconfig�get_config_varrr{rU�intr�check_cflags_pgor�check_sanitizer)	�config_args�cflags�
cflags_nodist�ldflags_nodist�build�	frameworkr��
optimizations�
sanitizerss	         r$�get_build_infor�"s����*�*�=�9�?�R�K�
�
%�
%�k�
2�
8�b�F��,�,�-?�@�F�B�M��-�-�.A�B�H�b�N��E����
�+�
���W���s�&�'�
���W���&�=�0�1��L�L�)�*�
���Y���+�-��L�L��'�
��� 6�
7��L�L��'��(�(�):�;�I��
���z�)��-�.���)�)�*<�=�D��
E�F�
�
���X���M��~�%����Y�'�	�N�	"����U�#����!����U�#��
���S�X�X�m�,�-��J����t�,����&�!����d�+����&�!����$�'����'�"����d�+����&�!��
���S�X�X�j�)�*��s�L�!�
���[�!��s�K� �
���Y������0�
���Z� ����
�.�
���X���Lr&�tmp_dirc��|r!tjj|�}�ntj�r�t
jsqtjd�}|�9tjd�}|s"tjd�}|std��tjj|d�}nrtjd�}|std|�d���tjj|d�}tj|d	�
�ntj�}tjj|�S)N�abs_builddir�
abs_srcdir�srcdirz1Could not determine the correct value for tmp_dirr��projectbasez>sysconfig.get_config_var('projectbase') unexpectedly returned z on WASIT)�exist_ok)r+r,�
expanduserr��is_python_buildr�is_wasir��RuntimeErrorr�makedirs�tempfile�
gettempdir�abspath)r�s r$�get_temp_dirr�vs����'�'�$�$�W�-��
�$�$�&��?�?�#�2�2�>�B���?�'�6�6�|�D�G�"�
#,�":�":�8�"D��&�".� S�#���'�'�,�,�w��8��$�2�2�=�A���&�1�18��8�E����'�'�,�,�w��8�����G�d�3��)�)�+�G�
�7�7�?�?�7�#�#r&c��tjrFtjd�}|dk(rtjd�ytj|�yy)Nri��)r�
is_emscriptenr+�umask)�old_masks r$�	fix_umaskr��s>������8�8�A�;���u���H�H�U�O��H�H�X��r&F�
parent_dir�workerc�P�tjstjrtjdd�}ntj�}|rtt|�z}ntt|�z}|tjz
}t
jj||�}|S)Nri@B)rr�r��random�randintr+�getpid�WORK_DIR_PREFIXr@�WORKER_WORK_DIR_PREFIXr�FS_NONASCIIr,r)r�r��nounce�work_dirs    r$�get_work_dirr��sv������������9�-�������
�"�S��[�0��)�C��K�7���	�%�%�%�H��w�w�|�|�J��1�H��Or&c#��K�	d��y#t$rT}tjrtjt
d��t
j|j�Yd}~yd}~wwxYw�w)NT)�exit)	�
SystemExitr�can_start_thread�faulthandler�dump_traceback_later�EXIT_TIMEOUTrUr��code)�excs r$�exit_timeoutr��sK�����
�����,�,��-�-�l��F�����������s+�A)�	�A)�	A&�A
A!�A)�!A&�&A)�	test_name�verbosec
�p�tj}tjj	|�sytjj|�rddl}d|j}}nAtjj|�rdtj}}ntd|�d���|rt|�d|�d|���dt_
	ddl}tj||j |j"z|j$z�||�y#t&$r }t|�d|�d|�d	|���Yd}~yd}~wwxYw)
Nr�	directoryrFz
os.path says z) exists but is neither directory nor filez
 left behind rTz and it couldn't be removed: )r�TESTFNr+r,�exists�isdir�shutil�rmtree�isfile�unlinkr�rQrrT�stat�chmod�S_IRWXU�S_IRWXG�S_IRWXO�	Exception)r�r�r/r�kind�nukerrr�s        r$�
remove_testfnr�s�����D�
�7�7�>�>�$���
�w�w�}�}�T���!�6�=�=�e��	������	��b�i�i�e���]�4�(�30�1�2�	2�����=���a��x�@�A�&*��#�<��
����t�|�|�d�l�l�2�T�\�\�A�B�
�d����<����=���a��x�@5�58�E�;�	<�	<��<�s�AD�	D5�D0�0D5�test_dirc�6�|jd�s|r|Sd|zS)Nztest.)�
startswith)r�rs  r$�abs_module_namer�s%�����G�$������"�"r&)�
setUpClass�
tearDownClass�setUpModule�tearDownModule)�is_errorc���|jd�d}|rV|tvrN|jd�ry|jd�}|jd�}||dz|jd�dS|S)	Nrr)z
setUpModule (ztearDownModule (�(�)r4�.���)�split�_TEST_LIFECYCLE_HOOKSr�index)�test_full_namer�
short_name�lpar�rpars     r$�normalize_test_namer&s���%�%�c�*�1�-�J��J�"7�7��$�$�%J�K���#�#�C�(���#�#�C�(���d�Q�h��-�3�3�C�8��<�<��r&c
�^�	ddl}|j|j�\}}d}||krC||kr=t	||�}	|j|j||f�t
d|�d|���yyy#t$rYywxYw#ttf$r}td|�d|�d|�d	��Yd}~yd}~wwxYw)
z�
    On macOS the default fd limit (RLIMIT_NOFILE) is sometimes too low (256)
    for our test suite to succeed. Raise it to something more reasonable. 1024
    is a common Linux default.
    rNizRaised RLIMIT_NOFILE: z -> z#Unable to raise RLIMIT_NOFILE from z to z: r)
�resource�ImportError�	getrlimit�
RLIMIT_NOFILE�min�	setrlimitrG�
ValueError�OSErrorrQ)r(�fd_limit�max_fds�desired_fds�new_fd_limit�errs      r$�adjust_rlimit_nofiler5s�����!�*�*�8�+A�+A�B��H�g��K��+��(�W�"4��;��0��	5����x�5�5� ,�g�6�
8��*�8�*�D���G�H�#5���������G�$�	5��?��z��)�N�"�S�E��4�
5�
5��	5�s(�A/�/A>�/	A;�:A;�>B,�
B'�'B,c�r�tjjd�x}�tjd�}|S)N�_PYTHON_HOSTRUNNER�
HOSTRUNNER)r+�environ�getr�r�)�
hostrunners r$�get_host_runnerr<1s1���j�j�n�n�%9�:�:�
�C��-�-�l�;�
��r&c�&�dtjvS)N�_PYTHON_HOST_PLATFORM)r+r9r6r&r$�is_cross_compiledr?7s��#�r�z�z�1�2r&�
use_resourcesc��t|�}tt�}dg}t||z
�D]}|jd|����t||z
�D]}|j|���dj	|�}d|��}dj	t|��}dt|��d|��}t|�t|�kr|S|S)N�all�-�,zresources: zresources (z): )�set�
ALL_RESOURCESrJrr�len)r@�
all_resources�relative_allr/�all_text�texts      r$�format_resourcesrL;s����
�&�M��
�&�M��7�L��}�}�4�5�(�����a��v�J�'�(��}�}�4�5�'�����t�f�&�'��x�x��%�H��X�J�'�H��8�8�F�=�)�*�D�
��]�+�,�C��v�6�D��8�}��D�	�!����r&c��ttd�rttjd��Stj�S)N�sched_getaffinityr)r{r+rGrN�	cpu_countr6r&r$�process_cpu_countrPSs/���r�&�'��2�'�'��*�+�+��|�|�~�r&�
python_cmdc��tdtj�gtjj����tdtjd��dtjz�tddjt���tdtj��tj�}|r%t�}|r
||k7r|�d|�d	�}td
|�tdtj��dtj����|rt!|�}td
|���ntd�t#�}|rtd�|r�t%j|�}td|���g|�d�d�}t'j(|t&j*dt,j.��}|j0j3dd�j5�}	|	rtd|	���n@|j6r4td|j6�d��nt9�}
|
rtd|
���t;j<d��}t;j<d��}t;j<d��}
t;j<d��}g}|r|j?d�|r|j?d�|
r|j?d�|r|j?d �|ritd!d"j|����|d#f|d$f|
d%f|d&ffD];\}}tj@jC|�}|s�(|��+td
|�d'|����=td�(�y))Nz==T)�aliasedz	%s-endianz== Python build:rz== cwd:z
 (process) / z	 (system)z
== CPU count:z== encodings: locale=z FS=z== zL== resources: all test resources are disabled, use -u option to unskip testsz== cross compiled: Yesz== host python: z-m�platform)r|rK�cwd�
z== host platform: z1== host platform: <command failed with exit code �>z== host runner: r�r�r�r�r�r�zundefined behaviorr�z== sanitizers: z, �ASAN_OPTIONS�MSAN_OPTIONS�
UBSAN_OPTIONS�TSAN_OPTIONS�=)rZ)"rGrT�python_implementationrU�versionr�	byteorderrr�r+�getcwdrOrP�locale�getencoding�getfilesystemencodingrLr?�shlexr�run�PIPEr�SAVEDCWDr|�replace�strip�
returncoder<rr�rr9r:)r@rQrO�affinityrK�
cross_compile�cmd�get_cmd�procr|r;�asan�msan�ubsan�tsanr��	sanitizer�env_var�optionss                   r$�display_headerrwZs���
�$��.�.�0�G�3�;�;�3D�3D�3F�G�	�$��!�!�$�/���
�
�-�/�	�
�c�h�h�~�'7�8�9�	�)�R�Y�Y�[�!�����I��$�&����I�-�#�*�M�)��I�F�I�
�o�y�)�	�
�
�
�
!�3�#<�#<�#>�@�A���
�.��
��D�6�l��
�.�	/�&�'�M��
�&�'���j�j��$��
� ���&�'�1�J�1��1�j�1���~�~���?�?���"�"�	$��
���$�$�T�3�/�5�5�7����&�v�h�/�0�
�_�_��E�d�o�o�EV�VW�X�Y�$�&�
���$�Z�L�1�2��"�"�4�0�D��"�"�$�/�D��#�#�t�,�E��"�"�$�/�D��J�����)�$�����(�#�����.�/�����(�#��
���	�	�*� 5�6�7�8�
�>�"�
�>�"�
�O�$�
�>�"�	#
�	3��I�w��Z�Z�^�^�G�,�G��W�0���G�9�A�g�[�1�2�	3�
��r&c��ddl}tjj|j	|�t
dz�}t
d|z�|j|�D]h}tjj|�r$t
d|z�tj|��Ft
d|z�tj|��jy)Nr�*zCleanup %s directoryzRemove directory: %szRemove file: %s)�globr+r,r�escape�
TMP_PREFIXrGrrrr)r�rzr,r/s    r$�cleanup_temp_dirr}�s����
�7�7�<�<����G�,�j�3�.>�?�D�	�
 �7�
*�+��	�	�$��#��
�7�7�=�=����(�4�/�0����T�"��#�d�*�+����T�"�
#r&�STATUS_ACCESS_VIOLATION�STATUS_STACK_OVERFLOW�STATUS_CONTROL_C_EXIT)ll�l:c��|dkr#|}	tj|�jS	t|S#t$rY�wxYw#t
$rYywxYwrh)�signal�Signalsr/r.�WINDOWS_STATUSr�)�exitcode�signums  r$�get_signal_namer��sd���!�|����	��>�>�&�)�.�.�.�
��h�'�'��	�	��	��
�
���
�s�3�A�	?�?�	A�
Ar?)�F�N)F)L�
contextlibr�rar�os.pathr+rTr�rdr�rrUr�r�rH�collections.abcrr�testr�test.supportrrr|r�r�r�rF�RESOURCE_NAMESr@�StrPath�TestName�StrJSON�tuple�	TestTuple�list�TestList�bool�
TestFilter�FilterTuple�dict�
FilterDictr%r2r9r<rOrQrYr]r`rdrfrkr�r�r�r�r��contextmanagerr�r�rr�	frozensetr r&r5r<r?rLrPrwr}r�r�r6r&r$�<module>r�sI����
����
��
��
����.��"�)�
�
���(�9�4��
��P�
��!=�=������

���(�C�-� �	���>���%��$��'�
(�
��H�c�M�"��
�(�K�'�
(�
��2"�4��9�t�+�"��"������� �2�!�� �9�o:�dQ�h)$�'�D�.�)$�G�)$�X��W��d��w��(������"<�X�"<��"<��"<�J#�x�#�7�T�>�#�h�#�"�#���
5:��*5�4�3��H�S�M��0�K�%��S��/�K�$�S�#�X���5�K�\#�g�#�*�'�'���
r&

Zerion Mini Shell 1.0