HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/pip/_internal/utils/__pycache__/unpacking.cpython-310.pyc
o

��h�.�@s~dZddlmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddl	mZddl
mZddlmZmZmZmZddlmZe�e�ZeeZz
ddlZee7ZWneyie�d	�Ynwz
ddlZee7ZWney�e�d
�Ynwd7d
d�Zd8dd�Zd9dd�Z d:dd�Z!d7dd�Z"d;d d!�Z#d<d$d%�Z$d=d>d*d+�Z%d?d,d-�Z&d@d1d2�Z'	dAdBd5d6�Z(dS)CzUtilities related archives.�)�annotationsN)�Iterable)�ZipInfo)�InstallationError)�BZ2_EXTENSIONS�TAR_EXTENSIONS�
XZ_EXTENSIONS�ZIP_EXTENSIONS)�
ensure_dirzbz2 module is not availablezlzma module is not available�return�intcCst�d�}t�|�|S)zBGet the current umask which involves having to set it temporarily.r)�os�umask)�mask�r�H/usr/local/lib/python3.10/dist-packages/pip/_internal/utils/unpacking.py�
current_umask-s

r�path�str�	list[str]cCsd|�d��d�}d|vr$d|vr|�d�|�d�ksd|vr$|�dd�Sd|vr.|�dd�S|dgS)N�/�\��)�lstrip�find�split�rrrr�split_leading_dir4s$r�paths�
Iterable[str]�boolcCsDd}|D]}t|�\}}|sdS|dur|}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)r�
common_prefixr�prefix�restrrr�has_leading_dir@s�r%�	directory�targetcCs0tj�|�}tj�|�}tj�||g�}||kS)zL
    Return true if the absolute path of target is within the directory
    )r
r�abspath�commonprefix)r&r'�
abs_directory�
abs_targetr#rrr�is_within_directoryOsr,cCsdt�@dBS)Ni��I)rrrrr�!_get_default_mode_plus_executableZsr.�NonecCst�|t��dS)zx
    Make file present at path have execute for user/group/world
    (chmod +x) is no-op on windows per python docs
    N)r
�chmodr.rrrr�2set_extracted_file_to_default_mode_plus_executable^sr1�inforcCs$|jd?}t|ot�|�o|d@�S)N�r-)�
external_attrr!�stat�S_ISREG)r2�moderrr�zip_item_is_executablefs
r8T�filename�location�flattenc
	Cs@t|�t|d�}z�tj|dd�}t|���o|}|��D]v}|j}|}|r,t|�d}t	j
�||�}t	j
�|�}	t
||�sId}
t|
�|||���|�d�rSt|�qt|	�|�|�}z)t|d��}t�||�Wd�n1sswYW|��t|�r�t|�q|��t|�r�t|�wwW|��dS|��w)	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�infolistr9rr
r�join�dirnamer,r�format�endswith�shutil�copyfileobj�closer8r1)
r9r:r;�zipfp�zip�leadingr2�name�fn�dir�message�fp�destfprrr�
unzip_filemsF	

�


����
��rTcsbt������d�s����d�rd}n&����t�rd}n����t�r)d}n����d�r3d}nt�d��d	}tj�|d
d�}zht	dd
�|�
�D��}ztj�Wntydt
��||�YnAwt��|r�|�
�D]}t|j�\}}||_|��r�t|j�\}}	||kr�|	|_qnd����fdd�}
|j�|
d�W|��dSW|��dS|��w)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)�encodingcSsg|]}|j�qSr)rN)�.0�memberrrr�
<listcomp>�szuntar_file.<locals>.<listcomp>rX�tarfile.TarInforrrc
s�|j}z%z�|��}Wntjy&tjdd�dvr#t�|��}n�YnwWntjy?}z
d}t|��|���d}~ww|�	�rM|d@rM�|_|Sd|_|S)N�>�r[�	��r[�
��r[��z%Invalid member in the tar file {}: {}r-)
r7�tarfile�LinkOutsideDestinationError�sys�version_info�
tar_filter�TarErrorrrF�isfile)rXr�	orig_mode�excrQ��data_filter�default_mode_plus_executabler9r:rr�
pip_filter�s4
�������
�zuntar_file.<locals>.pip_filter)�filterN)rXrZrrrrZ)r
�lowerrGrr�logger�warningrer?r%�
getmembersro�AttributeError�_untar_without_filterr.rrN�islnk�linkname�
extractallrJ)r9r:r7�tarrMrX�	name_lead�	name_rest�lnk_lead�lnk_restrqrrnr�
untar_file�sJ	�
��'�:r�r|�tarfile.TarFilerMcCsz|��D]�}|j}|rt|�d}tj�||�}t||�s(d}t|�|||���|�	�r1t
|�q|��rYz|�||�Wqt
yX}zt�d||j|�WYd}~qd}~wwz|�|�}	Wnttfy}}zt�d||j|�WYd}~qd}~wwt
tj�|��|	dus�J�t|d��}
t�|	|
�Wd�n1s�wY|	��|�||�|jd@r�t|�qdS)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: %sNr>r-)rvrNrr
rrDr,rrF�isdirr
�issym�_extract_member�	Exceptionrtru�extractfile�KeyErrorrwrEr?rHrIrJ�utimer7r1)r9r:r|rMrXrOrrQrmrRrSrrrrx�s^
�
������
�
��rx�content_type�
str | NonecCs�tj�|�}|dks|���t�st�|�r#t|||�d�d�dS|dks7t	�
|�s7|���ttt
�r>t||�dSt�d|||�td|����)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 )r
r�realpathrsrGr	r@�
is_zipfilerTre�
is_tarfilerrrr�rt�criticalr)r9r:r�rrr�unpack_file5s(�����r�)rr)rrrr)rr rr!)r&rr'rrr!)rrrr/)r2rrr!)T)r9rr:rr;r!rr/)r9rr:rrr/)
r9rr:rr|r�rMr!rr/)N)r9rr:rr�r�rr/))�__doc__�
__future__r�loggingr
rHr5rgrer@�collections.abcrr�pip._internal.exceptionsr�pip._internal.utils.filetypesrrrr	�pip._internal.utils.miscr
�	getLogger�__name__rt�SUPPORTED_EXTENSIONS�bz2�ImportError�debug�lzmarrr%r,r.r1r8rTr�rxr�rrrr�<module>sP
��







.
`=