https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/distlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/distlib/__pycache__/resources.cpython-310.pyc
o

��`D*�	@s~ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZe�e�ZdaGdd�de�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�de�Zed�ee	jeiZz&zddlZWn
e y�ddl!ZYnweeej"<eeej#<eeej$<[Wne e%fy�Ynwdd�Z&iZ'dd�Z(e�)e*d��Z+dd�Z,dS)�)�unicode_literalsN�)�DistlibException)�cached_property�get_cache_base�Cachecs.eZdZd�fdd�	Zdd�Zdd�Z�ZS)	�
ResourceCacheNcs0|durtj�t�td��}tt|��|�dS)Nzresource-cache)�os�path�joinr�str�superr�__init__)�self�base��	__class__��3/usr/lib/python3/dist-packages/distlib/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�resourcer
rrr�is_stale"s	zResourceCache.is_stalecCs�|j�|�\}}|dur|}|Stj�|j|�|�|�}tj�|�}tj�|�s-t�	|�tj�
|�s6d}n|�||�}|rZt|d��}|�
|j�Wd�|S1sUwY|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	r
rr�
prefix_to_dir�dirname�isdir�makedirs�existsr�open�write�bytes)rr�prefixr
�resultr�stale�frrr�get-s$�

��zResourceCache.get�N)�__name__�
__module__�__qualname__rrr'�
__classcell__rrrrrsrc@seZdZdd�ZdS)�ResourceBasecCs||_||_dSr()r�name)rrr.rrrrHs
zResourceBase.__init__N)r)r*r+rrrrrr-Gsr-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.
    FcC�|j�|�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_streamUszResource.as_streamcCstdurt�at�|�Sr()�cacherr'r2rrr�	file_path^s
zResource.file_pathcCr0r()r�	get_bytesr2rrrr"e�zResource.bytescCr0r()r�get_sizer2rrr�sizeir7z
Resource.sizeN)
r)r*r+�__doc__�is_containerr3rr5r"r9rrrrr/Ms	

r/c@seZdZdZedd��ZdS)�ResourceContainerTcCr0r()r�
get_resourcesr2rrr�	resourcesqr7zResourceContainer.resourcesN)r)r*r+r;rr>rrrrr<nsr<c@s�eZdZdZej�d�rdZndZdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zeejj�Zdd�ZdS)�ResourceFinderz4
    Resource finder for file system resources.
    �java)�.pyc�.pyoz.class)rArBcCs.||_t|dd�|_tj�t|dd��|_dS)N�
__loader__�__file__�)�module�getattr�loaderr	r
rr)rrFrrrr�szResourceFinder.__init__cC�tj�|�Sr()r	r
�realpath�rr
rrr�_adjust_path��zResourceFinder._adjust_pathcCsBt|t�rd}nd}|�|�}|�d|j�tjj|�}|�|�S)N�/�/r)	�
isinstancer"�split�insertrr	r
rrL)r�
resource_name�sep�partsr$rrr�
_make_path�s


zResourceFinder._make_pathcCrIr()r	r
rrKrrr�_find�rMzResourceFinder._findcCs
d|jfSr()r
�rrrrrr�s
zResourceFinder.get_cache_infocCsF|�|�}|�|�sd}|S|�|�rt||�}nt||�}||_|Sr()rVrW�
_is_directoryr<r/r
)rrSr
r$rrr�find�s


�
zResourceFinder.findcCst|jd�S�N�rb)r r
rXrrrr1�rMzResourceFinder.get_streamcCs8t|jd��}|��Wd�S1swYdSr[)r r
�read)rrr&rrrr6�s$�zResourceFinder.get_bytescCstj�|j�Sr()r	r
�getsizerXrrrr8��zResourceFinder.get_sizecs*�fdd��t�fdd�t�|j�D��S)Ncs|dko
|��j�S)N�__pycache__)�endswith�skipped_extensions)r&r2rr�allowed�s
�z-ResourceFinder.get_resources.<locals>.allowedcsg|]}�|�r|�qSrr)�.0r&)rcrr�
<listcomp>�sz0ResourceFinder.get_resources.<locals>.<listcomp>)�setr	�listdirr
rXr)rcrrr=�szResourceFinder.get_resourcescCs|�|j�Sr()rYr
rXrrrr;�rMzResourceFinder.is_containerccs��|�|�}|durD|g}|rF|�d�}|V|jr@|j}|jD]}|s'|}nd�||g�}|�|�}|jr<|�|�q |Vq |sdSdSdS)NrrO)rZ�popr;r.r>r�append)rrSr�todo�rnamer.�new_name�childrrr�iterator�s(�



��zResourceFinder.iteratorN)r)r*r+r:�sys�platform�
startswithrbrrLrVrWrrZr1r6r8r=r;�staticmethodr	r
rrYrnrrrrr?vs$r?cs`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|��|�|jj}dt|�|_t|jd�r|jj|_nt	j
||_t|j�|_dS)Nr�_files)
r
rsrrH�archive�len�
prefix_len�hasattrrt�	zipimport�_zip_directory_cache�sorted�index)rrFrurrrr�szZipResourceFinder.__init__cCs|Sr(rrKrrrrL�szZipResourceFinder._adjust_pathcCs�||jd�}||jvrd}n+|r|dtjkr|tj}t�|j|�}z
|j|�|�}Wnty9d}Ynw|sGt�	d||j
j�|St�	d||j
j�|S)NT���Fz_find failed: %r %rz_find worked: %r %r)rwrtr	rT�bisectr|rq�
IndexError�logger�debugrHr#)rr
r$�irrrrW�s 

