Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.117.78.56
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : resources.cpython-36.pyc
3

���e*�@s�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZmZmZeje�ZdaGdd�de�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�de�Zed�ee
jeiZyFyddl Z!Wne"k
�r$ddl#Z!YnXeee!j$<eee!j%<[!Wne"e&fk
�rXYnXdd�Z'iZ(dd�Z)e	j*e+d��Z,dd�Z-dS)�)�unicode_literalsN�)�DistlibException)�cached_property�get_cache_base�path_to_cache_dir�Cachecs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	�
ResourceCacheNcs0|dkrtjjt�td��}tt|�j|�dS)Nzresource-cache)�os�path�joinr�str�superr	�__init__)�self�base)�	__class__��/usr/lib/python3.6/resources.pyrszResourceCache.__init__cCsdS)z�
        Is the cache stale for the given resource?

        :param resource: The :class:`Resource` being cached.
        :param path: The path of the resource in the cache.
        :return: True if the cache is stale.
        Tr)r�resourcerrrr�is_stale#s	zResourceCache.is_stalec	Cs�|jj|�\}}|dkr|}n~tjj|j|j|�|�}tjj|�}tjj|�sXtj	|�tjj
|�sjd}n|j||�}|r�t|d��}|j
|j�WdQRX|S)z�
        Get a resource into the cache,

        :param resource: A :class:`Resource` instance.
        :return: The pathname of the resource in the cache.
        NT�wb)�finder�get_cache_infor
rrrZ
prefix_to_dir�dirname�isdir�makedirs�existsr�open�write�bytes)rr�prefixr�resultrZstale�frrr�get.s
zResourceCache.get)N)�__name__�
__module__�__qualname__rrr$�
__classcell__rr)rrr	sr	c@seZdZdd�ZdS)�ResourceBasecCs||_||_dS)N)r�name)rrr*rrrrIszResourceBase.__init__N)r%r&r'rrrrrr)Hsr)c@s@eZdZdZdZdd�Zedd��Zedd��Zed	d
��Z	dS)�Resourcez�
    A class representing an in-package resource, such as a data file. This is
    not normally instantiated by user code, but rather by a
    :class:`ResourceFinder` which manages the resource.
    FcCs|jj|�S)z�
        Get the resource as a stream.

        This is not a property to make it obvious that it returns a new stream
        each time.
        )r�
get_stream)rrrr�	as_streamVszResource.as_streamcCstdkrt�atj|�S)N)�cacher	r$)rrrr�	file_path_szResource.file_pathcCs|jj|�S)N)r�	get_bytes)rrrrr fszResource.bytescCs|jj|�S)N)r�get_size)rrrr�sizejsz
Resource.sizeN)
r%r&r'�__doc__�is_containerr-rr/r r2rrrrr+Ns	r+c@seZdZdZedd��ZdS)�ResourceContainerTcCs|jj|�S)N)r�
get_resources)rrrr�	resourcesrszResourceContainer.resourcesN)r%r&r'r4rr7rrrrr5osr5c@s�eZdZdZejjd�rdZnd Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zeejj�Zdd�ZdS)!�ResourceFinderz4
    Resource finder for file system resources.
    �java�.pyc�.pyo�.classcCs.||_t|dd�|_tjjt|dd��|_dS)N�
__loader__�__file__�)�module�getattr�loaderr
rrr)rr@rrrr�szResourceFinder.__init__cCstjj|�S)N)r
r�realpath)rrrrr�_adjust_path�szResourceFinder._adjust_pathcCsBt|t�rd}nd}|j|�}|jd|j�tjj|�}|j|�S)N�/�/r)	�
isinstancer �split�insertrr
rrrD)r�
resource_name�sep�partsr"rrr�
_make_path�s

zResourceFinder._make_pathcCstjj|�S)N)r
rr)rrrrr�_find�szResourceFinder._findcCs
d|jfS)N)r)rrrrrr�szResourceFinder.get_cache_infocCsD|j|�}|j|�sd}n&|j|�r0t||�}n
t||�}||_|S)N)rMrN�
_is_directoryr5r+r)rrJrr"rrr�find�s



