Your IP : 3.135.247.24


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/bz2.cpython-39.opt-2.pyc

a

R�f�0�@s�gd�ZdZddlmZddlZddlZddlZddlm	Z	ddl
mZmZdZ
dZdZGd	d
�d
ej�Zdd
d�Zddd�Zdd�ZdS))�BZ2File�
BZ2Compressor�BZ2Decompressor�open�compress�
decompressz%Nadeem Vawda <nadeem.vawda@gmail.com>�)rN)�RLock)rr��c@s�eZdZd)dd�dd�Zdd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
d*dd�Zd+dd�Zd,dd�Z
dd�Zd-dd�Zd.dd�Zd d!�Zd"d#�Zejfd$d%�Zd&d'�Zd(S)/r�r�	��
compresslevelcCs8t�|_d|_d|_t|_d|kr.dks8ntd��|dvrJd}t}nb|dvrfd}t}t	|�|_
nF|d	vr�d
}t}t	|�|_
n*|dvr�d}t}t	|�|_
ntd
|f��t|tt
tjf�r�t||�|_d|_||_n*t|d�s�t|d�r�||_||_ntd��|jtk�r.tj|jttd�}t�|�|_nd|_dS)NFr	rz%compresslevel must be between 1 and 9)�r�rbr)�w�wbr)�x�xbr)�a�abr�Invalid mode: %rT�read�writez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorr)r�_lock�_fp�_closefp�_MODE_CLOSED�_mode�
ValueError�
_MODE_READ�_MODE_WRITEr�_compressor�
isinstance�str�bytes�os�PathLike�
_builtin_open�hasattr�	TypeError�_compressionZDecompressReaderr�OSError�io�BufferedReader�_buffer�_pos)�self�filename�moderZ	mode_code�raw�r5�(/opt/alt/python39/lib64/python3.9/bz2.py�__init__&sH�zBZ2File.__init__cCs|j��|jtkr"Wd�dSz�|jtkr:|j��n"|jtkr\|j�|j	�
��d|_	Wz,|jrp|j��Wd|_d|_t|_d|_q�d|_d|_t|_d|_0nJz,|jr�|j��Wd|_d|_t|_d|_nd|_d|_t|_d|_00Wd�n1�s0YdS)NF)rrrr r/�closer!rrr"�flushr�r1r5r5r6r8es>


�
��z
BZ2File.closecCs
|jtkS�N)rrr:r5r5r6�closed~szBZ2File.closedcCs|��|j��Sr;)�_check_not_closedr�filenor:r5r5r6r>�szBZ2File.filenocCs|��o|j��Sr;)�readabler/�seekabler:r5r5r6r@�szBZ2File.seekablecCs|��|jtkSr;)r=rr r:r5r5r6r?�szBZ2File.readablecCs|��|jtkSr;)r=rr!r:r5r5r6�writable�szBZ2File.writablercCs>|j�$|��|j�|�Wd�S1s00YdSr;)r�_check_can_readr/�peek)r1�nr5r5r6rC�szBZ2File.peek���cCs>|j�$|��|j�|�Wd�S1s00YdSr;)rrBr/r�r1�sizer5r5r6r�szBZ2File.readcCsL|j�2|��|dkrtj}|j�|�Wd�S1s>0YdS)Nr)rrBr-�DEFAULT_BUFFER_SIZEr/�read1rFr5r5r6rI�s
z
BZ2File.read1cCs>|j�$|��|j�|�Wd�S1s00YdSr;)rrBr/�readinto)r1�br5r5r6rJ�szBZ2File.readintocCsbt|t�s$t|d�std��|��}|j�$|��|j�|�Wd�S1sT0YdS�N�	__index__zInteger argument expected)	r#�intr)r*rMrrBr/�readlinerFr5r5r6rO�s

zBZ2File.readlinecCsbt|t�s$t|d�std��|��}|j�$|��|j�|�Wd�S1sT0YdSrL)	r#rNr)r*rMrrBr/�	readlinesrFr5r5r6rP�s

zBZ2File.readlinescCs�|j�h|��t|ttf�r(t|�}nt|�}|j}|j�	|�}|j
�|�|j|7_|Wd�S1st0YdSr;)
rZ_check_can_writer#r%�	bytearray�len�
memoryview�nbytesr"rrrr0)r1�dataZlengthZ
compressedr5r5r6r�s
z
BZ2File.writecCs8|j�tj�||�Wd�S1s*0YdSr;)rr+�
BaseStream�
writelines)r1�seqr5r5r6rW�szBZ2File.writelinescCs@|j�&|��|j�||�Wd�S1s20YdSr;)rZ_check_can_seekr/�seek)r1�offset�whencer5r5r6rYszBZ2File.seekcCsZ|j�@|��|jtkr2|j��Wd�S|jWd�S1sL0YdSr;)rr=rr r/�tellr0r:r5r5r6r\s

zBZ2File.tellN)r)r)rE)rE)rE)rE)�__name__�
__module__�__qualname__r7r8�propertyr<r>r@r?rArCrrIrJrOrPrrWr-�SEEK_SETrYr\r5r5r5r6rs$?





	

rrrcCs�d|vr d|vrPtd|f��n0|dur0td��|dur@td��|durPtd��|�dd�}t|||d�}d|vr�t�||||�S|SdS)	N�trKrz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moderr
)r�replacerr-�
TextIOWrapper)r2r3r�encoding�errors�newlineZbz_modeZbinary_filer5r5r6rsrcCst|�}|�|�|��Sr;)rrr9)rUr�compr5r5r6rGsrcCsfg}|r\t�}z|�|�}Wnty:|r4Yq\n�Yn0|�|�|jsTtd��|j}qd�|�S)NzACompressed data ended before the end-of-stream marker was reached�)rrr,�append�eofrZunused_data�join)rUZresultsZdecomp�resr5r5r6rRs
r)rrNNN)r)�__all__�
__author__�builtinsrr(r-r&r+Z	threadingrZ_bz2rrrr r!rVrrrr5r5r5r6�<module>s$�
)


?>