Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pip/_internal/utils/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-312.pyc

�

4Μg�.�
�N�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZddlmZddl
mZddlmZmZmZmZddlmZej,e�ZeezZ	ddlZeez
Z	ddlZeez
Zd
efd�Zde d
e
e fd
�Z!de	e d
e"fd�Z#de de d
e"fd�Z$d
efd�Z%de d
dfd�Z&ded
e"fd�Z'd!de de de"d
dfd�Z(de de d
dfd�Z)de de dejTde"d
df
d�Z+	d"de de dee d
dfd �Z,y#e$rej9d�Y��wxYw#e$rej9d	�Y��wxYw)#zUtilities related archives.
�N)�Iterable�List�Optional)�ZipInfo)�InstallationError)�BZ2_EXTENSIONS�TAR_EXTENSIONS�
XZ_EXTENSIONS�ZIP_EXTENSIONS)�
ensure_dirzbz2 module is not availablezlzma module is not available�returnc�Z�tjd�}tj|�|S)zBGet the current umask which involves having to set it temporarily.r)�os�umask)�masks �H/usr/local/lib/python3.12/site-packages/pip/_internal/utils/unpacking.py�
current_umaskr,s��
�8�8�A�;�D��H�H�T�N��K��pathc��|jd�jd�}d|vr=d|vr#|jd�|jd�ksd|vr|jdd�Sd|vr|jdd�S|dgS)N�/�\��)�lstrip�find�split�rs r�split_leading_dirr3sz���;�;�s��"�"�4�(�D�
�d�{�	
���$�)�)�C�.�4�9�9�T�?�:�t�4�?O��z�z�#�q�!�!�	
����z�z�$��"�"��b�z�r�pathsc�R�d}|D] }t|�\}}|sy|�|}�||k7s� yy)zyReturns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)NFT)r)r �
common_prefixr�prefix�rests     r�has_leading_dirr%?sB���M���(��.������
�
"�"�M�
�}�
$���r�	directory�targetc���tjj|�}tjj|�}tjj||g�}||k(S)zL
    Return true if the absolute path of target is within the directory
    )rr�abspath�commonprefix)r&r'�
abs_directory�
abs_targetr#s     r�is_within_directoryr-NsL���G�G�O�O�I�.�M�������(�J�
�W�W�
!�
!�=�*�"=�
>�F��]�"�"rc�$�dt�zdzS)Ni��I)r�rr�!_get_default_mode_plus_executabler1Ys���M�O�#�#�e�+�+rc�@�tj|t��y)zx
    Make file present at path have execute for user/group/world
    (chmod +x) is no-op on windows per python docs
    N)r�chmodr1rs r�2set_extracted_file_to_default_mode_plus_executabler4]s��
�H�H�T�4�6�7r�infoc�r�|jdz	}t|xrtj|�xr|dz�S)N�r/)�
external_attr�bool�stat�S_ISREG)r5�modes  r�zip_item_is_executabler=es6������#�D���<����d�+�<��u��=�=r�filename�location�flattenc���t|�t|d�}	tj|d��}t	|j��xr|}|j
�D�](}|j}|}|rt|�d}tjj||�}tjj|�}	t||�sd}
t|
j|||���|j!d�s|j!d�rt|���t|	�|j|�}	t|d�5}t#j$||�d	d	d	�|j'�t)|�s��t+|���+	|j'�y	#1swY�FxYw#|j'�t)|�rt+|�wwxYw#|j'�wxYw)
a�
    Unzip the file (with path `filename`) to the destination `location`.  All
    files are written based on system defaults and umask (i.e. permissions are
    not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied after being
    written. Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    �rbT)�
allowZip64rzQThe zip file ({}) has a file ({}) trying to install outside target directory ({})rr�wbN)r�open�zipfile�ZipFiler%�namelist�infolistr>rrr�join�dirnamer-r�format�endswith�shutil�copyfileobj�closer=r4)
r>r?r@�zipfp�zip�leadingr5�name�fn�dir�message�fp�destfps
             r�
