Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_importlib/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_importlib/__pycache__/util.cpython-312.pyc

�

)Μgb2��,�ddlZddlZddlZddlZddlmZmZmZddlZddl	Z	ddl
Z	ddlmZddl
mZddl
mZddlZddlZddlZddlZej(�Zde_de_dej0vrde_dej0vrde_ej2rd�ZnKej(�adt6_dt6_dt6_dt6_d	t6_ d
�Ze�d�Z!d&d�Z"d&d
�Z#d&d�Z$dZ%ejLdvrBe'jQ�Z)e)e'k(re'jU�Z)e	j8jWe)�sdZ%e!d�dZ,e-ej\�e-e,j\�d�Z.d�Z/d'd�Z0d�Z1ejdd��Z3ejdd'dd�d��Z4ejdd��Z5Gd�d�Z6Gd�de6�Z7d�Z8d �Z9ejdd!��Z:ejdd"��Z;d#�Z<Gd$�d%�Z=y)(�N)�	machinery�util�invalidate_caches)�support)�
import_helper)�	os_helper�errno�	importlibc��day�N)�
EXTENSIONS���5/usr/local/lib/python3.12/test/test_importlib/util.py�_extension_detailsrs���
r�_testsinglephasec�Z�tjD]�}tjD]�}tj
|z}tjj||�}tjj|�s�V|t_|t_	|t_
|t_y��yr)�sys�pathr�EXTENSION_SUFFIXESr
�name�os�join�exists�ext�filename�	file_path)rrrrs    rrr*ss���H�H�D� �3�3��%�?�?�S�0���G�G�L�L��x�8�	��7�7�>�>�)�,�&*�J�O�%(�J�N�*2�J�'�+4�J�(��4�rc�v�d|vrdnd}tj|�}tj||d��}||d�S)zAImport a module from importlib both w/ and w/o _frozen_importlib.�.)r
r)�_frozen_importlib�_frozen_importlib_external)�fresh�blocked��Frozen�Source)r�import_fresh_module)�module_namer"�frozen�sources    r�import_importlibr+:sC��!�[�0�N�b�E�
�
.�
.�{�
;�F�
�
.�
.�{�%�1d�f�F���/�/rc�h�|�tj}nt|t�s||}dj	||j
�}||f}t
j||�}|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�B�t|d|fi|��}t|d|fi|��}||fS)Nr%r&)rC)r:r<r=r)r*s     r�split_frozenrEVs2��
�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�F�3�3rT)�win32�cygwinFr&r$c�D�tjtd�|�S)zRClass decorator that nullifies tests requiring a case-insensitive
    file system.z&requires a case-insensitive filesystem)r-�skipIf�CASE_INSENSITIVE_FS)�tests r�case_insensitive_testsrOos,��F�8�?�?�2�2�D�F�FJ�L�Lrc���tjj||dz�}t|dd��5}|j	|�ddd�dj||�|fS#1swY�xYw)N�.py�w�utf-8��encodingz{}.{})rrr�open�writer1)�parentr�pkg_dir�contentr�subfiles      r�	submoduler\vsX��
�7�7�<�<�����.�D�	
�d�C�'�	*�g��
�
�g��
+��>�>�&�$�'��-�-�
+�	*�s�A � A)c��t|d�5}|jd�tj|�cddd�S#1swYyxYw)znReads a pyc file and returns the unmarshalled code object within.

    No header validation is performed.
    �rb�N)rV�seek�marshal�load)�pyc_path�pyc_fs  r�get_code_from_pycre}s3��

�h��	��
�
�
�2���|�|�E�"�
�	�	�s	�&=�Ac'�LK�|D]2}|dvrtdj|���	tj|=�4	d��|D]}	tj|=�y#t$rY�_wxYw#t$rY�2wxYw#|D]#}	tj|=�#t$rY�!wxYwwxYw�w)z�Uncache a module from sys.modules.

    A basic sanity check is performed to prevent uncaching modules that either
    cannot/shouldn't be uncached.

    )rrazcannot uncache {}N)�
ValueErrorr1r�modules�KeyError)�namesrs  r�uncacherk�s��������%�%��0�7�7��=�>�>�	����D�!�	��
��D�
��K�K��%����	��	���
��
���D�
��K�K��%���
��
���s��$B$�A�B$�A7�B$�A(�B$�	A%�"B$�$A%�%B$�(	A4�1B$�3A4�4B$�7B!�>B�B!�	B	�B!�B	�B!�!B$)�pkgc	#�K�tjD�cgc]}|jd�d|k(s�|��}}tjd�5}t|g|���5t
j|�5t�tjj||�}|r6tjj|d�}tj|�n	|dz}|�d}|�(t|dd��5}|j|�ddd�|��ddd�ddd�ddd�ycc}w#1swY�+xYw#1swY�+xYw#1swY�/xYw#1swYyxYw�w)	Nrrz__init__.pyrQ�rRrSrT)rrh�	partitionr�temp_cwdrkr�
DirsOnSysPathrrrr�mkdirrVrW)	rrZrl�n�	conflicts�cwd�location�modpath�modfiles	         r�temp_modulery�s�����K�K�G�K�q�1�;�;�s�+;�A�+>�$�+F��K�I�G�	�	�	�D�	!�S�
�T�
&�I�
&��,�,�S�1�!�#��7�7�<�<��T�2��� �g�g�l�l�8�]�C�G��H�H�T�N�&��.�G���"$���&��g�s�W�=���
�
�g�.�>���!2�'�
"�	!��H�">�=��2�1��'�
&��
"�	!�su�E�D#�D#�E�

