a �DOg�3� @s�gd�ZddlZddlZddlZddlTddlmZmZddlZdZdZ dZ Gdd�dej �Z ddd dddddd �d d �Z ed ddfdd�Zeddfdd�ZdS))$� CHECK_NONE� CHECK_CRC32� CHECK_CRC64� CHECK_SHA256� CHECK_ID_MAX� CHECK_UNKNOWN� FILTER_LZMA1� FILTER_LZMA2� FILTER_DELTA� FILTER_X86� FILTER_IA64� FILTER_ARM�FILTER_ARMTHUMB�FILTER_POWERPC� FILTER_SPARC� FORMAT_AUTO� FORMAT_XZ� FORMAT_ALONE� FORMAT_RAW�MF_HC3�MF_HC4�MF_BT2�MF_BT3�MF_BT4� MODE_FAST� MODE_NORMAL�PRESET_DEFAULT�PRESET_EXTREME�LZMACompressor�LZMADecompressor�LZMAFile� LZMAError�open�compress� decompress�is_check_supported�N)�*)�_encode_filter_properties�_decode_filter_properties��c@s�eZdZd!ddddd�dd�Zdd�Zed d ��Zd d �Zd d�Zdd�Z dd�Z d"dd�Z d#dd�Z d$dd�Z d%dd�Zdd�Zejfdd�Zdd �ZdS)&rN�r�������format�check�preset�filtersc Cs&d|_d|_t|_|dvrL|dkr*td��|dur:td��|durFt}t}n@|dvr~|dur`t}t}t ||||d�|_ d|_ ntd � |���t |tttjf�r�d |vr�|d 7}t�||�|_d |_||_n*t|d �s�t|d �r�||_||_ntd��|jtk�r"tj|jtt||d�}t�|�|_dS)NF)r+�rbr,zACannot specify an integrity check when opening a file for readingzICannot specify a preset compression level when opening a file for reading)�w�wb�a�ab�x�xbr-r%zInvalid mode: {!r}�bT�read�writez6filename must be a str, bytes, file or PathLike object)�trailing_errorr.r1)�_fp�_closefp� _MODE_CLOSED�_mode� ValueErrorr� _MODE_READr� _MODE_WRITEr� _compressor�_posr.� isinstance�str�bytes�os�PathLike�builtinsr!�hasattr� TypeError� _compression�DecompressReaderrr �io�BufferedReader�_buffer) �self�filename�moder.r/r0r1� mode_code�raw�rX�/usr/lib64/python3.9/lzma.py�__init__1sF,�  �zLZMAFile.__init__cCs�|jtkrdSz~|jtkr,|j��d|_n"|jtkrN|j�|j� ��d|_Wz&|j rb|j��Wd|_d|_ t|_q�d|_d|_ t|_0n>z&|j r�|j��Wd|_d|_ t|_nd|_d|_ t|_00dS)NF) r@r?rBrR�closerCr=r;rD�flushr>�rSrXrXrYr[�s6     � � �zLZMAFile.closecCs |jtkS�N)r@r?r]rXrXrY�closed�szLZMAFile.closedcCs|��|j��Sr^)�_check_not_closedr=�filenor]rXrXrYra�szLZMAFile.filenocCs|��o|j��Sr^)�readablerR�seekabler]rXrXrYrc�szLZMAFile.seekablecCs|��|jtkSr^)r`r@rBr]rXrXrYrb�szLZMAFile.readablecCs|��|jtkSr^)r`r@rCr]rXrXrY�writable�szLZMAFile.writablecCs|��|j�|�Sr^)�_check_can_readrR�peek�rS�sizerXrXrYrf�sz LZMAFile.peekcCs|��|j�|�Sr^)rerRr:rgrXrXrYr:�sz LZMAFile.readcCs"|��|dkrtj}|j�|�S)Nr%)rerP�DEFAULT_BUFFER_SIZErR�read1rgrXrXrYrj�szLZMAFile.read1cCs|��|j�|�Sr^)rerR�readlinergrXrXrYrk�szLZMAFile.readlinecCsX|��t|ttf�r t|�}nt|�}|j}|j�|�}|j � |�|j |7_ |Sr^) �_check_can_writerFrH� bytearray�len� memoryview�nbytesrDr"r=r;rE)rS�data�length� compressedrXrXrYr;�s   zLZMAFile.writecCs|��|j�||�Sr^)�_check_can_seekrR�seek)rS�offset�whencerXrXrYru�sz LZMAFile.seekcCs"|��|jtkr|j��S|jSr^)r`r@rBrR�tellrEr]rXrXrYrxs  z LZMAFile.tell)Nr+)r,)r,)r,)r,)�__name__� __module__� __qualname__rZr[�propertyr_rarcrbrdrfr:rjrkr;rP�SEEK_SETrurxrXrXrXrYr&s" � U  rr2r,)r.r/r0r1�encoding�errors�newlinec Cs�d|vr d|vrPtd|f��n0|dur0td��|dur@td��|durPtd��|�dd�} t|| ||||d�} d|vr�t�| |||�S| SdS) N�tr9zInvalid mode: %rz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode�r-)rA�replacerrP� TextIOWrapper) rTrUr.r/r0r1r~rr��lz_mode� binary_filerXrXrYr!s   �r!cCs t||||�}|�|�|��Sr^)rr"r\)rqr.r/r0r1�comprXrXrYr">sr"cCsng}t|||�}z|�|�}Wnty<|r6Yqdn�Yn0|�|�|jsVtd��|j}|sqdqd�|�S)NzACompressed data ended before the end-of-stream marker was reached�)rr#r �append�eof� unused_data�join)rqr.�memlimitr1�results�decomp�resrXrXrYr#Js   r#)r2)�__all__rKrPrI�_lzmar'r(rNr?rBrC� BaseStreamrr!rr"rr#rXrXrXrY� s" j� /