zResourceFinder.findcCst|jd�S)N�rb)rr)rrrrrr,�szResourceFinder.get_streamc	Cs t|jd��
}|j�SQRXdS)NrQ)rr�read)rrr#rrrr0�szResourceFinder.get_bytescCstjj|j�S)N)r
r�getsize)rrrrrr1�szResourceFinder.get_sizecs*�fdd��t�fdd�tj|j�D��S)Ncs|dko|j�j�S)N�__pycache__)�endswith�skipped_extensions)r#)rrr�allowed�sz-ResourceFinder.get_resources.<locals>.allowedcsg|]}�|�r|�qSrr)�.0r#)rWrr�
<listcomp>�sz0ResourceFinder.get_resources.<locals>.<listcomp>)�setr
�listdirr)rrr)rWrrr6�szResourceFinder.get_resourcescCs|j|j�S)N)rOr)rrrrrr4�szResourceFinder.is_containerccs�|j|�}|dk	r�|g}xn|r�|jd�}|V|jr|j}xH|jD]>}|sP|}ndj||g�}|j|�}|jrz|j|�qB|VqBWqWdS)NrrF)rP�popr4r*r7r�append)rrJrZtodoZrnamer*�new_nameZchildrrr�iterator�s 


zResourceFinder.iteratorN)r:r;r<)r:r;)r%r&r'r3�sys�platform�
startswithrVrrDrMrNrrPr,r0r1r6r4�staticmethodr
rrrOr_rrrrr8ws"r8cs`eZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Z�Z
S)�ZipResourceFinderz6
    Resource finder for resources in .zip files.
    csZtt|�j|�|jj}dt|�|_t|jd�r>|jj|_nt	j
||_t|j�|_dS)Nr�_files)
rrdrrB�archive�len�
prefix_len�hasattrre�	zipimport�_zip_directory_cache�sorted�index)rr@rf)rrrr�szZipResourceFinder.__init__cCs|S)Nr)rrrrrrD�szZipResourceFinder._adjust_pathcCs�||jd�}||jkrd}nX|r:|dtjkr:|tj}tj|j|�}y|j|j|�}Wntk
rtd}YnX|s�tj	d||j
j�ntj	d||j
j�|S)NTrFz_find failed: %r %rz_find worked: %r %r���)rhrer
rK�bisectrmrb�
IndexError�logger�debugrBr!)rrr"�irrrrN�s


zZipResourceFinder._findcCs&|jj}|jdt|�d�}||fS)Nr)rBrfrrg)rrr!rrrrr�sz ZipResourceFinder.get_cache_infocCs|jj|j�S)N)rB�get_datar)rrrrrr0�szZipResourceFinder.get_bytescCstj|j|��S)N)�io�BytesIOr0)rrrrrr,�szZipResourceFinder.get_streamcCs|j|jd�}|j|dS)N�)rrhre)rrrrrrr1szZipResourceFinder.get_sizecCs�|j|jd�}|r,|dtjkr,|tj7}t|�}t�}tj|j|�}xV|t|j�kr�|j|j|�sjP|j||d�}|j	|j
tjd�d�|d7}qJW|S)Nrrrn)rrhr
rKrgrZrormrb�addrH)rrrZplenr"rs�srrrr6s
zZipResourceFinder.get_resourcescCsj||jd�}|r*|dtjkr*|tj7}tj|j|�}y|j|j|�}Wntk
rdd}YnX|S)NrFrn)rhr
rKrormrbrp)rrrsr"rrrrOs

zZipResourceFinder._is_directory)r%r&r'r3rrDrNrr0r,r1r6rOr(rr)rrrd�srdcCs|tt|�<dS)N)�_finder_registry�type)rB�finder_makerrrr�register_finder0sr}cCs�|tkrt|}nv|tjkr$t|�tj|}t|dd�}|dkrJtd��t|dd�}tjt|��}|dkrxtd|��||�}|t|<|S)z�
    Return a resource finder for a package.
    :param package: The name of the package.
    :return: A :class:`ResourceFinder` instance for the package.
    �__path__Nz8You cannot get a finder for a module, only for a packager=zUnable to locate finder for %r)	�
_finder_cacher`�modules�
__import__rArrzr$r{)�packager"r@rrBr|rrrr6s


rZ	__dummy__cCsRd}tj|�tjj|�}tjt|��}|rNt}tj	j
|d�|_||_||�}|S)z�
    Return a resource finder for a path, which should represent a container.

    :param path: The path.
    :return: A :class:`ResourceFinder` instance for the path.
    Nr?)
�pkgutilZget_importerr`�path_importer_cacher$rzr{�
_dummy_moduler
rrr>r=)rr"rBrr@rrr�finder_for_pathRs
r�).Z
__future__rroruZloggingr
r�Zshutilr`�typesrjr?r�utilrrrrZ	getLoggerr%rqr.r	�objectr)r+r5r8rdr{�zipimporterrz�_frozen_importlib_externalZ_fi�ImportError�_frozen_importlib�SourceFileLoader�
FileFinder�AttributeErrorr}rr�
ModuleTyper
r�r�rrrr�<module>sH
,!ZN



© 2025 GrazzMean