U
e5d1 ã @ s¤ d Z ddddddgZdZdd lmZ dd
lZdd
lZdd
lZdd
l Z ddl
mZ ddlm
Z
mZ dZd
ZdZeƒ ZG dd„ de jƒZddd„Zddd„Zdd„ Zd
S )z¬Interface to the libbzip2 compression library.
This module provides a file interface, classes for incremental
(de)compression, and functions for one-shot (de)compression.
ÚBZ2FileÚ
BZ2CompressorÚBZ2DecompressorÚopenÚcompressÚ
decompressz%Nadeem Vawda é )r N)ÚRLock)r r é é c @ s´ e Zd ZdZdedfdd„Zdd„ Zedd „ ƒZd
d„ Z dd
„ Z
dd„ Zdd„ Zd)dd„Z
d*dd„Zd+dd„Zdd„ Zd,dd„Zd-dd„Zd d!„ Zd"d#„ Zejfd$d%„Zd&d'„ Zd(S ).r a@ A file object providing transparent bzip2 (de)compression.
A BZ2File can act as a wrapper for an existing file object, or refer
directly to a named file on disk.
Note that BZ2File provides a *binary* file interface - data read is
returned as bytes, and data to be written should be given as bytes.
Úré c C sT t ƒ | _d| _d| _t| _|tk r2tjdt dd� d| krFdksPn t
dƒ‚|d krbd
}t}nb|dkr~d}t}t
|ƒ| _nF|d
kršd}t}t
|ƒ| _n*|dkr¶d}t}t
|ƒ| _nt
d|f ƒ‚t|tttjfƒrðt||ƒ| _d| _|| _n.t|dƒ�st|dƒ�r|| _|| _ntdƒ‚| jtk�rJtj| jttd�}t |¡| _nd| _dS )aO Open a bzip2-compressed file.
If filename is a str, bytes, or PathLike object, it gives the
name of the file to be opened. Otherwise, it should be a file
object, which will be used to read or write the compressed data.
mode can be 'r' for reading (default), 'w' for (over)writing,
'x' for creating exclusively, or 'a' for appending. These can
equivalently be given as 'rb', 'wb', 'xb', and 'ab'.
buffering is ignored since Python 3.0. Its use is deprecated.
If mode is 'w', 'x' or 'a', compresslevel can be a number between 1
and 9 specifying the level of compression: 1 produces the least
compression, and 9 (default) produces the most compression.
If mode is 'r', the input file may be the concatenation of
multiple compressed streams.
NFzGUse of 'buffering' argument is deprecated and ignored since Python 3.0.é )Ú
stacklevelr 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Ú _sentinelÚwarningsÚwarnÚDeprecationWarningÚ
ValueErrorÚ
_MODE_READÚ_MODE_WRITEr Ú_compressorÚ
isinstanceÚstrÚbytesÚosÚPathLikeÚ
_builtin_openÚhasattrÚ TypeErrorÚ_compressionZDecompressReaderr ÚOSErrorÚioÚBufferedReaderÚ_bufferÚ_pos)ÚselfÚfilenameÚmodeÚ bufferingÚ
compresslevelZ mode_codeÚraw© r; ú/usr/lib64/python3.8/bz2.pyÚ__init__) sT ý ÿzBZ2File.__init__c C sž | j �Ž | jtkr W 5 Q R £ dS z<| jtkr8| j ¡ n"| jtkrZ| j | j
¡ ¡ d| _
W 5 z| jrp| j ¡ W 5 d| _d| _t| _d| _X X W 5 Q R X dS )z«Flush and close the file.
May be called more than once without error. Once the file is
closed, any other operation on it will raise a ValueError.
NF)r r r r r r3 Úcloser$ r% r r&