E�E�0A<D4�,D(	�>D4�
E�E�E�(D1
�-D4�4D=�9E�E		�E�E�Ec+�K�i}	dgfdgfdgfdiffD]8\}}tt|�||<||vr	||}||=n|}tt||��:t|�rt	dj|���d��|j
�D]\}}tt||��y#|j
�D]\}}tt||��wxYw�w)a,Context manager to manage the various importers and stored state in the
    sys module.

    The 'modules' attribute is not supported as the interpreter state stores a
    pointer to the dict that the interpreter uses internally;
    reassigning to sys.modules does not have the desired effect.

    �	meta_pathr�
path_hooks�path_importer_cachezunrecognized arguments: {}N)�getattrrr9�lenrgr1r8)r=�	originalsr@�default�	new_valuerBs      r�import_stater��s������I�&�*�B�/�&�"��+�R�0�4�b�9�;�M�D�'�&�c�4�0�I�d�O��v�~�"�4�L�	��4�L�#�	��C��y�)�;��v�;��9�@�@��H�I�I�
�$�?�?�,�K�D�%��C��u�%�-��9�?�?�,�K�D�%��C��u�%�-�s�C�A2B"�8*C�"+C
�
Cc�.�eZdZdZid�d�Zd�Zd�Zd�Zy)�
_ImporterMockz0Base class to help with creating importer mocks.)�module_codec��i|_i|_|D]�}|jd�s|}n|dtd�}d|vrd}n||k(r|j	dd�d}n|}tj|�}||_d|_||_	||_
||k7rdg|_||j|<||vs��|||j|<��y)N�	.__init__r�rz<mock __file__>z<mock __path__>)rhr��endswithr�rsplitr3�
ModuleType�
__loader__�__file__�__package__r@�__path__)�selfr�rjr�import_name�package�modules       r�__init__z_ImporterMock.__init__�s����������D��=�=��-�"��"�#5�S��%5�$5�6���$������$��+�+�c�1�-�a�0��%���%�%�k�2�F� $�F��/�F�O�!(�F���F�K��d�"�#4�"5���(.�D�L�L��%��k�)�0;�K�0H�� � ��-�)rc� �|j|Sr)rh)r�rs  r�__getitem__z_ImporterMock.__getitem__�s���|�|�D�!�!rc��t|jj��|_|jj	�|Sr)rkrh�keys�_uncache�	__enter__)r�s rr�z_ImporterMock.__enter__�s0������!2�!2�!4�5��
��
�
���!��rc�>�|jjddd�yr)r��__exit__)r��exc_infos  rr�z_ImporterMock.__exit__�s���
�
���t�T�4�0rN)r2r5�__qualname__�__doc__r�r�r�r�rrrr�r��s��:�+-�I�2"��
1rr�c�$�eZdZdZdd�Zd�Zd�Zy)�	mock_specz!Importer mock using PEP 451 APIs.Nc
��	|j|}tj||j|t|dd���}|S#t$rYywxYw)Nr�)�loader�submodule_search_locations)rhrir�spec_from_file_locationr�r~)r��fullnamerrXr��specs      r�	find_speczmock_spec.find_specsZ��	��\�\�(�+�F��+�+��&�/�/�$�+2�6�:�t�+L�N������	��	�s�A�	A
�A
c�p�|j|jvrt�|j|jSr)rrh�ImportError)r�r�s  r�
create_modulezmock_spec.create_module
s+���9�9�D�L�L�(����|�|�D�I�I�&�&rc�t�	|j|jj�y#t$rYywxYwr)r��__spec__rri)r�r�s  r�exec_modulezmock_spec.exec_modules6��	�2�D���V�_�_�1�1�2�4���	��	�s�(+�	7�7)NN)r2r5r�r�r�r�r�rrrr�r��s��+��'�
rr�c���tjrtjd���St	j
���fd��}|S)ztDecorator to protect sys.dont_write_bytecode from mutation and to skip
    tests that require it to be set to False.zrelies on writing bytecodec���tj}dt_	�|i|��}|t_|S#|t_wxYw)NF)r�dont_write_bytecode)�argsr=�original�	to_return�fxns    �r�wrapperz&writes_bytecode_files.<locals>.wrappersD����*�*��"'���	/��T�,�V�,�I�&.�C�#����'/�C�#�s	�3�
