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: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/wheel/__pycache__/wheelfile.cpython-310.pyc
o

��h� �@sddlmZddlZddlZddlZddlZddlZddlZddl	m
Z
mZddlm
Z
mZmZddlmZmZmZddlmZddlmZmZmZeroddlmZmZmZdd	lmZeeej efZ!Gd
d�deee�Z"e�#dej$�Z%d
Z&dddd�Z'Gdd�de�Z(dS)�)�annotationsN)�StringIO�
TextIOWrapper)�IO�
TYPE_CHECKING�Literal)�ZIP_DEFLATED�ZipFile�ZipInfo)�
WheelError)�log�urlsafe_b64decode�urlsafe_b64encode)�Protocol�Sized�Union)�Bufferc@seZdZdS)�SizedBufferN)�__name__�
__module__�__qualname__�rr�:/usr/local/lib/python3.10/dist-packages/wheel/wheelfile.pyrsrz�^(?P<namever>(?P<name>[^\s-]+?)-(?P<ver>[^\s-]+?))(-(?P<build>\d[^\s-]*))?
     -(?P<pyver>[^\s-]+?)-(?P<abi>[^\s-]+?)-(?P<plat>\S+)\.whl$i���	timestamp�float | NonecCs6ttj�d|p
t����}t|t�}t�|�dd�S)N�SOURCE_DATE_EPOCHr�)�int�os�environ�get�time�max�MINIMUM_TIMESTAMP�gmtime)rrrr�get_zipinfo_datetime$s
r%c@sfeZdZdZejZdefd(d	d
�Z		d)d*dd�Z	d+dd�Z
		d,d-dd �Z	d.d/d$d%�Zd&d'�Z
dS)0�	WheelFilez�A ZipFile derivative class that also reads SHA-256 hashes from
    .dist-info/RECORD and checks any read files against those.
    �r�file�StrPath�mode�Literal['r', 'w', 'x', 'a']�compressionrc
Cs�tj�|�}t�|�|_|�d�r|jdurtd|����tj	||||dd�d�
|j�d��|_|jd|_
i|_i|_|dkr�d	|j|j
<d	|j|j
d
<d	|j|j
d<z|�|j
�}Wntyptd|j
�d
��d�w|�Vt�t|ddd��D]B}|\}}}	|s�q~|�d�\}
}zt�|
�Wnty�td|
���d�w|
��dvr�td|
�d���|
t|�d��f|j|<q~Wd�dS1s�wYdSdS)Nz.whlzBad wheel filename T)r,�
allowZip64z{}.dist-info�nameverz/RECORDr'�NNz.jwsz.p7szMissing z file��utf-8)�newline�encoding�=zUnsupported hash algorithm: >�md5�sha1zWeak hash algorithm (z) is not permitted by PEP 427�ascii)r�path�basename�
WHEEL_INFO_RE�match�parsed_filename�endswithrr	�__init__�format�group�dist_info_path�record_path�_file_hashes�_file_sizes�open�KeyError�csv�readerr�split�hashlib�new�
ValueError�lowerr
�encode)�selfr(r*r,r9�record�liner8�hash_sum�size�	algorithmrrrr>3s^
���
���
���"��zWheelFile.__init__N�name_or_info�
str | ZipInfo�Literal['r', 'w']�pwd�bytes | None�return�	IO[bytes]cs�d�����fdd�}t|t�r|jn|�|dkr+��d�s+�|jvr+td	��d
���t�||||��|dkrS��d�sS|j�\}��durSt�	|���j
|��_
�S)N�newdata�bytesrZ�Nonecs@�j}�|���|�|r����krtd��d���dSdS)NzHash mismatch for file '�')�_eof�update�digestr)r\�eof��ef�ef_name�
expected_hash�running_hash�update_crc_origrr�_update_crcss
�z#WheelFile.open.<locals>._update_crcr'�/zNo hash found for file 'r_)r\r]rZr^)�
isinstancer
�filenamer=rCrr	rErJrKrj)rOrUr*rXrjrTrrdrrEms��

zWheelFile.open�base_dir�strc	Cs�t�d|j�d|�d��g}t�|�D]G\}}}|��t|�D]9}tj�tj�	||��}tj�
|�rZtj�||��tjj
d�}||jkrGq!|�d�rT|�||f�q!|�||�q!q|��|D]
\}}|�||�qbdS)Nz
creating 'z' and adding 'z' to itrkz
.dist-info)r�informr�walk�sort�sortedr8�normpath�join�isfile�relpath�replace�seprBr=�append�write)	rOrn�deferred�root�dirnames�	filenames�namer8�arcnamerrr�write_files�s&

���zWheelFile.write_filesrmr��
str | None�
compress_type�
int | Noner^cCs�t|d��}t�|���}|��}Wd�n1swYt|p$|t|j�d�}t�	|j
�t�|j
�Bd>|_|p>|j
|_|�|||�dS)N�rb��	date_time�)rEr�fstat�fileno�readr
r%�st_mtime�stat�S_IMODE�st_mode�S_IFMT�
external_attrr,r��writestr)rOrmr�r��f�st�data�zinforrrr{�s
��zWheelFile.write�zinfo_or_arcnamer��SizedBuffer | strcCs�t|t�rt|t�d�}|j|_dtjBd>|_t|t�r"|�	d�}t
�||||�t|t�r2|jn|}t
�d|�d��||jkr_|�|�}|jt|����d�f|j|<t|�|j|<dSdS)Nr�i�r�r1zadding 'r_r7)rlror
r%r,r�r��S_IFREGr�rNr	r�rmrrprB�_default_algorithmr�rrb�decoderC�lenrD)rOr�r�r��fname�hash_rrrr��s*
�

��


��zWheelFile.writestrcs��jdur<�jdkr<�jr<t�}tj|dddd�}|��fdd��j��D��|�t	�j
�ddf����j
|���t
���dS)	N�w�,�"�
)�	delimiter�	quotechar�lineterminatorc3s0�|]\}\}}||d|�j|fVqdS)r4N)rD)�.0r�rTr��rOrr�	<genexpr>�s
�
�
�z"WheelFile.close.<locals>.<genexpr>r0)�fpr*rCrrG�writer�	writerows�items�writerowr?rBr��getvaluer	�close)rOr�r�rr�rr��s
��zWheelFile.close)r(r)r*r+r,r)r'N)rUrVr*rWrXrYrZr[)rnror/)rmror�r�r�r�rZr^�N)r�rVr�r�r�r�)rrr�__doc__rJ�sha256r�rr>rEr�r{r�r�rrrrr&,s �=�
"��r&r�)rr))�
__future__rrGrJ�os.pathr�rer�r!�iorr�typingrrr�zipfilerr	r
�	wheel.clir�
wheel.utilrr
rrrr�typing_extensionsrro�PathLiker)r�compile�VERBOSEr:r#r%r&rrrr�<module>s0