ok

Mini Shell

Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/distlib/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/distlib/__pycache__/resources.cpython-311.pyc

�

�܋fD*��4�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZeje��ZdaGd�de��ZGd�d	e��ZGd
�de��ZGd�d
e��ZGd�de��ZGd�de��Zed��ee	jeiZ		ddlZn#e $rddl!ZYnwxYweeej"<eeej#<eeej$<[n
#e e%f$rYnwxYwd�Z&iZ'd�Z(ej)e*d����Z+d�Z,dS)�)�unicode_literalsN�)�DistlibException)�cached_property�get_cache_base�Cachec�,��eZdZd�fd�	Zd�Zd�Z�xZS)�
ResourceCacheNc����|�9tj�t��t	d����}tt|���|��dS)Nzresource-cache)�os�path�joinr�str�superr
�__init__)�self�base�	__class__s  ��b/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/distlib/resources.pyrzResourceCache.__init__sP����<��7�<�<�� 0� 0�#�6F�2G�2G�H�H�D�
�m�T�"�"�+�+�D�1�1�1�1�1�c��dS)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.
        T��r�resourcer
s   r�is_stalezResourceCache.is_stale"s	���trc�Z�|j�|��\}}|�|}�ntj�|j|�|��|��}tj�|��}tj�|��stj	|��tj�
|��sd}n|�||��}|rBt|d��5}|�
|j��ddd��n#1swxYwY|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�fs        r�getzResourceCache.get-s<�� ��5�5�h�?�?�����>��F�F��W�\�\�$�)�T�-?�-?��-G�-G��N�N�F��g�o�o�f�-�-�G��7�=�=��)�)�
%���G�$�$�$��7�>�>�&�)�)�
6�����
�
�h��5�5���
,��&�$�'�'�,�1��G�G�H�N�+�+�+�,�,�,�,�,�,�,�,�,�,�,����,�,�,�,��
s�9D � D$�'D$�N)�__name__�
__module__�__qualname__rrr,�
__classcell__�rs@rr
r
s[�������2�2�2�2�2�2�	�	�	�������rr
c��eZdZd�ZdS)�ResourceBasec�"�||_||_dSr-)r�name)rrr6s   rrzResourceBase.__init__Hs�������	�	�	rN)r.r/r0rrrrr4r4Gs#����������rr4c�^�eZdZdZdZd�Zed���Zed���Zed���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.
    Fc�6�|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�rs r�	as_streamzResource.as_streamUs���{�%�%�d�+�+�+rc�`�t�t��at�|��Sr-)�cacher
r,r;s r�	file_pathzResource.file_path^s"���=�!�O�O�E��y�y����rc�6�|j�|��Sr-)r�	get_bytesr;s rr'zResource.byteses���{�$�$�T�*�*�*rc�6�|j�|��Sr-)r�get_sizer;s r�sizez
Resource.sizeis���{�#�#�D�)�)�)rN)
r.r/r0�__doc__�is_containerr<rr?r'rDrrrr8r8Ms���������
�L�,�,�,�����_���+�+��_�+��*�*��_�*�*�*rr8c�(�eZdZdZed���ZdS)�ResourceContainerTc�6�|j�|��Sr-)r�
get_resourcesr;s r�	resourceszResourceContainer.resourcesqs���{�(�(��.�.�.rN)r.r/r0rFrrKrrrrHrHns2�������L��/�/��_�/�/�/rrHc���eZdZdZej�d��rdZndZd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zeejj��Zd�ZdS)�ResourceFinderz4
    Resource finder for file system resources.
    �java)�.pyc�.pyoz.class)rOrPc��||_t|dd��|_tj�t|dd����|_dS)N�
__loader__�__file__�)�module�getattr�loaderrr
r!r)rrUs  rrzResourceFinder.__init__�sA������f�l�D�9�9����G�O�O�G�F�J��$C�$C�D�D��	�	�	rc�@�tj�|��Sr-)rr
�realpath�rr
s  r�_adjust_pathzResourceFinder._adjust_path�s���w����%�%�%rc���t|t��rd}nd}|�|��}|�d|j��tjj|�}|�|��S)N�/�/r)	�
isinstancer'�split�insertrrr
rr[)r�
resource_name�sep�partsr)s     r�
_make_pathzResourceFinder._make_path�sm���m�U�+�+�	��C�C��C��#�#�C�(�(��
���Q��	�"�"�"����u�%��� � ��(�(�(rc�@�tj�|��Sr-)rr
r$rZs  r�_findzResourceFinder._find�s���w�~�~�d�#�#�#rc��d|jfSr-)r
�rrs  rrzResourceFinder.get_cache_info�s���X�]�"�"rc���|�|��}|�|��sd}n=|�|��rt||��}nt	||��}||_|Sr-)rerg�
_is_directoryrHr8r
)rrbr
r)s    r�findzResourceFinder.find�sp�����}�-�-���z�z�$���	��F�F��!�!�$�'�'�
7�*�4��?�?���!�$�
�6�6���F�K��
rc�,�t|jd��S�N�rb)r%r
ris  rr:zResourceFinder.get_stream�s���H�M�4�(�(�(rc��t|jd��5}|���cddd��S#1swxYwYdSrn)r%r
�read)rrr+s   rrAzResourceFinder.get_bytes�s���
�(�-��
&�
&�	�!��6�6�8�8�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�7�;�;c�J�tj�|j��Sr-)rr
�getsizeris  rrCzResourceFinder.get_size�s���w���x�}�-�-�-rc�t����fd��t�fd�tj|j��D����S)Nc�F��|dko|��j��S)N�__pycache__)�endswith�skipped_extensions)r+rs �r�allowedz-ResourceFinder.get_resources.<locals>.allowed�s,�����&�8��J�J�t�6�7�7�,8�
9rc�*��g|]}�|���
|��Srr)�.0r+rys  �r�
<listcomp>z0ResourceFinder.get_resources.<locals>.<listcomp>�s&���G�G�G�!�G�G�A�J�J�G�A�G�G�Gr)�setr�listdirr
)rrrys` @rrJzResourceFinder.get_resources�sN����	9�	9�	9�	9�	9��G�G�G�G�r�z�(�-�8�8�G�G�G�H�H�Hrc�6�|�|j��Sr-)rkr
ris  rrFzResourceFinder.is_container�s���!�!�(�-�0�0�0rc#�TK�|�|��}|��|g}|r�|�d��}|V�|jrc|j}|jD]T}|s|}nd�||g��}|�|��}|jr|�|���P|V��U|��dSdSdS)Nrr^)rl�poprFr6rKr�append)rrbr�todo�rnamer6�new_name�childs        r�iteratorzResourceFinder.iterator�s������9�9�]�+�+�����:�D��
(��8�8�A�;�;�������(�(�$�M�E� (� 2�	(�	(��$�?�'+�H�H�'*�x�x���
�'>�'>�H� $�	�	�(� 3� 3�� �-�(� �K�K��.�.�.�.�"'�K�K�K�K��
(�
(�
(� ��
(�
(rN)r.r/r0rE�sys�platform�
startswithrxrr[rergrrlr:rArCrJrF�staticmethodrr
r"rkr�rrrrMrMvs���������|���v�&�&�.�7���-��E�E�E�
&�&�&�
)�
)�
)�$�$�$�#�#�#�
�
�
�)�)�)����.�.�.�I�I�I�1�1�1�!�L����/�/�M�(�(�(�(�(rrMc�R��eZdZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Z�xZ
S)�ZipResourceFinderz6
    Resource finder for resources in .zip files.
    c�L��tt|���|��|jj}dt|��z|_t|jd��r|jj|_ntj
||_t|j��|_dS)Nr�_files)
rr�rrW�archive�len�
prefix_len�hasattrr��	zipimport�_zip_directory_cache�sorted�index)rrUr�rs   �rrzZipResourceFinder.__init__�s����
���&�&�/�/��7�7�7��+�%���c�'�l�l�*����4�;��)�)�	B��+�,�D�K�K�#�8��A�D�K��D�K�(�(��
�
�
rc��|Sr-rrZs  rr[zZipResourceFinder._adjust_path�s���rc���||jd�}||jvrd}nu|r%|dtjkr|tjz}t	j|j|��}	|j|�|��}n#t$rd}YnwxYw|s't�	d||j
j��n&t�	d||j
j��|S)NT���Fz_find failed: %r %rz_find worked: %r %r)r�r�rrc�bisectr�r��
IndexError�logger�debugrWr()rr
r)�is    rrgzZipResourceFinder._find�s����D�O�$�$�%���4�;����F�F��
%��R��B�F�*�*��b�f�}���
�d�j�$�/�/�A�
���A��1�1�$�7�7�����
�
�
�����
�����	J��L�L�.��d�k�6H�I�I�I�I��L�L�.��d�k�6H�I�I�I��
s� A?�?B�
Bc�`�|jj}|jdt|��zd�}||fS)Nr)rWr�r
r�)rrr(r
s    rrz ZipResourceFinder.get_cache_info�s2����$���}�Q��V���_�-�-�.���t�|�rc�@�|j�|j��Sr-)rW�get_datar
ris  rrAzZipResourceFinder.get_bytes�s���{�#�#�H�M�2�2�2rc�P�tj|�|����Sr-)�io�BytesIOrAris  rr:zZipResourceFinder.get_stream�s���z�$�.�.��2�2�3�3�3rc�P�|j|jd�}|j|dS)N�)r
r�r�rs   rrCzZipResourceFinder.get_size�s(���}�T�_�-�-�.���{�4� ��#�#rc�2�|j|jd�}|r%|dtjkr|tjz
}t	|��}t��}t
j|j|��}|t	|j��kr�|j|�|��snk|j||d�}|�	|�
tjd��d��|dz
}|t	|j��k��|S)Nr�rr)r
r�rrcr�r}r�r�r��addr`)rrr
�plenr)r��ss       rrJzZipResourceFinder.get_resourcess����}�T�_�-�-�.���	�D��H���&�&��B�F�N�D��4�y�y�������M�$�*�d�+�+���#�d�j�/�/�!�!��:�a�=�+�+�D�1�1�
���
�1�
�d�e�e�$�A��J�J�q�w�w�r�v�q�)�)�!�,�-�-�-�
��F�A��#�d�j�/�/�!�!��
rc��||jd�}|r%|dtjkr|tjz
}tj|j|��}	|j|�|��}n#t$rd}YnwxYw|S)Nr�F)r�rrcr�r�r�r�)rr
r�r)s    rrkzZipResourceFinder._is_directorys����D�O�$�$�%���	�D��H���&�&��B�F�N�D��M�$�*�d�+�+��	��Z��]�-�-�d�3�3�F�F���	�	�	��F�F�F�	�����
s� A3�3B�B)r.r/r0rErr[rgrrAr:rCrJrkr1r2s@rr�r��s����������	)�	)�	)�	)�	)�������$���
3�3�3�4�4�4�$�$�$�
�
�
�	�	�	�	�	�	�	rr�c�4�|tt|��<dSr-)�_finder_registry�type)rW�finder_makers  r�register_finderr�2s��%1��T�&�\�\�"�"�"rc��|tvrt|}n�|tjvrt|��tj|}t	|dd��}|�td���t	|dd��}t�t|����}|�td|z���||��}|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 packagerRzUnable to locate finder for %r)	�
_finder_cacher��modules�
__import__rVrr�r,r�)�packager)rUr
rWr�s      rrr9s����-����w�'����#�+�%�%��w������W�%���v�z�4�0�0���<�"�$8�9�9�
9����t�4�4��'�+�+�D��L�L�9�9����"�#C�g�#M�N�N�N���f�%�%��!'�
�g���Mr�	__dummy__c�>�d}tj|��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.
    NrT)
�pkgutil�get_importerr��path_importer_cacher,r�r��
_dummy_modulerr
rrSrR)r
r)rWrrUs     r�finder_for_pathr�Us����F�������
�
$�
(�
(��
.�
.�F�
�
!�
!�$�v�,�,�
/�
/�F�
� ����'�,�,�t�R�0�0���"����������Mr)-�
__future__rr�r��loggingrr�r��typesr�rTr�utilrrr�	getLoggerr.r�r>r
�objectr4r8rHrMr�r��zipimporterr��_frozen_importlib_external�_fi�ImportError�_frozen_importlib�SourceFileLoader�
FileFinder�SourcelessFileLoader�AttributeErrorr�r�r�
ModuleTyperr�r�rrr�<module>r�s���(�'�'�'�'�'�
�
�
�
�	�	�	�	�����	�	�	�	�����
�
�
�
���������������8�8�8�8�8�8�8�8�8�8�	��	�8�	$�	$��	
��)�)�)�)�)�E�)�)�)�X�����6����*�*�*�*�*�|�*�*�*�B/�/�/�/�/��/�/�/�W(�W(�W(�W(�W(�V�W(�W(�W(�tK�K�K�K�K��K�K�K�^	�D��J�J��
��,���
	�(�0�0�0�0�0���(�(�(�'�'�'�'�'�'�(����-;��S�)�*�'5��S�^�$�1?��S�-�.�����^�$�	�	�	��D�	����2�2�2��
����2!�� ���[�!1�!1�2�2�
�����s0�3B8�7C'�8	C�C'�C�"C'�'C1�0C1

Zerion Mini Shell 1.0