A)rr�r-�skip�	functools�wraps)r�r�s` r�writes_bytecode_filesr�sG������:�x�}�}�9�:�3�?�?��_�_�S������Nrc���	tjtjj|��y#t$r(}|j
t
jk7r�Yd}~yd}~wwxYw)z�Ensure that the __pycache__ directory for PEP 3147 pyc file exists.

    :param bytecode_path: File system path to PEP 3147 pyc file.
    N)rrrr�dirname�OSErrorr	�EEXIST)�
bytecode_path�errors  r�ensure_bytecode_pathr�*sH��
�
���������/�0�����;�;�%�,�,�&��'���s�25�	A&�A!�!A&c#�K�tj}|t_	d��|t_y#|t_wxYw�w)z&Adjust and restore sys.pycache_prefix.N)r�pycache_prefix)�prefix�_orig_prefixs  r�temporary_pycache_prefixr�6s3�����%�%�L��C��*�
�)����\���s�?�/�?�
<�?c'�K�d}g}i}d}d}	tj�}||d<t�}|D�]P}|jd�s|}	n|dt	d�}	|j|	�|	tjvrtj|	=|jd�}
|}|
ddD]h}tjj||�}tjj|�r�Ctj|�|j|��jtjj||
ddz�}t|d	d
��5}
|
j!|j#|��ddd�|j|�|||<��St%|�}|j'�t)|g��}|j'�|��|�|j+ddd�|�|j+ddd�t-j.|�y#1swY��xYw#|�|j+ddd�|�|j+ddd�t-j.�wxYw�w)
aRTemporarily create each named module with an attribute (named 'attr')
    that contains the name passed into the context manager that caused the
    creation of the module.

    All files are created in a temporary directory returned by
    tempfile.mkdtemp(). This directory is inserted at the beginning of
    sys.path. When the context manager exits all created files (source and
    bytecode) are explicitly deleted.

    No magic is performed when creating packages! This means that if you create
    a module within a package you must also create the package's __init__ as
    well.

    zattr = {0!r}Nz.rootr�r�r���rQrRrSrT)r)�tempfile�mkdtemp�setr�r�addrrh�splitrrrrrr�appendrVrWr1rkr�r�r�r�rmtree)rjr*�
created_paths�mapping�
state_manager�uncache_manager�temp_dir�import_namesrr��
name_partsr�	directory�files              r�create_modulesr�As���� �F��M��G��M��O�"#��#�#�%��#�����u���D��=�=��,�"��"�#5�S��%5�$5�6�����[�)��c�k�k�)��K�K��,����C��J� �I�'���_�	��G�G�L�L��I�>�	��w�w�~�~�i�0��H�H�Y�'�!�(�(��3�	-�
�����Y�
�2���0F�G�I��i��w�7�4��
�
�6�=�=��.�/�8�� � ��+�%�G�D�M�'�("�<�0���!�!�#�$�8�*�5�
����!��
��$��"�"�4��t�4��&��$�$�T�4��6�����"�8�7���$��"�"�4��t�4��&��$�$�T�4��6�����"�s?�I�CH�)AH�!H�&AH�AI�H		�H�AI
�
Ic������fd�}|S)zA mock sys.path_hooks entry.c���|�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�Zy)�CASEOKTestBasec�\��d}t�fd�|D��|k7r�jd�yy)N)sPYTHONCASEOK�PYTHONCASEOKc3�v�K�|]0}|�jjjjv���2y�wr)r
�_bootstrap_external�_os�environ)�.0�xr�s  �r�	<genexpr>z4CASEOKTestBase.caseok_env_changed.<locals>.<genexpr>�s4�����,�*���D�N�N�6�6�:�:�B�B�B�*�s�69z/os.environ changes not reflected in _os.environ)�any�skipTest)r��should_exist�
possibilitiess`  r�caseok_env_changedz!CASEOKTestBase.caseok_env_changed�s7���7�
��,�*�,�,�/;�<��M�M�K�L�<rN)r2r5r�r�rrrr�r��s��Mrr�r)rn)>�builtins�
contextlibr	r�r
rrrrar�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\re�contextmanagerrkryr�r�r�r�r�r�r�r�r�rrr�<module>rs5������8�8��	���&�"��
���!�5� � �"��������
�c�&�&�&� �H���c�.�.�.�#�H��
�?�?�
�'��&�&�(�J��J�O��J�N��J���J��(�J�O����0��&�4����<�<�*�*��>�>�#�L��x���~�~�'��
�7�7�>�>�,�'�#��#�K�0��:��$�X�%8�%8�9�$�%5�%@�%@�A�C�
�L�.�#�������0��������.���&��&�:&1�&1�R�
��4�"	����*��*����6#��6#�r�M�Mr

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