Your IP : 52.14.176.111


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/bz2.cpython-310.opt-2.pyc

o

6��fG.�@s�	gd�ZdZddlmZddlZddlZddlZddlm	Z	m
Z
dZdZdZ
Gdd	�d	ej�Z		ddd
�Zddd�Zdd�ZdS))�BZ2File�
BZ2Compressor�BZ2Decompressor�open�compress�
decompressz%Nadeem Vawda <nadeem.vawda@gmail.com>�)rN)rr��c@s�eZdZ	d)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�	��
compresslevelcCs8	d|_d|_t|_d|krdkstd��td��|dvr%d}t}n1|dvr3d}t}t|�|_n#|d	vrAd
}t}t|�|_n|dvrOd}t}t|�|_ntd
|f��t	|t
ttj
f�rlt||�|_d|_||_nt|d�svt|d�r}||_||_ntd��|jtkr�tj|jttd�}t�|�|_dSd|_dS)NFrrz%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)�_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�moder
Z	mode_code�raw�r3�*/opt/alt/python310/lib64/python3.10/bz2.py�__init__%sL�
�
zBZ2File.__init__cCs	|jtkrdSzQ|jtkr|j��n|jtkr%|j�|j�	��d|_Wz&|j
r>|j��Wd|_d|_
t|_d|_dSWd|_d|_
t|_d|_dSd|_d|_
t|_d|_wz$|j
rq|j��Wd|_d|_
t|_d|_wWd|_d|_
t|_d|_wd|_d|_
t|_d|_w)NF)rrrr-�closerrrr �flushr�r/r3r3r4r6asT


�
�
����z
BZ2File.closecCs	|jtkS�N)rrr8r3r3r4�closedys
zBZ2File.closedcCs	|��|j��Sr9)�_check_not_closedr�filenor8r3r3r4r<~�
zBZ2File.filenocCs	|��o	|j��Sr9)�readabler-�seekabler8r3r3r4r?�szBZ2File.seekablecC�	|��|jtkSr9)r;rrr8r3r3r4r>�r=zBZ2File.readablecCr@r9)r;rrr8r3r3r4�writable�r=zBZ2File.writablercC�	|��|j�|�Sr9)�_check_can_readr-�peek)r/�nr3r3r4rD�szBZ2File.peek���cCrBr9)rCr-r�r/�sizer3r3r4r�szBZ2File.readcCs$	|��|dkrtj}|j�|�S)Nr)rCr+�DEFAULT_BUFFER_SIZEr-�read1rGr3r3r4rJ�s
z
BZ2File.read1cCrBr9)rCr-�readinto)r/�br3r3r4rK�szBZ2File.readintocC�:	t|t�st|d�std��|��}|��|j�|�S�N�	__index__zInteger argument expected)r!�intr'r(rOrCr-�readlinerGr3r3r4rQ��

zBZ2File.readlinecCrMrN)r!rPr'r(rOrCr-�	readlinesrGr3r3r4rS�rRzBZ2File.readlinescCsZ	|��t|ttf�rt|�}nt|�}|j}|j�|�}|j	�
|�|j|7_|Sr9)Z_check_can_writer!r#�	bytearray�len�
memoryview�nbytesr rrrr.)r/�dataZlengthZ
compressedr3r3r4r�s
z
BZ2File.writecCs	tj�||�Sr9)r)�
BaseStream�
writelines)r/�seqr3r3r4rZ�szBZ2File.writelinescCs	|��|j�||�Sr9)Z_check_can_seekr-�seek)r/�offset�whencer3r3r4r\�szBZ2File.seekcCs$	|��|jtkr|j��S|jSr9)r;rrr-�tellr.r8r3r3r4r_s


zBZ2File.tellN)r
)r)rF)�__name__�
__module__�__qualname__r5r6�propertyr:r<r?r>rArDrrJrKrQrSrrZr+�SEEK_SETr\r_r3r3r3r4rs(	<



	


rrrcCs�	d|vrd|vrtd|f��n|durtd��|dur!td��|dur)td��|�dd�}t|||d�}d|vrGt�|�}t�||||�S|S)	N�trLrz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moderr)r�replacerr+�
text_encoding�
TextIOWrapper)r0r1r
�encoding�errors�newlineZbz_modeZbinary_filer3r3r4rs"�
rcCs	t|�}|�|�|��Sr9)rrr7)rXr
�compr3r3r4r9srcCsd	g}|r-t�}z|�|�}Wnty|rYn�w|�|�|js(td��|j}|sd�|�S)NzACompressed data ended before the end-of-stream marker was reached�)rrr*�append�eofrZunused_data�join)rXZresultsZdecomp�resr3r3r4rDs"�
�
r)rrNNN)r)�__all__�
__author__�builtinsrr&r+r$r)Z_bz2rrrrrrYrrrr3r3r3r4�<module>s$v
�
*

?>