Your IP : 216.73.216.213


Current Path : /opt/alt/python311/lib64/python3.11/test/test_importlib/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/test/test_importlib/__pycache__/util.cpython-311.opt-2.pyc

�

�0�i85��<�ddlZddlZddlZddlZddlmZmZmZddlZddl	Z	ddl
Z	ddlmZddl
mZddl
mZddlZddlZddlZddlZej��Zde_de_dejvrde_dejvrde_ejrd�ZnNej��adt6_dt6_dt6_dt6_d	t6_ d
�Ze��d�Z!d)d�Z"d)d
�Z#d)d�Z$dZ%ej&dvrJe'�(��Z)e)e'kre'�*��Z)e	j�+e)��sdZ%e!d��dZ,e-ej.��e-e,j.��d�Z.d�Z/d*d�Z0d�Z1ej2d���Z3ej2d*dd�d���Z4ej2d���Z5Gd�d��Z6Gd�de6��Z7Gd �d!e6��Z8d"�Z9d#�Z:ej2d$���Z;ej2d%���Z<d&�Z=Gd'�d(��Z>dS)+�N)�	machinery�util�invalidate_caches)�support)�
import_helper)�	os_helper�errno�	importlibc�
�dadS�N)�
EXTENSIONS���?/opt/alt/python311/lib64/python3.11/test/test_importlib/util.py�_extension_detailsrs���
�
�
r�	_testcapic�F�tjD]�}tjD]�}tj|z}tj�||��}tj�|��r4|t_|t_	|t_
|t_dS����dSr)�sys�pathr�EXTENSION_SUFFIXESr
�name�os�join�exists�ext�filename�	file_path)rrrrs    rrr*s����H�		�		�D� �3�
�
��%�?�S�0���G�L�L��x�8�8�	��7�>�>�)�,�,��&*�J�O�%(�J�N�*2�J�'�+4�J�(��F�F�F��
�		�		rc�t�	d|vrdnd}tj|��}tj||d���}||d�S)N�.)r
r)�_frozen_importlib�_frozen_importlib_external)�fresh�blocked��Frozen�Source)r�import_fresh_module)�module_namer"�frozen�sources    r�import_importlibr+:sW��K�!�[�0�0�N�N�b�E�
�
.�{�
;�
;�F�
�
.�{�%�1d�f�f�f�F���/�/�/rc�j�|�
tj}nt|t��s||}d�||j��}||f}t
j||��}|j|_|j|_	||_
|���D]\}}||}	t|||	���|S)Nz{}_{})
�unittest�TestCase�
isinstance�type�format�__name__�types�	new_class�
__module__�_NAME�_KIND�items�setattr)
�cls�kind�base�kwargsr�bases�specialized�attr�values�values
          r�specialize_classrCCs����|�� ���
