403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.217.141
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python312/Lib/test/test_importlib/resources/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/test/test_importlib/resources/__pycache__/test_files.cpython-312.pyc
�

���g���ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddlm
Z
ddlmZddl
mZddl
mZddl
mZddlmZmZe	j(d	��ZGd
�d�ZGd�d
eej.�ZGd�deej2ej.�ZGd�deej.�ZGd�d�ZGd�deej.�ZGd�deej.�Zedk(rej@�yy)�N)�	resources)�Traversable�)�data01)�util)�_path)�	os_helper�
import_helperc#�K�tjd��5}tjdt��|��ddd�y#1swYyxYw�w)NT)�record�default)�category)�warnings�catch_warnings�simplefilter�DeprecationWarning)�ctxs �=C:\Python312\\Lib\test\test_importlib\resources\test_files.py�suppress_known_deprecationrs7����	�	 �	 ��	-�����i�2D�E��	�
.�	-�	-�s�A� A�	A�A�Ac�^�eZdZd�Zd�Zejeed�d�d��Z	d�Z
y)�
FilesTestsc��tj|j�}|jd�j	�}|dk(sJ�y)N�
utf-8.filesHello, UTF-8 world!
)r�files�data�joinpath�
read_bytes��selfr�actuals   r�test_read_byteszFilesTests.test_read_bytess:������	�	�*������-�8�8�:���1�1�1�1�c��tj|j�}|jd�j	d��}|dk(sJ�y)Nr�utf-8��encodingzHello, UTF-8 world!
)rrrr�	read_textrs   r�test_read_textzFilesTests.test_read_text!s?������	�	�*������-�7�7��7�I���0�0�0�0r"�runtime_checkablez4Only suitable when typing supports runtime_checkablec�b�ttj|j�t�sJ�y�N)�
isinstancerrrr�rs r�test_traversablezFilesTests.test_traversable&s!��
�)�/�/�$�)�)�4�k�B�B�Br"c��t�5tj|j��ddd�y#1swYyxYw)zx
        Files used to take a 'package' parameter. Make sure anyone
        passing by name is still supported.
        )�packageN)rrrrr-s r�test_old_parameterzFilesTests.test_old_parameter-s&��
(�
)��O�O�D�I�I�.�*�
)�
)�s�!5�>N)�__name__�
__module__�__qualname__r!r(�unittest�
skipUnless�hasattr�typingr.r1�r"rrrsB��2�
1�
�X�����+�,�>��C�	�C�/r"rc��eZdZd�Zy)�
OpenDiskTestsc��t|_yr+)rrr-s r�setUpzOpenDiskTests.setUp7s	����	r"N�r2r3r4r=r9r"rr;r;6s��r"r;c��eZdZy)�OpenZipTestsN)r2r3r4r9r"rr@r@;s��r"r@c��eZdZd�Zy)�OpenNamespaceTestsc��ddlm}||_y)Nr)�namespacedata01)�rDr)rrDs  rr=zOpenNamespaceTests.setUp@s��%�#��	r"Nr>r9r"rrBrB?s��$r"rBc��eZdZd�Zy)�SiteDirc��tj�|_|j|jj�|jjt
j��|_|jjtj|j��|jjtj��yr+)�
contextlib�	ExitStack�fixtures�
addCleanup�close�
enter_contextr	�temp_dir�site_dirr
�
DirsOnSysPath�isolated_modulesr-s rr=z
SiteDir.setUpGs���"�,�,�.��
�����
�
�+�+�,��
�
�3�3�I�4F�4F�4H�I��
��
�
�#�#�M�$?�$?��
�
�$N�O��
�
�#�#�M�$B�$B�$D�Er"Nr>r9r"rrGrGFs��Fr"rGc��eZdZd�Zy)�ModulesFilesTestsc���ddd�}tj||j�ddl}t	j
|�j
d�jd��}||dk(sJ�y)	zK
        A module can have resources found adjacent to the module.
        rE�resources are the best)zmod.py�res.txtrNrWr$r%)r�buildrP�modrrrr')r�specrYr s    r�test_module_resourcesz'ModulesFilesTests.test_module_resourcesPsa��
