Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.11/test/test_importlib/resources/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.11/test/test_importlib/resources/__pycache__/util.cpython-311.pyc

�

SԚg����ddlZddlZddlZddlZddlZddlmZmZddlm	Z	ddlm
Z
ddlmZddl
mZddlmZGd	�d
e��Zdd�Zdd�ZGd�dej���ZGd�d��ZGd�de��ZdS)�N)�Path�PurePath�)�data01)�	zipdata01)�ResourceReader)�
import_helper)�
ModuleSpecc�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�Readerc�J�t|���|��dS�N)�vars�update)�self�kwargss  �?/usr/local/lib/python3.11/test/test_importlib/resources/util.py�__init__zReader.__init__s"���T�
�
���&�!�!�!�!�!�c��|Sr��r�packages  r�get_resource_readerzReader.get_resource_readers���rc�`�||_t|jt��r|j�|jSr)�_path�
isinstance�file�	Exception�r�paths  r�
open_resourcezReader.open_resources,����
��d�i��+�+�	��)�O��y�rc�`�||_t|jt��r|j�|jSr)rrr!r)r�path_s  r�
resource_pathzReader.resource_paths,����
��d�i��+�+�	��)�O��y�rc����|_t|jt��r|j�d�}t	�fd�t||j��D����S)Nc�,�|�d��S)N�/)�split)�entrys r�partz Reader.is_resource.<locals>.part)s���;�;�s�#�#�#rc3�V�K�|]#}t|��dko|d�kV��$dS)�rN)�len)�.0�partsr$s  �r�	<genexpr>z%Reader.is_resource.<locals>.<genexpr>,sL�����
�
�6;�C��J�J�!�O�1��a��E� 1�
�
�
�
�
�
r)rrr!r�any�map�	_contents)rr$r+s ` r�is_resourcezReader.is_resource$sz�����
��d�i��+�+�	��)�O�	$�	$�	$��
�
�
�
�?B�4���?X�?X�
�
�
�
�
�	
rc#�fK�t|jt��r|j�|jEd{V��dSr)rr!rr4�rs r�contentszReader.contents0sA�����d�i��+�+�	��)�O��>�!�!�!�!�!�!�!�!�!rN)	�__name__�
__module__�__qualname__rrr"r%r5r8rrrrrsn������"�"�"����������

�

�

�"�"�"�"�"rrTc�t�d}tj|��}t||d|���}||_||_|S)N�testingpackagezdoes-not-exist)�origin�
is_package)�types�
ModuleTyper
�__spec__�
__loader__)�loaderr?�name�module�specs     r�create_package_from_loaderrH6sB���D�
�
�d�
#�
#�F��d�F�+;�
�S�S�S�D��F�O��F���Mrrc�B�tt|||���|��S)N)rr!r4)rHr)rr!r?r8s    r�create_packagerJ?s)��%��D�t�x�8�8�8����rc�n�eZdZdZejd���Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
S)�CommonTestsz>
    Tests shared by test_open, test_path, and test_read.
    c��dS)zl
        Call the pertinent legacy API function (e.g. open_text, path)
        on package and path.
        Nr)rrr!s   r�executezCommonTests.executeKs���rc�F�|�tjd��dS�N�
utf-8.file)rNrr9r7s r�test_package_namezCommonTests.test_package_nameRs�����V�_�l�3�3�3�3�3rc�<�|�td��dSrP�rNrr7s r�test_package_objectzCommonTests.test_package_objectVs�����V�\�*�*�*�*�*rc�@�d}|�t|��dSrPrTr s  r�test_string_pathzCommonTests.test_string_pathZs!�������V�T�"�"�"�"�"rc�Z�td��}|�t|��dSrP)rrNrr s  r�test_pathlib_pathzCommonTests.test_pathlib_path_s)����%�%�����V�T�"�"�"�"�"rc�t�tjtj=|�tjd��dSrP)�sys�modulesrr9rNr7s r�$test_importing_module_as_side_effectz0CommonTests.test_importing_module_as_side_effectds*���K���(����V�_�l�3�3�3�3�3rc��|�t��5|�td��ddd��dS#1swxYwYdSrP)�assertRaises�	TypeErrorrNr9r7s r�test_non_package_by_namez$CommonTests.test_non_package_by_nameis���
�
�
�y�
)�
)�	1�	1��L�L��<�0�0�0�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1�	1����	1�	1�	1�	1�	1�	1s�A�A�Ac��|�t��5tjd}|�|d��ddd��dS#1swxYwYdS)Nz"test.test_importlib.resources.utilrQ)r_r`r[r\rN)rrFs  r�test_non_package_by_packagez'CommonTests.test_non_package_by_packagens���
�
�
�y�
)�
)�	/�	/��[�!E�F�F��L�L���.�.�.�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/�	/����	/�	/�	/�	/�	/�	/s�)A�A�Ac���tjd��}t|t�����}|�|d��|�|jjd��dS�Ns
Hello, world!�rr!rQ)�io�BytesIOrJ�FileNotFoundErrorrN�assertEqualrCr)r�
bytes_datars   r�test_missing_pathzCommonTests.test_missing_pathtsc���Z� 0�1�1�
� �j�7H�7J�7J�K�K�K�����W�l�+�+�+�����+�1�<�@�@�@�@�@rc���tjd��}t}t||���}|�|d��|�|jjd��dSre)rgrh�__file__rJrNrjrCr)rrkr!rs    r�test_extant_pathzCommonTests.test_extant_path}sa���Z� 0�1�1�
��� �j�t�<�<�<�����W�l�+�+�+�����+�1�<�@�@�@�@�@rc���tt��t�����}|�t��5|�|d��ddd��dS#1swxYwYdS)NrfrQ)rJrir_rNrs  r�test_useless_loaderzCommonTests.test_useless_loader�s��� �&7�&9�&9�@Q�@S�@S�T�T�T��
�
�
�0�
1�
1�	0�	0��L�L��,�/�/�/�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0�	0����	0�	0�	0�	0�	0�	0s�A(�(A,�/A,N)r9r:r;�__doc__�abc�abstractmethodrNrRrUrWrYr]rarcrlrorqrrrrLrLFs���������	�������4�4�4�+�+�+�#�#�#�
#�#�#�
4�4�4�
1�1�1�
/�/�/�A�A�A�	A�	A�	A�0�0�0�0�0rrL)�	metaclassc�D�eZdZdZed���Zed���Zd�ZdS)�ZipSetupBaseNc���t|jj��}|j}t	|dz��|_tj�|j��tj
d��|_dS)Nzziptestdata.zip�ziptestdata)r�
ZIP_MODULErn�parent�str�	_zip_pathr[r!�append�	importlib�
import_module�data)�cls�	data_path�data_dirs   r�
setUpClasszZipSetupBase.setUpClass�s]�����0�1�1�	��#���H�'8�8�9�9��
������
�&�&�&��*�=�9�9����rc��	tj�|j��n#t$rYnwxYw	tj|j=tj|jj=n#t$rYnwxYw	|`|`dS#t$rYdSwxYwr)r[r!�remover}�
ValueError�path_importer_cacher\r�r9�KeyError�AttributeError)r�s r�
tearDownClasszZipSetupBase.tearDownClass�s���	��H�O�O�C�M�*�*�*�*���	�	�	��D�	����	��'��
�6���C�H�-�.�.���	�	�	��D�	����	����
�
�
���	�	�	��D�D�	���s/�$'�
4�4�)A"�"
A/�.A/�3A9�9
B�Bc�\�tj��}|jtjg|�R�dSr)r	�
modules_setup�
addCleanup�modules_cleanup)rr\s  r�setUpzZipSetupBase.setUp�s3���-�/�/�����
�5�@��@�@�@�@�@�@r)r9r:r;rz�classmethodr�r�r�rrrrwrw�sa�������J��:�:��[�:�����[��$A�A�A�A�Arrwc��eZdZeZdS)�ZipSetupN)r9r:r;rrzrrrr�r��s�������J�J�Jrr�)T)NNTr)rsrrgr[r@�pathlibrr�rr�
importlib.abcr�test.supportr	�importlib.machineryr
rrHrJ�ABCMetarLrwr�rrr�<module>r�s���
�
�
�
�����	�	�	�	�
�
�
�
�����"�"�"�"�"�"�"�"�������������(�(�(�(�(�(�&�&�&�&�&�&�+�*�*�*�*�*�""�""�""�""�""�^�""�""�""�J��������E0�E0�E0�E0�E0�C�K�E0�E0�E0�E0�P A� A� A� A� A� A� A� A�F�����|�����r

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