%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__/save_env.cpython-312.pyc

�

3�+g�2��z�ddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
Gd�de�ZGd�d	�Z
y)
�N)�support)�	os_helper�)�
print_warningc��eZdZy)�SkipTestEnvironmentN)�__name__�
__module__�__qualname__���0/usr/lib/python3.12/test/libregrtest/save_env.pyrr
s��r
rc
��eZdZdZd�ZdZd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/d.�Z0d/�Z1d0�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9e:e;�D����cgc]#}|jyd8�rt{tv|���%c}}}}Z>d9�Z?d:�Z@d;�ZAd<�ZBd=�ZCd>�ZDd?�ZEy@cc}}}}w)A�saved_test_environmenta�Save bits of the test environment and restore them at block exit.

        with saved_test_environment(test_name, verbose, quiet):
            #stuff

    Unless quiet is True, a warning is printed to stderr if any of
    the saved items was changed by the test. The support.environment_altered
    attribute is set to True if a change is detected.

    If verbose is more than 1, the before and after state of changed
    items is also printed.
    c�<�||_||_||_||_y�N)�	test_name�verbose�quiet�pgo)�selfrrrrs     r�__init__zsaved_test_environment.__init__'s��"��������
���r
)zsys.argv�cwdz	sys.stdinz
sys.stdoutz
sys.stderrz
os.environzsys.pathzsys.path_hooks�
__import__zwarnings.filterszasyncore.socket_mapzlogging._handlerszlogging._handlerListzsys.gettracezsys.warnoptionsz!multiprocessing.process._danglingzthreading._danglingzsysconfig._CONFIG_VARSzsysconfig._INSTALL_SCHEMES�files�localezwarnings.showwarning�shutil_archive_formats�shutil_unpack_formatsz!asyncio.events._event_loop_policyzurllib.requests._url_tempfileszurllib.requests._openerc�(�tj|Sr)�sys�modules�r�names  r�
get_modulez!saved_test_environment.get_moduleFs���{�{�4� � r
c�L�	|j|�S#t$rt�wxYwr)r$�KeyErrorrr"s  r�try_get_modulez%saved_test_environment.try_get_moduleJs+��	&��?�?�4�(�(���	&�%�%�	&�s��#c�N�|jd�}t|j�S�Nzurllib.request)r'�list�_url_tempfiles�r�urllib_requests  r�"get_urllib_requests__url_tempfilesz9saved_test_environment.get_urllib_requests__url_tempfilesQs$���,�,�-=�>���N�1�1�2�2r
c�<�|D]}tj|��yr)r�unlink)r�	tempfiles�filenames   r�&restore_urllib_requests__url_tempfilesz=saved_test_environment.restore_urllib_requests__url_tempfilesTs��!�	'�H����X�&�	'r
c�<�|jd�}|jSr))r'�_openerr,s  r�get_urllib_requests__openerz2saved_test_environment.get_urllib_requests__openerXs���,�,�-=�>���%�%�%r
c�4�|jd�}||_yr))r$r5)r�openerr-s   r�restore_urllib_requests__openerz6saved_test_environment.restore_urllib_requests__opener[s�����)9�:��!'��r
c�L�|jd�tj�S�N�asyncio)r'r�maybe_get_event_loop_policy�rs r�%get_asyncio_events__event_loop_policyz<saved_test_environment.get_asyncio_events__event_loop_policy_s�����I�&��2�2�4�4r
c�H�|jd�}|j|�yr;)r$�set_event_loop_policy)r�policyr<s   r�)restore_asyncio_events__event_loop_policyz@saved_test_environment.restore_asyncio_events__event_loop_policybs���/�/�)�,���%�%�f�-r
c�x�ttj�tjtjddfSr)�idr �argvr>s r�get_sys_argvz#saved_test_environment.get_sys_argvf�#���#�(�(�|�S�X�X�s�x�x��{�2�2r
c�L�|dt_|dtjddy�Nr�)r rF)r�
saved_argvs  r�restore_sys_argvz'saved_test_environment.restore_sys_argvh����a�=��� ��m�����r
c�*�tj�Sr)�os�getcwdr>s r�get_cwdzsaved_test_environment.get_cwdls���y�y�{�r
c�.�tj|�yr)rP�chdir)r�	saved_cwds  r�restore_cwdz"saved_test_environment.restore_cwdns��
����r
c�"�tjSr�r �stdoutr>s r�get_sys_stdoutz%saved_test_environment.get_sys_stdoutq����z�z�r
c��|t_yrrX)r�saved_stdouts  r�restore_sys_stdoutz)saved_test_environment.restore_sys_stdouts�	��!��
r
c�"�tjSr�r �stderrr>s r�get_sys_stderrz%saved_test_environment.get_sys_stderrvr[r
c��|t_yrra)r�saved_stderrs  r�restore_sys_stderrz)saved_test_environment.restore_sys_stderrxr_r
c�"�tjSr�r �stdinr>s r�
get_sys_stdinz$saved_test_environment.get_sys_stdin{s���y�y�r
c��|t_yrrh)r�saved_stdins  r�restore_sys_stdinz(saved_test_environment.restore_sys_stdin}s	����	r
c��ttj�tjttj�fSr)rErP�environ�dictr>s r�get_os_environz%saved_test_environment.get_os_environ�s$���"�*�*�~�r�z�z�4��
�
�+;�;�;r
c��|dt_tjj�tjj|d�yrJ)rPro�clear�update)r�
saved_environs  r�restore_os_environz)saved_test_environment.restore_os_environ�s5��"�1�%��
�
�
�
����
�
�
���-��*�+r
c�x�ttj�tjtjddfSr)rEr �pathr>s r�get_sys_pathz#saved_test_environment.get_sys_path�rHr
c�L�|dt_|dtjddyrJ)r rx)r�
saved_paths  r�restore_sys_pathz'saved_test_environment.restore_sys_path�rNr
c�x�ttj�tjtjddfSr)rEr �
path_hooksr>s r�get_sys_path_hooksz)saved_test_environment.get_sys_path_hooks�s%���#�.�.�!�3�>�>�3�>�>�!�3D�D�Dr
c�L�|dt_|dtjddyrJ)r r~)r�saved_hookss  r�restore_sys_path_hooksz-saved_test_environment.restore_sys_path_hooks�s��$�Q����'��N����q�r
c�*�tj�Sr)r �gettracer>s r�get_sys_gettracez'saved_test_environment.get_sys_gettrace�s���|�|�~�r
c�.�tj|�yr)r �settrace)r�	trace_fxns  r�restore_sys_gettracez+saved_test_environment.restore_sys_gettrace�s�����Y�r
c�"�tjSr��builtinsrr>s r�get___import__z%saved_test_environment.get___import__�s���"�"�"r
c��|t_yrr�)r�import_s  r�restore___import__z)saved_test_environment.restore___import__�s
��%��r
c��|jd�}t|j�|j|jddfS�N�warnings)r'rE�filters�rr�s  r�get_warnings_filtersz+saved_test_environment.get_warnings_filters�s;���&�&�z�2���(�"�"�#�X�%5�%5�x�7G�7G��7J�J�Jr
c�^�|jd�}|d|_|d|jddy)Nr�rrK)r$r�)r�
saved_filtersr�s   r�restore_warnings_filtersz/saved_test_environment.restore_warnings_filters�s2���?�?�:�.��(��+���+�A�.�����r
c��tjjd�}|xr|jj	�xsiS)N�test.support.asyncore)r r!�get�
socket_map�copy)r�asyncores  r�get_asyncore_socket_mapz.saved_test_environment.get_asyncore_socket_map�s4���;�;�?�?�#:�;���6�H�/�/�4�4�6�<�"�<r
c��tjjd�}|�.|jd��|jj|�yy)Nr�T)�
ignore_all)r r!r��	close_allr�rt)r�	saved_mapr�s   r�restore_asyncore_socket_mapz2saved_test_environment.restore_asyncore_socket_map�sE���;�;�?�?�#:�;�������$��/����&�&�y�1� r
c�p�|jd�}|j|jj�fS�N�shutil)r'�_ARCHIVE_FORMATSr��rr�s  r�get_shutil_archive_formatsz1saved_test_environment.get_shutil_archive_formats�s4���$�$�X�.���&�&��(?�(?�(D�(D�(F�F�Fr
c��|jd�}|d|_|jj�|jj|d�y�Nr�rr)r$r�rsrt�r�savedr�s   r�restore_shutil_archive_formatsz5saved_test_environment.restore_shutil_archive_formats�sF������*��"'��(������%�%�'����&�&�u�Q�x�0r
c�p�|jd�}|j|jj�fSr�)r'�_UNPACK_FORMATSr�r�s  r�get_shutil_unpack_formatsz0saved_test_environment.get_shutil_unpack_formats�s2���$�$�X�.���%�%�v�'=�'=�'B�'B�'D�D�Dr
c��|jd�}|d|_|jj�|jj|d�yr�)r$r�rsrtr�s   r�restore_shutil_unpack_formatsz4saved_test_environment.restore_shutil_unpack_formats�sF������*��!&�q�������$�$�&����%�%�e�A�h�/r
c��|jd�}t|j�|j|jj�fS�N�logging)r'rE�	_handlersr��rr�s  r�get_logging__handlersz,saved_test_environment.get_logging__handlers�s?���%�%�i�0���'�#�#�$�g�&7�&7��9J�9J�9O�9O�9Q�Q�Qr
c��yrr)r�saved_handlerss  r�restore_logging__handlersz0saved_test_environment.restore_logging__handlers����r
c��|jd�}t|j�|j|jddfSr�)r'rE�_handlerListr�s  r�get_logging__handlerListz/saved_test_environment.get_logging__handlerList�s<���%�%�i�0���'�&�&�'��)=�)=�w�?S�?S�TU�?V�V�Vr
c��yrr)r�saved_handlerLists  r�restore_logging__handlerListz3saved_test_environment.restore_logging__handlerList�r�r
c�x�ttj�tjtjddfSr)rEr �warnoptionsr>s r�get_sys_warnoptionsz*saved_test_environment.get_sys_warnoptions�s%���#�/�/�"�C�O�O�S�_�_�Q�5G�G�Gr
c�L�|dt_|dtjddyrJ)r r�)r�
saved_optionss  r�restore_sys_warnoptionsz.saved_test_environment.restore_sys_warnoptions�s!��'��*���*�1�-�����r
c�>�tjj�Sr)�	threading�	_danglingr�r>s r�get_threading__danglingz.saved_test_environment.get_threading__dangling�s���"�"�'�'�)�)r
c�~�tjj�tjj|�yr)r�r�rsrt)rr�s  r�restore_threading__danglingz2saved_test_environment.restore_threading__dangling�s(�����!�!�#����"�"�5�)r
c�x�|jd�}|j�|jj�S�Nzmultiprocessing.process)r'�_cleanupr�r�)r�multiprocessing_processs  r�%get_multiprocessing_process__danglingz<saved_test_environment.get_multiprocessing_process__dangling�s5��"&�"5�"5�6O�"P���(�(�*�&�0�0�5�5�7�7r
c��|jd�}|jj�|jj|�yr�)r$r�rsrt)rr�r�s   r�)restore_multiprocessing_process__danglingz@saved_test_environment.restore_multiprocessing_process__dangling�s8��"&�/�/�2K�"L���)�)�/�/�1��)�)�0�0��7r
c��|jd�}|jd�t|j�|jt	|j�fS)N�	sysconfig�prefix)r'�get_config_varrE�_CONFIG_VARSrp�rr�s  r�get_sysconfig__CONFIG_VARSz1saved_test_environment.get_sysconfig__CONFIG_VARS�sN���'�'��4�	�� � ��*��9�)�)�*�I�,B�,B��Y�+�+�,�.�	.r
c��|jd�}|d|_|jj�|jj|d�y�Nr�rrK)r$r�rsrt�rr�r�s   r�restore_sysconfig__CONFIG_VARSz5saved_test_environment.restore_sysconfig__CONFIG_VARS�sF���O�O�K�0�	�!&�q��	�����$�$�&����%�%�e�A�h�/r
c��|jd�}t|j�|j|jj�fS)Nr�)r'rE�_INSTALL_SCHEMESr�r�s  r�get_sysconfig__INSTALL_SCHEMESz5saved_test_environment.get_sysconfig__INSTALL_SCHEMES�sD���'�'��4�	��9�-�-�.�	�0J�0J��*�*�/�/�1�3�	3r
c��|jd�}|d|_|jj�|jj|d�yr�)r$r�rsrtr�s   r�"restore_sysconfig__INSTALL_SCHEMESz9saved_test_environment.restore_sysconfig__INSTALL_SCHEMES�sF���O�O�K�0�	�%*�1�X�	�"��"�"�(�(�*��"�"�)�)�%��(�3r
c�J�td�tj�D��S)Nc3�K�|];}|jd�s(|tjj|�rdndz���=y�w)z.hypothesis�/�N)�
startswithrPrx�isdir)�.0�fns  r�	<genexpr>z3saved_test_environment.get_files.<locals>.<genexpr>s:����;���]�]�=�9��2�7�7�=�=��#4�C�"�=�;�s�AA)�sortedrP�listdirr>s r�	get_filesz saved_test_environment.get_filess"���;� "�
�
��;�;�	;r
c��tj}||vrs|dz|vrktjj	|�rtj
|�ytjj
|�rtj|�yyyy)Nr�)r�TESTFNrPrx�isfiler0r��rmtree)r�saved_valuer�s   r�
restore_filesz$saved_test_environment.restore_files
sj��
�
�
��
�[� �b�3�h�{�%B��w�w�~�~�b�!�� � ��$������r�"�� � ��$�#�&C� r
�LC_c��g}|jD]*}	|j|tj|d�f��,|S#tt
f$rY�@wxYwr)�_lc�appendr�	setlocale�	TypeError�
ValueError)r�pairings�lcs   r�
get_localez!saved_test_environment.get_locales]�����(�(�	�B�
�����V�%5�%5�b�$�%?� @�A�	�
����z�*�
��
�s�'>�A�Ac�D�|D]\}}tj||��yr)rr�)rr�r�settings    r�restore_localez%saved_test_environment.restore_locales%�� �	*�K�B�����R��)�	*r
c�<�|jd�}|jSr�)r'�showwarningr�s  r�get_warnings_showwarningz/saved_test_environment.get_warnings_showwarning s���&�&�z�2���#�#�#r
c�4�|jd�}||_yr�)r$r	)r�fxnr�s   r�restore_warnings_showwarningz3saved_test_environment.restore_warnings_showwarning#s���?�?�:�.��"��r
c#�K�|jD]9}|jdd�}d|z}d|z}|t||�t||�f���;y�w)N�.�_�get_�restore_)�	resources�replace�getattr)rr#�
method_suffix�get_name�restore_names     r�
resource_infoz$saved_test_environment.resource_info'sZ�����N�N�	M�D� �L�L��c�2�M��
�-�H�%�
�5�L����h�/���|�1L�L�L�		M�s�A
Ac��g|_|j�D]-\}}}	|�}|jj||||f��/|S#t$rY�=wxYwr)�saved_valuesrrr�)rr#r��restore�originals     r�	__enter__z saved_test_environment.__enter__.sq�����"&�"4�"4�"6�	E��D�#�w�
��5��
���$�$�d�C��(�%C�D�
	E����	'�
��
�s�A
�
	A�Ac� �|j}d|_tj�|D]b\}}}}|�}	|	|k7s�dt_||�|jr�5|j