�/�
��	���D�$�-�-�(������%�.�.�y�9�C�C�W�C�U����i��(�(�(r"N)r2r3r4r[r9r"rrTrTOs��)r"rTc�$�eZdZd�Zd�Zd�Zd�Zy)�ImplicitContextFilesTestsc��dtjd�dd�i}tj||j�tjd�jdk(sJ�y)zW
        Without any parameter, files() will infer the location as the caller.
        �somepkgz�
                    import importlib.resources as res
                    val = res.files().joinpath('res.txt').read_text(encoding='utf-8')
                    rV��__init__.pyrWN)�textwrap�dedentrrXrP�	importlib�
import_module�val)rrZs  r�test_implicit_filesz-ImplicitContextFilesTests.test_implicit_files`s]��

�'���� �4��

��	���D�$�-�-�(��&�&�y�1�5�5�9Q�Q�Q�Qr"c����ddl��fd�}tjd�}d||dd�i}|jj	tj��}tj||�tjj|jd�}|||�|jj	tj|��tj d	�j"dk(sJ�y)
z=
        Special test for gh-121735 for Python 3.12.
        rNc�D���	j|d�5}tj|�D]_\}}}|D]T}tjj	||�}tjj||�}|j
||��V�a	ddd�y#1swYyxYw)N�w)�ZipFile�os�walk�path�join�relpath�write)
�
source_dir�zip_filename�zipf�root�_r�file�	file_path�arcname�zipfiles
         �r�create_zip_from_directoryz^ImplicitContextFilesTests.test_implicit_files_zip_submodule.<locals>.create_zip_from_directoryxsx�������s�3�t�&(�g�g�j�&9�N�D�!�U� %��$&�G�G�L�L��t�$<�	�"$�'�'�/�/�)�Z�"H���
�
�9�g�6�	!&�':�4�3�3�s�A8B�Bz�
            import importlib.resources as res
            val = res.files().joinpath('res.txt').read_text(encoding='utf-8')
            r_rV)raz	submod.pyrWz
thepkg.zipzsomepkg.submod)rzrbrcrKrNr	rOrrXrlrnrorPr
rQrdrerf)rr{�set_valrZ�	build_dir�zip_filerzs      @r�!test_implicit_files_zip_submodulez;ImplicitContextFilesTests.test_implicit_files_zip_submodulers����	�	7��/�/�
�
��
�&�$�3��
���M�M�/�/�	�0B�0B�0D�E�	�
���D�)�$��7�7�<�<��
�
�|�<��!�)�X�6��
�
�#�#�M�$?�$?��$I�J��&�&�'7�8�<�<�@X�X�X�Xr"c��|jjtj��}t	j
|d�}t	j
tj�j}|jd�D]G}|j|j|��jd�}tj||��I|jjtj |��y)z�
        Make a compiled-only copy of the importlib resources package.

        Currently only code is copied, as importlib resources doesn't itself
        have any resources.
        �c_resourcesz**/*.pyz.pycN)rKrNr	rO�pathlib�Pathr�__file__�parent�globr�relative_to�with_suffix�
py_compile�compiler
rQ)r�bin_siter��sources�source_path�c_paths      r�_compile_importlibz,ImplicitContextFilesTests._compile_importlib�s����=�=�.�.�y�/A�/A�/C�D���l�l�8�]�;���,�,�y�1�1�2�9�9��"�<�<�	�2�K� �)�)�+�*A�*A�'�*J�K�W�W�X^�_�F����{�F�3�3�	
�
�
�#�#�M�$?�$?��$I�Jr"c�D�tjdtj�d��}d|j	tjd�dd�i}tj||j�|j�tjd�jdk(sJ�y)zk
        Caller detection works for compiled-only resources module.

        python/cpython#123085
        z
            import zb as res
            val = res.files().joinpath('res.txt').read_text(encoding='utf-8')
            �	frozenpkgr�rVr`N)rbrcrr2�replacerrXrPr�rdrerf)rr|rZs   r�+test_implicit_files_with_compiled_importlibzEImplicitContextFilesTests.test_implicit_files_with_compiled_importlib�s����/�/���&�&�'�(
�
�
��
�&���y�/A�/A�=�Q�3��
��	���D�$�-�-�(����!��&�&�{�3�7�7�;S�S�S�Sr"N)r2r3r4rgrr�r�r9r"rr]r]_s��R�$!Y�FK� Tr"r]�__main__)!r8rlr�r��shutilrbr5rrdrIr�importlib.resources.abcrrErrr�test.supportr	r
�contextmanagerrr�TestCaser;�ZipSetupr@rBrGrTr]r2�mainr9r"r�<module>r�s���
�	���
�������/����1�������/�/�6�J�� 1� 1��
	�:�t�}�}�h�.?�.?�	�$��X�%6�%6�$�F�F�
)���!2�!2�
)� ZT���):�):�ZT�z�z���H�M�M�O�r"

Youez - 2016 - github.com/yon3zu
LinuXploit