��zZipResourceFinder._findcCs&|jj}|jdt|�d�}||fS)Nr)rHrur
rv)rrr#r
rrrr�sz ZipResourceFinder.get_cache_infocCs|j�|j�Sr()rH�get_datar
rXrrrr6�r_zZipResourceFinder.get_bytescCst�|�|��Sr()�io�BytesIOr6rXrrrr1��zZipResourceFinder.get_streamcCs|j|jd�}|j|dS)N�)r
rwrtrrrrr8�szZipResourceFinder.get_sizecCs�|j|jd�}|r|dtjkr|tj7}t|�}t�}t�|j|�}|t|j�krV|j|�|�s6	|S|j||d�}|�	|�
tjd�d�|d7}|t|j�ks+|S)Nr}rr)r
rwr	rTrvrfr~r|rq�addrQ)rrr
�plenr$r��srrrr=s
��zZipResourceFinder.get_resourcescCsh||jd�}|r|dtjkr|tj7}t�|j|�}z|j|�|�}W|Sty3d}Y|Sw)Nr}F)rwr	rTr~r|rqr)rr
r�r$rrrrYs
��zZipResourceFinder._is_directory)r)r*r+r:rrLrWrr6r1r8r=rYr,rrrrrs�srscCs|tt|�<dSr()�_finder_registry�type)rH�finder_makerrrr�register_finder2r�r�cCs�|tvr
t|}|S|tjvrt|�tj|}t|dd�}|dur&td��t|dd�}t�t|��}|dur=td|��||�}|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 packagerCzUnable to locate finder for %r)	�
_finder_cachero�modules�
__import__rGrr�r'r�)�packager$rFr
rHr�rrrr9s 
�
r�	__dummy__cCsRd}t�|�tj�|�}t�t|��}|r't}tj	�
|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.
    NrE)
�pkgutil�get_importerro�path_importer_cacher'r�r��
_dummy_moduler	r
rrDrC)r
r$rHrrFrrr�finder_for_pathUs
r�)-�
__future__rr~r��loggingr	r�ro�typesryrEr�utilrrr�	getLoggerr)r�r4r�objectr-r/r<r?rsr��zipimporterr��_frozen_importlib_external�_fi�ImportError�_frozen_importlib�SourceFileLoader�
FileFinder�SourcelessFileLoader�AttributeErrorr�r�r�
ModuleTyperr�r�rrrr�<module>sP
,!ZO��


�

https://t.me/RX1948 - 2025