HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc
a

?�f&�@spdZddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
mZmZddlmZddlmZer�ddlmZmZmZmZmZdd	lmZe�e�Zee
ZzddlZee7ZWne y�e�!d
�Yn0zddl"Z"ee7ZWne �ye�!d�Yn0dd
�Z#dd�Z$dd�Z%dd�Z&dd�Z'dd�Z(ddd�Z)dd�Z*d dd�Z+dS)!zUtilities related archives.
�)�absolute_importN)�InstallationError)�BZ2_EXTENSIONS�TAR_EXTENSIONS�
XZ_EXTENSIONS�ZIP_EXTENSIONS)�
ensure_dir)�MYPY_CHECK_RUNNING)�Iterable�List�Optional�Text�Union)�ZipInfozbz2 module is not availablezlzma module is not availablecCst�d�}t�|�|S)zBGet the current umask which involves having to set it temporarily.r)�os�umask)�mask�r�A/usr/lib/python3.9/site-packages/pip/_internal/utils/unpacking.py�
current_umask/s

rcCsh|�d��d�}d|vrHd|vr4|�d�|�d�ks<d|vrH|�dd�Sd|vr\|�dd�S|dgSdS)N�/�\��)�lstrip�find�split��pathrrr�split_leading_dir7s����rcCsDd}|D]6}t|�\}}|s"dS|dur0|}q||krdSqdS)zyReturns true if all the paths have the same leading path name
    (i.e., everything is in one subdirectory in an archive)NFT)r)�pathsZ
common_prefixr�prefix�restrrr�has_leading_dirGsr#cCs0tj�|�}tj�|�}tj�||g�}||kS)zL
    Return true if the absolute path of target is within the directory
    )rr�abspath�commonprefix)Z	directory�targetZ
abs_directoryZ
abs_targetr!rrr�is_within_directoryWsr'cCst�|dt�@dB�dS)zx
    Make file present at path have execute for user/group/world
    (chmod +x) is no-op on windows per python docs
    i��IN)r�chmodrrrrr�2set_extracted_file_to_default_mode_plus_executablecsr*cCs$|jd?}t|o t�|�o |d@�S)N�r()Z
external_attr�bool�stat�S_ISREG)�info�moderrr�zip_item_is_executablels
r1Tc
	CsRt|�t|d�}�z.tj|dd�}t|���o2|}|��D]�}|j}|}|rZt|�d}t	j
�||�}t	j
�|�}	t
||�s�d}
t|
�|||���|�d�s�|�d�r�t|�q<t|	�|�|�}zTt|d��}t�||�Wd	�n1s�0YW|��t|��r6t|�q<|��t|��r4t|�0q<W|��n
|��0d	S)
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)Z
allowZip64rzQThe zip file ({}) has a file ({}) trying to install outside target directory ({})rr�wbN)r�open�zipfileZZipFiler#ZnamelistZinfolist�filenamerrr�join�dirnamer'r�format�endswith�shutil�copyfileobj�closer1r*)
r6�location�flattenZzipfp�zip�leadingr/�name�fn�dir�message�fp�destfprrr�
unzip_filets<


�

,

�
rHcCs�t|�|���d�s$|���d�r*d}nL|���t�r>d}n8|���t�rRd}n$|���d�rfd}nt�d|�d	}t�||�}�z�t	d
d�|�
�D��}|�
�D�]�}|j}|r�t|�d}t
j�||�}t||�s�d
}t|�|||���zt�|j|d�|�Wntj�yYn0|���r2t|�q�|���r�z|�||�WnDt�y�}	z*t�d||j|	�WYd}	~	q�WYd}	~	n
d}	~	00q�z|�|�}
WnHttf�y�}	z*t�d||j|	�WYd}	~	q�WYd}	~	n
d}	~	00tt
j�|��|
du�s
J�t|d��}t�|
|�Wd�n1�s80Y|
� �|�!||�|j"d@r�t#|�q�W|� �n
|� �0dS)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 after being
    written.  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:*cSsg|]
}|j�qSr�rB)�.0�memberrrr�
<listcomp>�szuntar_file.<locals>.<listcomp>rzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})rJz/In the tar file %s the member %s is invalid: %sNr3r()$r�lowerr:rr�loggerZwarning�tarfiler4r#Z
getmembersrBrrrr7r'rr9Zdata_filter�replaceZLinkOutsideDestinationError�isdirZissymZ_extract_member�	ExceptionZextractfile�KeyError�AttributeErrorr8r;r<r=�utimer0r*)r6r>r0ZtarrArLrCrrE�excrFrGrrr�
untar_file�sz
��
��


�$�",
rXcCs�tj�|�}|dks,|���t�s,t�|�rDt|||�d�d�nR|dkslt	�
|�sl|���ttt
�rxt||�nt�d|||�td�|���dS)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�realpathrNr:rr5Z
is_zipfilerHrPZ
is_tarfilerrrrXrOZcriticalrr9)r6r>Zcontent_typerrr�unpack_file�s8���
���
����rZ)T)N),�__doc__Z
__future__rZloggingrr;r-rPr5Zpip._internal.exceptionsrZpip._internal.utils.filetypesrrrrZpip._internal.utils.miscrZpip._internal.utils.typingr	�typingr
rrr
rrZ	getLogger�__name__rOZSUPPORTED_EXTENSIONS�bz2�ImportError�debugZlzmarrr#r'r*r1rHrXrZrrrr�<module>sH
	
/]