unzip_filerZls{���x����4� �E� ��o�o�e��5��!�#�,�,�.�1�=�g���L�L�N�D��=�=�D��B��&�t�,�Q�/�������h��+�B��'�'�/�/�"�%�C�&�x��4�4��(����x��X�(N�O�O��{�{�3��2�;�;�t�#4��2���3���X�X�d�^��O��b�$��6��*�*�2�v�6�(��H�H�J�-�d�3�J�2�N�7#�:	���
�(����H�H�J�-�d�3�J�2�N�4��	���
�sB�DG�3F'�?F�F'�G�;G�F$	� F'�')G�G�G%c�d�����t���j�jd�s�j�jd�rd}n��j�jt�rd}n`�j�jt�rd}n:�j�jd�rd}nt
j
d��d	}tj�|d
��}	t|j�D�cgc]}|j��c}�}	tj�t��|rj|j�D]W}t|j�\}}||_|j�s�3t|j �\}}	||k(s�Q|	|_�Ydtj"d
t$dtj"f����fd�}
|j'�|
��|j-�ycc}w#t($rt+��||�Y�/wxYw#|j-�wxYw)a�
    Untar the file (with path `filename`) to the destination `location`.
    All files are written based on system defaults and umask (i.e. permissions
    are not preserved), except that regular file members with any execute
    permissions (user, group, or world) have "chmod +x" applied on top of the
    default.  Note that for windows, any execute changes using os.chmod are
    no-ops per the python docs.
    z.gzz.tgzzr:gzzr:bz2zr:xzz.tar�rz-Cannot determine compression type for file %szr:*zutf-8)�encoding�memberrr
c�|��|j}		�|��}|j�r|dzr	�|_|Sd|_|S#tj$r0tjdddvrtj
|��}n�Y�iwxYw#tj$r"}d}t|j�|���d}~wwxYw)N�>�r`���r`�	rc�r`�
��r`��z%Invalid member in the tar file {}: {}r/)
r<�tarfile�LinkOutsideDestinationError�sys�version_info�
tar_filter�TarErrorrrL�isfile)	r^r�	orig_mode�excrW�data_filter�default_mode_plus_executabler>r?s	     ����r�
pip_filterzuntar_file.<locals>.pip_filter�s����"�K�K�	��"�!,�V�X�!>��4�=�=�?�y�5�'8�">�F�K��
�#'�F�K��
��C#�>�>�"��+�+�B�Q�/�4��&-�%7�%7���%I�F�!�#�"���'�'�	�E�G�,����$������		�s0�	A�AB�B�B�B�B;�B6�6B;)�filterN)r�lowerrMrr
�logger�warningrlrEr%�
getmembersrTrur1r�islnk�linkname�TarInfo�str�
extractall�AttributeError�_untar_without_filterrP)
r>r?r<�tarr^rS�	name_lead�	name_rest�lnk_lead�lnk_restrwrurvs
``         @@r�
untar_filer��s�����x���~�~�� � ��'�8�>�>�+;�+D�+D�V�+L���	���	�	"�	"�>�	2���	���	�	"�	"�=�	1���	���	�	"�	"�6�	*������;��	
���
�,�,�x���
8�C�D�!�S�^�^�=M�"N�=M�6�6�;�;�=M�"N�O��
;	8�!�-�-�K�,M�+N�(��"�n�n�.�F�+<�V�[�[�+I�(�I�y�"+�F�K��|�|�~�->�v���-O�*��(�#�y�0�.6�F�O�
/�&
�7�?�?�&
�#�&
�'�/�/�&
�&
�P
�N�N�8�J�N�7�	�	�	���G#O���	D�!�(�H�c�7�C�	D��x	�	�	��sP�0H�G;�H�"H�2AH�H�AH�;H�H�H�H�H�H/r�rSc���|j�D�]P}|j}|rt|�d}tjj||�}t
||�sd}t|j|||���|j�rt|���|j�r	|j||���	|j!|�}	ttjj'|��|	�J�t)|d�5}
t+j,|	|
�ddd�|	j/�|j1||�|j2dzs��Ft5|���Sy#t$r-}tjd||j|�Yd}~���d}~wwxYw#t"t$f$r-}tjd||j|�Yd}~���d}~wwxYw#1swY��xYw)z/Fallback for Python without tarfile.data_filterrzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNrDr/)r|rTrrrrJr-rrL�isdirr�issym�_extract_member�	Exceptionrzr{�extractfile�KeyErrorr�rKrErNrOrP�utimer<r4)r>r?r�rSr^rUrrWrtrXrYs           rr�r��s����.�.�"��
�[�[���"�2�&�q�)�B��w�w�|�|�H�b�)��"�8�T�2�0�
�$�G�N�N�8�T�8�$L�M�M��<�<�>��t��
�\�\�^�
��#�#�F�D�1�
��_�_�V�,��
�r�w�w���t�,�-��>�!�>��d�D�!�V��"�"�2�v�.�"��H�H�J��I�I�f�d�#��{�{�U�"�B�4�H�a#�� �	
����E���K�K��	���	
���n�-�	
����E���K�K��	���	
��"�!�s<�(E&�<F�G�&	F�/"F�F�G�."G�G�G'	�content_typec���tjj|�}|dk(s8|j�j	t
�st
j|�rt|||j	d���y|dk(sFtj|�s1|j�j	ttztz�r
t||�ytj!d|||�t#d|����)Nzapplication/zipz.whl)r@zapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz#Cannot determine archive format of )rr�realpathryrMrrF�
is_zipfilerZrl�
is_tarfiler	rr
r�rz�criticalr)r>r?r�s   r�unpack_filer�5s���
�w�w����)�H��)�)��>�>��$�$�^�4����h�'��8�X�8�3D�3D�V�3L�/L�M��,�,����h�'��>�>��$�$�^�n�%D�}�%T�U��8�X�&�	���
+����	
� �"E�h�Z� P�Q�Qr)T)N)-�__doc__�loggingrrNr:rnrlrF�typingrrrr�pip._internal.exceptionsr�pip._internal.utils.filetypesrr	r
r�pip._internal.utils.miscr�	getLogger�__name__rz�SUPPORTED_EXTENSIONS�bz2�ImportError�debug�lzma�intrr�rr9r%r-r1r4r=rZr��TarFiler�r�r0rr�<module>r�s�����	�
��
���+�+��6���0�	��	�	�8�	$��&��6��0���N�*��1���M�)��
�s��	�C�	�D��I�	��8�C�=��T��#�3�#��#��#�,�3�,�8�S�8�T�8�>��>�T�>�+��+��+�d�+�d�+�\^��^��^��^�B7I��7I��7I�
���7I��	7I�

�7I�z#'�R��R��R��3�-�R�
�	R��k�0�
�L�L�.�/�0���1�
�L�L�/�0�1�s$�	C/�)	D�/D�D�D$�#D$

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists