Your IP : 52.14.176.111
o
6��fG. � @ s� g d �Z dZddlmZ ddlZddlZddlZddlm Z m
Z
dZdZdZ
G dd � d ej�Z ddd
�Zddd�Zdd� ZdS ))�BZ2File�
BZ2Compressor�BZ2Decompressor�open�compress�
decompressz%Nadeem Vawda <nadeem.vawda@gmail.com>� )r N)r r � � c @ s� e Zd Z d)dd�dd�Zdd� Zedd � �Zd
d� Zdd
� Zdd� Z dd� Z
d*dd�Zd+dd�Zd+dd�Z
dd� Zd+dd�Zd+dd�Zd d!� Zd"d#� Zejfd$d%�Zd&d'� Zd(S ),r �r� ��
compresslevelc C s8 d | _ d| _t| _d| krdkstd�� td��|dv r%d}t}n1|dv r3d}t}t|�| _n#|d v rAd
}t}t|�| _n|dv rOd}t}t|�| _ntd
|f ��t |t
ttj
f�rlt||�| _ d| _|| _nt|d�svt|d�r}|| _ || _ntd��| jtkr�tj| j ttd�}t�|�| _d S d| _d S )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 )�_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__c C s | j tkrd S zQ| j tkr| j�� n| j tkr%| j�| j� � � d | _W z&| j
r>| j�� W d | _d| _
t| _ d | _d S W d | _d| _
t| _ d | _d S d | _d| _
t| _ d | _w z$| j
rq| j�� W d | _d| _
t| _ d | _w W d | _d| _
t| _ d | _w d | _d| _
t| _ d | _w )NF)r r r r- �closer r r r �flushr �r/ r3 r3 r4 r6 a sT
�
�
����z
BZ2File.closec C s | j tkS �N)r r r8 r3 r3 r4 �closedy s
zBZ2File.closedc C s | � � | j�� S r9 )�_check_not_closedr �filenor8 r3 r3 r4 r<