��d�
#�
#���D�z���>�>�$���-�-�D�
�$�K�E��/�$��.�.�K� �^�K����K���K�������*�*���f��t�����T�5�)�)�)�)��rc�F�t|d|fi|��}t|d|fi|��}||fS)Nr%r&)rC)r:r<r=r)r*s     r�split_frozenrEVs>��
�c�8�T�
<�
<�V�
<�
<�F�
�c�8�T�
<�
<�V�
<�
<�F��6�>�rc��t||fi|��Sr)rE)�
test_classr<r=s   r�	test_bothrH\s���
�D�3�3�F�3�3�3rT)�win32�cygwinFr&r$c�L�	tjtd��|��S)Nz&requires a case-insensitive filesystem)r-�skipIf�CASE_INSENSITIVE_FS)�tests r�case_insensitive_testsrOos;���F�8�?�2�2�D�F�F�FJ�L�L�Lr�c��tj�||dz��}t|dd���5}|�|��ddd��n#1swxYwYd�||��|fS)N�.py�w�utf-8��encodingz{}.{})rrr�open�writer1)�parentr�pkg_dir�contentr�subfiles      r�	submoduler]vs���
�7�<�<�����.�.�D�	
�d�C�'�	*�	*�	*��g��
�
�g�����������������������>�>�&�$�'�'��-�-s�A�A�Ac��	t|d��5}|�d��tj|��cddd��S#1swxYwYdS)N�rb�)rW�seek�marshal�load)�pyc_path�pyc_fs  r�get_code_from_pycrf}s����
�h��	�	�#��
�
�
�2�����|�E�"�"�#�#�#�#�#�#�#�#�#�#�#�#����#�#�#�#�#�#s�)A�A�Ac'�>K�	|D]F}|dvr"td�|�����	tj|=�7#t$rY�CwxYw	dV�|D] }	tj|=�#t$rY�wxYwdS#|D] }	tj|=�#t$rY�wxYwwxYw)N)rrb�impzcannot uncache {0})�
ValueErrorr1r�modules�KeyError)�namesrs  r�uncacherm�s����������,�,�,��$�+�+�D�1�1�3�3�
3�	���D�!�!���	�	�	��D�	�����
�����	�	�D�
��K��%�%���
�
�
���
����	�	��E�	�	�D�
��K��%�%���
�
�
���
����	���sQ�
=�
A
�	A
�A7�
A%�%
A2�1A2�7B�=
B�
B�
B	�B�B	�B)�pkgc	#��K��fd�tjD��}tjd��5}t	�g|�R�5tj|��5t��tj	�
|���}|r5tj	�
|d��}tj���n	|dz}|�d}|�?t|dd���5}|�
|��ddd��n#1swxYwY|V�ddd��n#1swxYwYddd��n#1swxYwYddd��dS#1swxYwYdS)Nc�R��g|]#}|�d��d�k�!|��$S)rr)�	partition)�.0�nrs  �r�
<listcomp>ztemp_module.<locals>.<listcomp>�s4���G�G�G�q�1�;�;�s�+;�+;�A�+>�$�+F�+F��+F�+F�+Frz__init__.pyrRrPrSrTrU)rrjr�temp_cwdrmr�
DirsOnSysPathrrrr�mkdirrWrX)rr[rn�	conflicts�cwd�location�modpath�modfiles`       r�temp_moduler}�sN�����G�G�G�G�C�K�G�G�G�I�	�	�D�	!�	!��S�
�T�
&�I�
&�
&�
&�	�	��,�S�1�1�
�
�!�#�#�#��7�<�<��T�2�2���%� �g�l�l�8�]�C�C�G��H�T�N�N�N�N�&��.�G���"$���&��g�s�W�=�=�=�/���
�
�g�.�.�.�/�/�/�/�/�/�/�/�/�/�/����/�/�/�/�����!
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	���������������������s}�E�D*�BD�C8	�,D�8C<
�<D�?C<
�D�D*�D�D*�D�D*�E�*D.	�.E�1D.	�2E�E�	Ec+�K�	i}	dgfdgfdgfdiffD]E\}}tt|��||<||vr||}||=n|}tt||���Ft|��r4t	d�|��������dV�|���D]\}}tt||���dS#|���D]\}}tt||���wxYw)N�	meta_pathr�
path_hooks�path_importer_cachezunrecognized arguments: {0})�getattrrr9�lenrir1�keysr8)r=�	originalsr@�default�	new_valuerBs      r�import_stater��sP������I�&�*�B�/�&�"��+�R�0�4�b�9�;�		*�		*�M�D�'�&�c�4�0�0�I�d�O��v�~�~�"�4�L�	��4�L�L�#�	��C��y�)�)�)�)��v�;�;�	I��1�8�8������G�G�I�I�
I�
����$�?�?�,�,�	&�	&�K�D�%��C��u�%�%�%�%�	&�	&��9�?�?�,�,�	&�	&�K�D�%��C��u�%�%�%�%�	&���s�BC�2Dc�.�eZdZ	id�d�Zd�Zd�Zd�ZdS)�
_ImporterMock)�module_codec��i|_i|_|D]�}|�d��s|}n|dtd���}d|vrd}n%||kr|�dd��d}n|}tj|��}||_d|_||_	||_
||krdg|_||j|<||vr|||j|<��dS)N�	.__init__r�rz<mock __file__>z<mock __path__>)rjr��endswithr��rsplitr3�
ModuleType�
__loader__�__file__�__package__r@�__path__)�selfr�rlr�import_name�package�modules       r�__init__z_ImporterMock.__init__�s���������	I�	I�D��=�=��-�-�
7�"���"�#5�S��%5�%5�$5�#5�6���$��������$�$��+�+�c�1�-�-�a�0���%���%�k�2�2�F� $�F��/�F�O�!(�F���F�K��d�"�"�#4�"5���(.�D�L��%��k�)�)�0;�K�0H�� ��-��)	I�	Irc��|j|Sr�rj)r�rs  r�__getitem__z_ImporterMock.__getitem__�s���|�D�!�!rc��t|j����|_|j���|Sr)rmrjr��_uncache�	__enter__)r�s rr�z_ImporterMock.__enter__�s5�����!2�!2�!4�!4�5��
��
���!�!�!��rc�>�|j�ddd��dSr)r��__exit__)r��exc_infos  rr�z_ImporterMock.__exit__�s"���
���t�T�4�0�0�0�0�0rN)r2r5�__qualname__r�r�r�r�rrrr�r��se������:�+-�I�I�I�I�I�2"�"�"����
1�1�1�1�1rr�c��eZdZ	dd�Zd�ZdS)�mock_modulesNc��||jvrdS|Srr�)r��fullnamers   r�find_modulezmock_modules.find_modules���4�<�'�'��4��Krc���||jvrt�|j|tj|<||jvr3	|j|��n#t$rtj|=�wxYw|j|Sr)rj�ImportErrorrr��	Exception)r�r�s  r�load_modulezmock_modules.load_modules����4�<�'�'���$(�L��$:�C�K��!��4�+�+�+��.�D�$�X�.�0�0�0�0�� ������H�-�������<��)�)s�A�A$r)r2r5r�r�r�rrrr�r�s:������+�����*�*�*�*�*rr�c�$�eZdZ	dd�Zd�Zd�ZdS)�	mock_specNc
��	|j|}n#t$rYdSwxYwtj||j|t|dd�����}|S)Nr�)�loader�submodule_search_locations)rjrkr�spec_from_file_locationr�r�)r�r�rrYr��specs      r�	find_speczmock_spec.find_specsp��	��\�(�+�F�F���	�	�	��4�4�	�����+��&�/�$�+2�6�:�t�+L�+L�N�N�N���s�
�
�c�P�|j|jvrt�|j|jSr)rrjr�)r�r�s  r�
create_modulezmock_spec.create_module's&���9�D�L�(�(����|�D�I�&�&rc�h�	|j|jj��dS#t$rYdSwxYwr)r��__spec__rrk)r�r�s  r�exec_modulezmock_spec.exec_module,sJ��	�2�D��V�_�1�2�4�4�4�4�4���	�	�	��D�D�	���s�#�
1�1)NN)r2r5r�r�r�r�rrrr�r�sI������+�����'�'�'�
����rr�c���	tjrtjd�����St	j����fd���}|S)Nzrelies on writing bytecodec���tj}dt_	�|i|��}|t_n#|t_wxYw|S)NF)r�dont_write_bytecode)�argsr=�original�	to_return�fxns    �r�wrapperz&writes_bytecode_files.<locals>.wrapper8sQ����*��"'���	/���T�,�V�,�,�I�&.�C�#�#��h�C�#�.�.�.�.��s�0�>)rr�r-�skip�	functools�wraps)r�r�s` r�writes_bytecode_filesr�3sd���1�
��@�:�x�}�9�:�:�3�?�?�?��_�S�����������Nrc���		tjtj�|����dS#t$r!}|jt
jkr�Yd}~dSd}~wwxYwr)rrwr�dirname�OSErrorr	�EEXIST)�
bytecode_path�errors  r�ensure_bytecode_pathr�Dsu����
�������/�/�0�0�0�0�0�������;�%�,�&�&��'�&�&�&�&�&��������s�16�
A!�A�A!c#�K�	tj}|t_	dV�|t_dS#|t_wxYwr)r�pycache_prefix)�prefix�_orig_prefixs  r�temporary_pycache_prefixr�PsI����0��%�L��C��*�
����)������\���)�)�)�)s�/�=c'�,K�	d}g}i}d}d}	tj��}||d<t��}|D�]�}|�d��s|}	n|dt	d���}	|�|	��|	tjvr
tj|	=|�d��}
|}|
dd�D]j}tj
�||��}tj
�|��s)tj
|��|�|���ktj
�||
ddz��}t|dd	�
��5}
|
�|�|����ddd��n#1swxYwY|�|��|||<���t%|�}|���t)|g���}|���|V�|�|�ddd��|�|�ddd��t-j|��dS#|�|�ddd��|�|�ddd��t-j|��wxYw)Nzattr = {0!r}z.rootr�r�r���rRrSrTrU)r)�tempfile�mkdtemp�setr�r��addrrj�splitrrrrrw�appendrWrXr1rmr�r�r�r�rmtree)rlr*�
created_paths�mapping�
state_manager�uncache_manager�temp_dir�import_namesrr��
name_partsr�	directory�files              r�create_modulesr�[s�����
��F��M��G��M��O�"#��#�%�%��#�����u�u���	&�	&�D��=�=��,�,�
7�"���"�#5�S��%5�%5�$5�#5�6�����[�)�)�)��c�k�)�)��K��,����C���J� �I�'����_�
4�
4�	��G�L�L��I�>�>�	��w�~�~�i�0�0�4��H�Y�'�'�'�!�(�(��3�3�3������Y�
�2���0F�G�G�I��i��w�7�7�7�
0�4��
�
�6�=�=��.�.�/�/�/�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0�
0����
0�
0�
0�
0�� � ��+�+�+�%�G�D�M�M�!�<�0���!�!�#�#�#�$�8�*�5�5�5�
����!�!�!��
�
�
��$��"�"�4��t�4�4�4��&��$�$�T�4��6�6�6����"�"�"�"�"��	�$��"�"�4��t�4�4�4��&��$�$�T�4��6�6�6����"�"�"�"���s2�EI�!)F�
I�F	�I�F	�A%I�AJc����	��fd�}|S)Nc���|�vrt��Sr)r�)�entry�entries�importers ��r�hookzmock_path_hook.<locals>.hook�s����������rr)r�r�r�s`` r�mock_path_hookr��s,����&��������Krc��eZdZd�ZdS)�CASEOKTestBasec�x��d}t�fd�|D����|kr��d��dSdS)N)sPYTHONCASEOK�PYTHONCASEOKc3�H�K�|]}|�jjjjvV��dSr)r
�_bootstrap_external�_os�environ)rr�xr�s  �r�	<genexpr>z4CASEOKTestBase.caseok_env_changed.<locals>.<genexpr>�sG�����,�,���D�N�6�:�B�B�,�,�,�,�,�,rz/os.environ changes not reflected in _os.environ)�any�skipTest)r��should_exist�
possibilitiess`  r�caseok_env_changedz!CASEOKTestBase.caseok_env_changed�sk���7�
��,�,�,�,�*�,�,�,�,�,�/;�<�<��M�M�K�L�L�L�L�L�<�<rN)r2r5r�r�rrrr�r��s(������M�M�M�M�Mrr�r)rP)?�builtins�
contextlibr	r�r
rrrrbr�os.pathrNr�test.supportrrr-rr�r3�SimpleNamespace�BUILTINS�	good_name�bad_name�builtin_module_names�is_wasirr
rrrrrr+rCrErHrM�platformr��upper�changed_name�lowerr�source_importlib�staticmethod�
__import__rOr]rf�contextmanagerrmr}r�r�r�r�r�r�r�r�r�r�rrr�<module>rs:������������������8�8�8�8�8�8�8�8�8�8�����	�	�	�	�����������&�&�&�&�&�&�"�"�"�"�"�"�����
�
�
�
���������!�5� �"�"��������
�c�&�&�&� �H���c�.�.�.�#�H��
�?��
����'��&�(�(�J��J�O��J�N��J���J��!�J�O���������0�0�0�����&����4�4�4�4����<�*�*�*��>�>�#�#�L��x����~�~�'�'��
�7�>�>�,�'�'�$�#��#�#�K�0�0��:��$��X�%8�9�9�$��%5�%@�A�A�C�C�
�L�L�L�.�.�.�.�#�#�#��������2�����������.��&�&���&�<&1�&1�&1�&1�&1�&1�&1�&1�R*�*�*�*�*�=�*�*�*�0�����
����4���"	�	�	���*�*���*���6#�6#���6#�r���M�M�M�M�M�M�M�M�M�Mr