r�Bt
|�d|j�d|�d|	�d���dy)NTz was modified by z
  Before: z
  After:  � F)rr�
gc_collect�environment_alteredrrrr)
r�exc_type�exc_val�exc_tbrr#r�rr�currents
          r�__exit__zsaved_test_environment.__exit__9s����(�(�� ���	����,8�
	1�(�D�#�w���e�G��(�"�.2��+���!��z�z�$�(�(�!��&� 1�$�.�.�1A�B%�%-�J�/%�%,�I�Q�0�1�
	1�r
N)Fr	r
r�__doc__rrr$r'r.r3r6r9r?rCrGrMrRrVrZr^rcrfrjrmrqrvryr|rr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��dirrr�rr�rrr
r
rrr')r�rrrs0000rrrs}���� 
�I�!�&�3�'�&�(�5�.�3�$����"��"�� �<�,�
3�$�E�+�� �#�&�K�/�
=�2�G�1�E�0�R�
�W�
�H�.�*�*�
8�8�
.�0�3�4�;�
%�*-�V��$�$�2��m�m�E�"��6�2��$�C��*�$�#�M�	���O$s�5(C9
r)r�rrPr r��testr�test.supportr�utilsr�	Exceptionrrrr
r�<module>r.s5���
�	�
���"� �	�)�	�r�rr

Zerion Mini Shell 1.0