Hacked By AnonymousFox

Current Path : /opt/alt/python39/lib64/python3.9/importlib/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/importlib/__pycache__/resources.cpython-39.opt-1.pyc

a

R�f)�@s�ddlZddlmZddlmZddlmZddlmZmZddl	m
Z
ddlmZdd	l
mZmZdd
lmZddlmZddlmZmZmZmZdd
lmZddlmZmZgd�ZeeefZeeej fZ!ed�dd�Z"ed�dd�Z#ed�dd�Z$eeej%d�dd�Z&dd�Z'ee!ed�dd�Z(d4ee!eeed!�d"d#�Z)ee!e*d�d$d%�Z+d5ee!eeed!�d&d'�Z,eej-d�d(d)�Z.ee!d*d�d+d,�Z/ed-d.��Z0eee1d/�d0d1�Z2eeed�d2d3�Z3dS)6�N�)�abc)�_common)�as_file)�contextmanager�suppress)�
import_module)�ResourceLoader)�BytesIO�
TextIOWrapper)�Path)�
ModuleType)�ContextManager�Iterable�Optional�Union)�cast)�BinaryIO�TextIO)�Package�Resourcer�contents�files�is_resource�open_binary�	open_text�path�read_binary�	read_text)�returncCst|d�r|St|�S)z)If name is a string, resolve to a module.�__spec__)�hasattrr��name�r$�8/opt/alt/python39/lib64/python3.9/importlib/resources.py�_resolve$s
r&cCs&t|�}|jjdur"td�|���|S)z�Take a package name or module object and return the module.

    If a name, the module is imported.  If the resolved module
    object is not a package, raise an exception.
    Nz{!r} is not a package)r&r �submodule_search_locations�	TypeError�format)�package�moduler$r$r%�_get_package+sr,cCs&tj�|�\}}|r"td�|���|S)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 name)�osr�split�
ValueErrorr))r�parent�	file_namer$r$r%�_normalize_path7sr2)r*rcCs,|j}t|jd�r(ttj|j�|j��SdS)N�get_resource_reader)r r!�loaderr�
resources_abc�ResourceReaderr3r#)r*�specr$r$r%�_get_resource_readerBs�r8cCs&|jjdus|jjs"td|����dS)NzPackage has no location )r �origin�has_location�FileNotFoundError�r*r$r$r%�_check_locationPsr=)r*�resourcerc
Cs�t|�}t|�}t|�}|dur*|�|�Stj�|jjp:d�}tj�	|�}tj�
||�}zt|dd�WSty�t
t|jj�}d}t|jjd�r�tt��|�|�}Wd�n1s�0Y|dur�|jj}d�||�}	t|	��t|�YS0dS)zDReturn a file-like object opened for binary reading of the resource.Nznon-existent file�rb)�mode�get_dataz{!r} resource not found in {!r})r2r,r8�
open_resourcer-r�abspathr r9�dirname�join�open�OSErrorrr	r4r!rrAr#r)r;r
)
r*r>�readerZabsolute_package_path�package_path�	full_pathr4�dataZpackage_name�messager$r$r%rUs2

�
(�r�utf-8�strict)r*r>�encoding�errorsrcCstt||�||d�S)zBReturn a file-like object opened for text reading of the resource.)rOrP)rr)r*r>rOrPr$r$r%rss�rcCs6t||��}|��Wd�S1s(0YdS)z+Return the binary contents of the resource.N)r�read)r*r>�fpr$r$r%r|srcCs:t||||��}|��Wd�S1s,0YdS)z�Return the decoded string of the resource.

    The decoding-related arguments have the same semantics as those of
    bytes.decode().
    N)rrQ)r*r>rOrPrRr$r$r%r�s	rcCst�t|��S)z3
    Get a Traversable resource from a package
    )r�from_packager,r<r$r$r%r�srzContextManager[Path]cCs2tt|��}|rt||�St�t|��t|���S)akA 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).
    )r8r,�_path_from_readerrrr�joinpathr2)r*r>rHr$r$r%r�s
��rccs�t|�}tt��"t|�|��VWd�dS1s80Y|�|�}tj|j|d��}|VWd�n1sx0YdS)N)�suffix)	r2rr;r�
resource_pathrBrZ	_tempfilerQ)rHr>Z
norm_resourceZ
opener_reader�resr$r$r%rT�s
 
rT)r*r#rcCsTt|�}t|�t|�}|dur*|�|�Stt|��}||vrBdSt�|�|��S)zYTrue if 'name' is a resource inside 'package'.

    Directories are *not* resources.
    NF)	r,r2r8r�setrrrS�is_file)r*r#rHZpackage_contentsr$r$r%r�s
rcCsdt|�}t|�}|dur |��S|jjdup6|jjdk}|sD|jjsHdStdd�t�|��	�D��S)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.
    N�	namespacer$css|]}|jVqdS)Nr")�.0�itemr$r$r%�	<genexpr>��zcontents.<locals>.<genexpr>)
r,r8rr r9r:�listrrS�iterdir)r*rHr[r$r$r%r�s
�r)rMrN)rMrN)4r-�rr5rr�
contextlibrr�	importlibr�
importlib.abcr	�ior
r�pathlibr�typesr
�typingrrrrrZ	typing.iorr�__all__�strr�PathLikerr&r,r2r6r8r=rr�bytesrr�TraversablerrrT�boolrrr$r$r$r%�<module>sZ
� ��	��
�



Hacked By AnonymousFox1.0, Coded By AnonymousFox