����JFIF���������
1#@!#!123s
D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
proc
/
self
/
root
/
usr
/
lib64
/
python3.8
/
importlib
/
__pycache__
/
Filename :
resources.cpython-38.pyc
back
Copy
U ����e5d@%������������������� ���@���s���d�dl�Z�d�dlZddlmZ�d�dlmZmZ�d�dlm Z �d�dl mZ�d�dlm Z mZ�d�dlmZ�d�d lmZ�d�d lmZmZmZmZmZ�d�dlmZ�d�dlmZmZ�d�d lmZ�dddddddddg Zee ef�Z!ee e�j"f�Z#ed�dd�Z$e d�dd�Z%eeej&�d�dd�Z'dd ��Z(e!e#ed!�d"d�Z)d-e!e#e e ed%�d&d�Z*e!e#e+d!�d'd�Z,d.e!e#e e e d%�d(d�Z-ee!e#ee�d!�d)d��Z.e!e e/d*�d+d�Z0e!ee �d�d,d�Z1dS�)/�����N����)�abc)�contextmanager�suppress)� import_module)�ResourceLoader)�BytesIO� TextIOWrapper)�Path)� ModuleType)�Iterable�Iterator�Optional�Set�Union)�cast)�BinaryIO�TextIO)�ZipImportError�Package�Resource�contents�is_resource�open_binary� open_text�path�read_binary� read_text)�returnc�����������������C���s\���t�|�d�r0|�jjdkr*td�|�jj���qX|�S�n(t|��}|jjdkrTtd�|����n|S�dS�)z�Take a package name or module object and return the module. If a name, the module is imported. If the passed or imported module object is not a package, raise an exception. �__spec__Nz{!r} is not a package)�hasattrr����submodule_search_locations� TypeError�format�namer���)�package�module��r'����+/usr/lib64/python3.8/importlib/resources.py�_get_package"���s���� �r)���c�����������������C���s,���t�j�|��\}}|r$td�|����n|S�dS�)z�Normalize a path by ensuring it is a string. If the resulting string contains path separators, an exception is raised. z{!r} must be only a file nameN)�osr����split� ValueErrorr#���)r����parent� file_namer'���r'���r(����_normalize_path6���s����r/���)r%���r���c�����������������C���s,���|�j�}t|jd�r(ttj|j�|j��S�d�S�)N�get_resource_reader)r���r ����loaderr���� resources_abc�ResourceReaderr0���r$���)r%����specr'���r'���r(����_get_resource_readerB���s�����r5���c�����������������C���s&���|�j�jd�ks|�j�js"td|�����d�S�)NzPackage has no location )r����origin�has_location�FileNotFoundError)r%���r'���r'���r(����_check_locationP���s����r9���)r%����resourcer���c����������� ������C���s����t�|�}t|��}�t|��}|dk r*|�|�S�t|���tj�|�jj �}tj� |�}tj�||�}zt|dd�W�S��t k r����tt|�jj�}d}t|�jjd�r�tt ���|�|�}W�5�Q�R�X�|dkr�|�jj}d�||�} t| ��nt|��Y�S�Y�nX�dS�)zDReturn a file-like object opened for binary reading of the resource.N�rb)�mode�get_data�{!r} resource not found in {!r})r/���r)���r5���� open_resourcer9���r*���r����abspathr���r6����dirname�join�open�OSErrorr���r���r1���r ���r���r=���r$���r#���r8���r���) r%���r:����reader�absolute_package_path�package_path� full_pathr1����data�package_name�messager'���r'���r(���r���U���s2���� �� �utf-8�strict)r%���r:����encoding�errorsr���c�����������������C���s ��t�|�}t|��}�t|��}|dk r2t|�|�||�S�t|���tj�|�j j �}tj�|�}tj�||�}zt |d||d�W�S��tk �r���tt|�j j�}d} t|�j jd�r�tt���|�|�} W�5�Q�R�X�| dkr�|�j j} d�|| �}t|��ntt| �||��Y�S�Y�nX�dS�)zBReturn a file-like object opened for text reading of the resource.N�r)r<���rN���rO���r=���r>���)r/���r)���r5���r ���r?���r9���r*���r���r@���r���r6���rA���rB���rC���rD���r���r���r1���r ���r���r=���r$���r#���r8���r���)r%���r:���rN���rO���rE���rF���rG���rH���r1���rI���rJ���rK���r'���r'���r(���r���t���s2���� �� c�������������� ���C���s:���t�|�}t|��}�t|�|��}|���W��5�Q�R���S�Q�R�X�dS�)z+Return the binary contents of the resource.N)r/���r)���r����read)r%���r:����fpr'���r'���r(���r�������s����c�������������� ���C���s>���t�|�}t|��}�t|�|||��}|���W��5�Q�R���S�Q�R�X�dS�)z�Return the decoded string of the resource. The decoding-related arguments have the same semantics as those of bytes.decode(). N)r/���r)���r���rQ���)r%���r:���rN���rO���rR���r'���r'���r(���r�������s���� c����������� ������c���s��t�|�}t|��}�t|��}|dk rNzt|�|��V��W�dS��tk rJ���Y�qVX�nt|���d}|�jjdk r|t|�jj�j }||�}|dk r�|� ��r�|V��nxt|�|��}|���}W�5�Q�R�X�t ���\}}z$t�||��t�|��t|�V��W�5�zt�|��W�n�tk �r���Y�nX�X�dS�)ak��A context manager providing a file path object to the resource. If the resource does not already exist on its own on the file system, a temporary file will be created. If the file was created, the file will be deleted upon exiting the context manager (no exception is raised if the file was deleted prior to the context manager exiting). N)r/���r)���r5���r ���� resource_pathr8���r9���r���r6���r-����existsr���rQ����tempfileZmkstempr*����remove�write�close) r%���r:���rE���Z file_path�package_directoryrR���rI����fdZraw_pathr'���r'���r(���r�������s6���� )r%���r$���r���c�������������� ���C���s|���t�|��}�t|��t|��}|dk r*|�|�S�ztt|���}W�n�ttfk rT���Y�dS�X�||krbdS�t|�j j �j|�}|���S�)zYTrue if 'name' is a resource inside 'package'. Directories are *not* resources. NF) r)���r/���r5���r����setr����NotADirectoryErrorr8���r ���r���r6���r-����is_file)r%���r$���rE���Zpackage_contentsr���r'���r'���r(���r�������s���� c�����������������C���sT���t�|��}�t|��}|dk r |���S�|�jjdks4|�jjs8dS�t|�jj�j}t� |�S�dS�)z�Return an iterable of entries in 'package'. Note that not all entries are resources. Specifically, directories are not considered resources. Use `is_resource()` on each entry returned here to check if it is a resource or not. Nr'���) r)���r5���r���r���r6���r7���r ���r-���r*����listdir)r%���rE���rY���r'���r'���r(���r�������s����)rL���rM���)rL���rM���)2r*���rU�����r���r2���� contextlibr���r���� importlibr���� importlib.abcr����ior���r ����pathlibr ����typesr����typingr���r ���r���r���r���r���Z typing.ior���r���Z zipimportr����__all__�strr����PathLiker���r)���r/���r3���r5���r9���r���r����bytesr���r���r����boolr���r���r'���r'���r'���r(����<module>���sh���� ��!�����" �����.