Sindbad~EG File Manager

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

�

)Μg�����ddlZddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZGd�d	e
�Zdd
�Zdd�ZGd�d
ej$��ZGd�d�ZGd�de�Zy)�N�)�data01)�	zipdata01)�ResourceReader)�
import_helper)�
ModuleSpecc�0�eZdZd�Zd�Zd�Zd�Zd�Zd�Zy)�Readerc�8�t|�j|�y�N)�vars�update)�self�kwargss  �?/usr/local/lib/python3.12/test/test_importlib/resources/util.py�__init__zReader.__init__s���T�
���&�!�c��|Sr��r�packages  r�get_resource_readerzReader.get_resource_readers���rc�t�||_t|jt�r|j�|jSr)�_path�
isinstance�file�	Exception�r�paths  r�
open_resourcezReader.open_resources*����
��d�i�i��+��)�)�O��y�y�rc�t�||_t|jt�r|j�|jSr)rrrr)r�path_s  r�
resource_pathzReader.resource_paths*����
��d�i�i��+��)�)�O��y�y�rc����|_t|jt�r|j�d�}t	�fd�t||j�D��S)Nc�$�|jd�S)N�/)�split)�entrys r�partz Reader.is_resource.<locals>.part)s���;�;�s�#�#rc3�N�K�|]}t|�dk(xr|d�k(���y�w)rrN)�len)�.0�partsr"s  �r�	<genexpr>z%Reader.is_resource.<locals>.<genexpr>,s/�����
�?X�e�C��J�!�O�1��a��E� 1�1�?X�s�"%)rrrr�any�map�	_contents)rr"r)s ` r�is_resourcezReader.is_resource$sM�����
��d�i�i��+��)�)�O�	$��
�?B�4����?X�
�
�	
rc#�K�t|jt�r|j�|jEd{���y7��wr)rrrr1�rs r�contentszReader.contents0s*�����d�i�i��+��)�)�O��>�>�!�!�s�6A�>�AN)	�__name__�
__module__�__qualname__rrr r#r2r5rrrr
r
s ��"����

�"rr
c�n�d}tj|�}t||d|��}||_||_|S)N�testingpackagezdoes-not-exist)�origin�
is_package)�types�
ModuleTyper�__spec__�
__loader__)�loaderr<�name�module�specs     r�create_package_from_loaderrE6s<���D�
�
�
�d�
#�F��d�F�+;�
�S�D��F�O��F���Mrc�2�tt|||��|�S)N)rrr1)rEr
)rrr<r5s    r�create_packagerG?s��%��D�t�x�8���rc�d�eZdZdZej
d��Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zy)�CommonTestsz>
    Tests shared by test_open, test_path, and test_read.
    c��y)zl
        Call the pertinent legacy API function (e.g. open_text, path)
        on package and path.
        Nr)rrrs   r�executezCommonTests.executeKs�rc�D�|jtjd�y)z=
        Passing in the package name should succeed.
        �
utf-8.fileN)rKrr6r4s r�test_package_namezCommonTests.test_package_nameRs��	
���V�_�_�l�3rc�0�|jtd�y)z?
        Passing in the package itself should succeed.
        rMN�rKrr4s r�test_package_objectzCommonTests.test_package_objectXs��	
���V�\�*rc�4�d}|jt|�y)zB
        Passing in a string for the path should succeed.
        rMNrPrs  r�test_string_pathzCommonTests.test_string_path^s�������V�T�"rc�Z�tjd�}|jt|�y)zS
        Passing in a pathlib.PurePath object for the path should succeed.
        rMN)�pathlib�PurePathrKrrs  r�test_pathlib_pathzCommonTests.test_pathlib_pathes"������-�����V�T�"rc��tjtj=|j	tjd�y)z=
        The anchor package can already be imported.
        rMN)�sys�modulesrr6rKr4s r�$test_importing_module_as_side_effectz0CommonTests.test_importing_module_as_side_effectls&��
�K�K����(����V�_�_�l�3rc���tjd�}t|t���}|j	|d�|j|jjd�y)z�
        Attempting to open or read or request the path for a
        non-existent path should succeed if open_resource
        can return a viable data stream.
        �
Hello, world!�rrrMN)�io�BytesIOrG�FileNotFoundErrorrK�assertEqualr@r)r�
bytes_datars   r�test_missing_pathzCommonTests.test_missing_pathssM���Z�Z� 0�1�
� �j�7H�7J�K�����W�l�+�����+�+�1�1�<�@rc���tjd�}t}t||��}|j	|d�|j|jjd�y)Nr]r^rM)r_r`�__file__rGrKrbr@r)rrcrrs    r�test_extant_pathzCommonTests.test_extant_path~sN���Z�Z� 0�1�
��� �j�t�<�����W�l�+�����+�+�1�1�<�@rc��tt�t���}|jt�5|j|d�ddd�y#1swYyxYw)Nr^rM)rGra�assertRaisesrKrs  r�test_useless_loaderzCommonTests.test_useless_loader�s?�� �&7�&9�@Q�@S�T��
�
�
�0�
1��L�L��,�/�2�
1�
1�s�A�AN)r6r7r8�__doc__�abc�abstractmethodrKrNrQrSrWr[rdrgrjrrrrIrIFsK���	������4�+�#�#�4�	A�	A�0rrI)�	metaclassc�6�eZdZdZed��Zed��Zd�Zy)�ZipSetupBaseNc��tj|jj�}|j}t|dz�|_tjj|j�tjd�|_y)Nzziptestdata.zip�ziptestdata)
rU�Path�
ZIP_MODULErf�parent�str�	_zip_pathrYr�append�	importlib�
import_module�data)�cls�	data_path�data_dirs   r�
setUpClasszZipSetupBase.setUpClass�s]���L�L����!8�!8�9�	��#�#���H�'8�8�9��
�������
�
�&��*�*�=�9��rc�>�	tjj|j�	tj
|j=tj|jj=	|`|`y#t$rY�RwxYw#t$rY� wxYw#t$rYywxYwr)rYr�removerw�
ValueError�path_importer_cacherZr{r6�KeyError�AttributeError)r|s r�
tearDownClasszZipSetupBase.tearDownClass�s���	��H�H�O�O�C�M�M�*�	��'�'��
�
�6����C�H�H�-�-�.�	����
���	��	���	��	���	��	�s5�)A2�AB�-B�2	A>�=A>�	B
�B
�	B�Bc�n�tj�}|jtjg|���yr)r�
modules_setup�
addCleanup�modules_cleanup)rrZs  r�setUpzZipSetupBase.setUp�s)���-�-�/������
�5�5�@��@r)r6r7r8rt�classmethodrr�r�rrrrprp�s3���J��:��:�����$Arrpc��eZdZeZy)�ZipSetupN)r6r7r8rrtrrrr�r��s���Jrr�)T)NNTr)rlryr_rYr=rU�rr�importlib.resources.abcr�test.supportr�importlib.machineryrr
rErG�ABCMetarIrpr�rrr�<module>r�sk��
��	�
�����2�&�+�""�^�""�J��F0�C�K�K�F0�R A� A�F�|�r

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