Sindbad~EG File Manager

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

�

)Μg���d�ddlmZmZejd�ZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
Z
ddlZGd�dej�ZGd�de�Zej"ee�	�\ZZGd
�de�Zej"ee�	�\ZZedk(re
j0�yy)
�)�abc�utilzimportlib.machineryN)�make_legacy_pycc��eZdZdZd�Zd�Zdddd�d�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zd
�Z
d�Zd�Zej"ej&dk7d�d��Zd�Zy)�FinderTestsaEFor a top-level module, it should just be found directly in the
    directory being searched. This is true for a directory with source
    [top-level source], bytecode [top-level bc], or both [top-level both].
    There is also the possibility that it is a package [top-level package], in
    which case there will be a directory with the module name and an
    __init__.py file. If there is a directory without an __init__.py an
    ImportWarning is returned [empty dir].

    For sub-modules and sub-packages, the same happens as above but only use
    the tail end of the name [sub module] [sub package] [sub empty].

    When there is a conflict between a package and module having the same name
    in the same directory, the package wins out [package over module]. This is
    so that imports of modules within the package can occur rather than trigger
    an import error.

    When there is a package and module with the same name, always pick the
    package over the module [package over module]. This is so that imports from
    the package have the possibility of succeeding.

    c���|jj|jjf|jj|jjfg}|jj
|g|���S�N)�	machinery�SourceFileLoader�SOURCE_SUFFIXES�SourcelessFileLoader�BYTECODE_SUFFIXES�
FileFinder)�self�root�loader_detailss   �C/usr/local/lib/python3.12/test/test_importlib/source/test_finder.py�
get_finderzFinderTests.get_finder(se���>�>�:�:� �N�N�:�:�<��>�>�>�>� �N�N�<�<�>�?��)�t�~�~�(�(��?��?�?�c�L�|j|�}|j||d��S)NT��loader_only)r�_find)rr�module�finders    r�import_zFinderTests.import_/s%������&���z�z�&�&�d�z�;�;rN��compile_�unlinkc���|�|h}tj|�5}|r|D]}tj||��|r.|D])}t	j
||�	t
||��+|j|d|�}|jt|d��|cddd�S#t$r(}|jtjk7r�Yd}~��d}~wwxYw#1swYyxYw)z�Test the finding of 'test' with the creation of modules listed in
        'create'.

        Any names listed in 'compile_' are byte-compiled. Modules
        listed in 'unlink' have their source files deleted.

        N�.root�load_module)
r�create_modules�
py_compile�compile�osrr�OSError�errno�ENOENTr�
assertTrue�hasattr)	r�test�createrr�mapping�name�error�loaders	         r�run_testzFinderTests.run_test3s����>��V�F�
�
 �
 �&�
)�W��$�D��&�&�w�t�}�5�%��"�D��I�I�g�d�m�,�"�'���
�6�#��\�\�'�'�"2�D�9�F��O�O�G�F�M�:�;��#*�
)��#�"�!�;�;�%�,�,�6�!�7��	"��*�
)�s6�AC�B%�(3C�%	C�.C�C�C�C�C"c�z�|jd�|jddhdh��|jddh��y)N�	top_levelr�r�r2�rs r�test_modulezFinderTests.test_modulePs>���
�
�k�"��
�
�k�[�M�)�]�	�	,�	
�
�
�k�[�M�
�:rc��|jddh�|jddhdhdh��|jddhdh��y)N�pkg�pkg.__init__rr5r6r7s r�test_packagezFinderTests.test_packageZsP���
�
�e�n�-�.��
�
�e�n�-��8H�&�'�	�	)�	
�
�
�e�n�-��8H�
�Irc��tjdd�5}tjj	|d�}|j|d�}|j
t|d��ddd�y#1swYyxYw)Nr;�pkg.subr"�rr#r&�path�dirnamerr*r+)rr.�pkg_dirr1s    r�test_module_in_packagez"FinderTests.test_module_in_packagedsZ��
�
 �
 ���
;�w��g�g�o�o�g�n�&=�>�G��\�\�'�9�5�F��O�O�G�F�M�:�;�<�
;�
;�s�AA0�0A9c��tjdd�}|5}tjj	|d�}|j|d�}|j
t|d��ddd�y#1swYyxYw)Nr;zpkg.sub.__init__r>r"r?)r�contextr.rBr1s     r�test_package_in_packagez#FinderTests.test_package_in_packageks^���%�%�n�6H�I��
���g�g�o�o�g�n�&=�>�G��\�\�'�9�5�F��O�O�G�F�M�:�;��W�W�s�AA2�2A;c��d}|j|dj|�|h�}|jd|j|��y)N�_tempz{0}.__init__�__init__)r2�format�assertIn�get_filename)rr/r1s   r�test_package_over_modulez$FinderTests.test_package_over_moduless@�������t�n�&;�&;�D�&A�4�%H�I���
�
�j�&�"5�"5�d�";�<rc��tjd�5}|j|dd�}|j||j�ddd�y#1swYyxYw)N�blahr!�
sdfsadsadf)rr#r�assertEqual�	NOT_FOUND)rr.�nothings   r�test_failurezFinderTests.test_failurexsG��
�
 �
 ��
(�G��l�l�7�7�#3�\�B�G����W�d�n�n�5�)�
(�
(�s�2A�Ac��|jjd|jj|jjf�}t	ddd��5}|jd�ddd�	|j
|dd�	�}|jt|d
��tjd�y#1swY�OxYw#tjd�wxYw)N�zmod.py�wzutf-8)�encodingz# test file for importlib�modTrr")r
rrr�open�writerr*r+r&r)rr�filer1s    r�test_empty_string_for_dirz%FinderTests.test_empty_string_for_dir}s������*�*�2����0O�0O��N�N�*�*�0,�-��
�(�C�'�
2�d��J�J�2�3�3�	 ��Z�Z���4�Z�@�F��O�O�G�F�M�:�;��I�I�h��
3�
2��
�I�I�h��s�B5�0/C�5B>�Cc��|jjd|jj|jjf�}d|_|j�|j
|jd�y)NrV�*���)r
rrr�_path_mtime�invalidate_cachesrQ)rrs  r�test_invalidate_cachesz"FinderTests.test_invalidate_caches�s`�����*�*�2����0O�0O��N�N�*�*�0,�-������ � �"�����+�+�R�0rc�.�d}tj|�5}|j|d�}|j|dd��}|j	|�ddd�|jdd��}|j||j�y#1swY�:xYw)NrYr!Tr)rr#rr�assertIsNotNonerQrR)rrYr.r�founds     r�test_dir_removal_handlingz%FinderTests.test_dir_removal_handling�s�����
�
 �
 ��
%���_�_�W�W�%5�6�F��J�J�v�u�$�J�?�E�� � ��'�&��
�
�6�5�d�
�;���������/�&�
%�s�:B�B�win32z>os.chmod() does not support the needed arguments under Windowsc��tj�}|j|�tj|j
�j}|jtj|j
|�tj|j
tjtjz�|j|j
�}|j|d�}|j||j�y�N�doesnotexist)�tempfile�TemporaryDirectory�enterContextr&�statr/�st_mode�
addCleanup�chmod�S_IWUSR�S_IXUSRrrrQrR)r�tempdir�
original_moderrfs     r�test_no_read_directoryz"FinderTests.test_no_read_directory�s����-�-�/�����'�"�������-�5�5�
�������'�,�,�
�>�
������t�|�|�d�l�l�:�;�������.���
�
�6�>�2���������/rc���tj�5}|j|j�}|j	|d�}|j||j�ddd�y#1swYyxYwrj)rl�NamedTemporaryFilerr/rrQrR)r�file_objrrfs    r�test_ignore_filezFinderTests.test_ignore_file�sT���
(�
(�
*�h��_�_�X�]�]�3�F��J�J�v�~�6�E����U�D�N�N�3�+�
*�
*�s�A
A(�(A1r	)�__name__�
__module__�__qualname__�__doc__rrr2r8r<rCrFrMrTr]rcrg�unittest�
skipUnless�sys�platformrwr{�rrrrs����,@�<��d�4��:;�J�<�<�=�
6�

 �1�0��X�������0�L�N�0�N�0�4rrc��eZdZdZdd�Zy)�FinderTestsPEP451Nc�D�|j|�}|�|jS|Sr	)�	find_specr1�rrr/r�specs     rrzFinderTestsPEP451._find�s&������%��"�.�t�{�{�8�D�8r�F�r|r}r~rRrr�rrr�r��s���I�9rr�)r
c��eZdZdgfZdd�Zy)�FinderTestsPEP420Nc��|j|�}|�|jS|r|jS|j|jfSr	)r�rRr1�submodule_search_locationsr�s     rrzFinderTestsPEP420._find�sC������%���<��>�>�!���;�;���{�{�D�;�;�;�;rr�r�r�rrr�r��s���r�
�I�<rr��__main__)�test.test_importlibrr�import_importlibr
r(r&r$ror�rl�test.support.import_helperrr��warningsrr��	test_both�Frozen_FinderTestsPEP451�Source_FinderTestsPEP451r��Frozen_FinderTestsPEP420�Source_FinderTestsPEP420r|�mainr�rr�<module>r�s���)�!�D�!�!�"7�8�	��	���
��6���a4�#�/�/�a4�H9��9��T�^�^�%��;����
<��
<��T�^�^�%��;�����z���H�M�M�O�r

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