Your IP : 3.144.103.14
�
��f)Hc@sdZddddddgZdZdd lZdd lZdd lZydd
lmZWn"ek
r�dd
l mZYnXddl
mZmZdZ
dZd
ZdZdZGdd�dej�Zddeeedd�Zddd�Zdd�Zd S(u�Interface to the libbzip2 compression library.
This module provides a file interface, classes for incremental
(de)compression, and functions for one-shot (de)compression.
uBZ2Fileu
BZ2CompressoruBZ2Decompressoruopenucompressu
decompressu%Nadeem Vawda <nadeem.vawda@gmail.com>iN(uRLock(u
BZ2CompressoruBZ2Decompressoriiii cBsm|EeZdZdZdd8ddd�Zdd�Zedd ��Zd
d�Z dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd9dd�Zd9dd�Zd d!d"�Zd:d$d%�Zd;d&d'�Zd(d)�Zd<d*d+�Zd=d,d-�Zd.d/�Zd0d1�Zd2d3�Zd d4d5�Zd6d7�Zd8S(>uBZ2Fileu@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.
uri cCs�t�|_d|_d|_t|_d|_d|_ |dk rXt
jdt�nd|koodkns�t
d��n|dkr�d}t}t�|_d |_d|_ni|dkr�d}t}t|�|_n?|dkrd
}t}t|�|_nt
dj|���t|ttf�rdtj||�|_d|_||_n?t|d�s�t|d�r�||_||_ntd��dS(uOpen a bzip2-compressed file.
If filename is a str or bytes object, is 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, or 'a' for
appending. These can equivalently be given as 'rb', 'wb', and 'ab'.
buffering is ignored. Its use is deprecated.
If mode is 'w' 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.
iiu)Use of 'buffering' argument is deprecatedi u%compresslevel must be between 1 and 9uururbsuwuwbuauabuInvalid mode: {!r}ureaduwriteu1filename must be a str or bytes object, or a fileNFi����(uururb(uwuwb(uauabT(uRLocku_lockuNoneu_fpuFalseu_closefpu_MODE_CLOSEDu_modeu_posu_sizeuwarningsuwarnuDeprecationWarningu
ValueErroru
_MODE_READuBZ2Decompressoru
_decompressoru_bufferu_buffer_offsetu_MODE_WRITEu
BZ2Compressoru_compressoruformatu
isinstanceustrubytesubuiltinsuopenuTrueuhasattru TypeError(uselfufilenameumodeu bufferingu
compresslevelu mode_code((u(/opt/alt/python33/lib64/python3.3/bz2.pyu__init__+sD
uBZ2File.__init__cCs�|j��|jtkrdSzY|jttfkrAd|_n4|jtkru|jj |j
j��d|_
nWdz|jr�|jj
�nWdd|_d|_t|_d|_d|_XXWdQXdS(u�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.
NsiF(u_locku_modeu_MODE_CLOSEDu
_MODE_READu_MODE_READ_EOFuNoneu
_decompressoru_MODE_WRITEu_fpuwriteu_compressoruflushu_closefpucloseuFalseu_bufferu_buffer_offset(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyucloseis"
u
BZ2File.closecCs
|jtkS(uTrue if this file is closed.(u_modeu_MODE_CLOSED(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyuclosed�suBZ2File.closedcCs|j�|jj�S(u3Return the file descriptor for the underlying file.(u_check_not_closedu_fpufileno(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyufileno�s
uBZ2File.filenocCs|j�o|jj�S(u)Return whether the file supports seeking.(ureadableu_fpuseekable(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyuseekable�suBZ2File.seekablecCs|j�|jttfkS(u/Return whether the file was opened for reading.(u_check_not_closedu_modeu
_MODE_READu_MODE_READ_EOF(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyureadable�s
uBZ2File.readablecCs|j�|jtkS(u/Return whether the file was opened for writing.(u_check_not_closedu_modeu_MODE_WRITE(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyuwritable�s
uBZ2File.writablecCs|jrtd��ndS(NuI/O operation on closed file(uclosedu
ValueError(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyu_check_not_closed�s uBZ2File._check_not_closedcCs5|jttfkr1|j�tjd��ndS(NuFile not open for reading(u_modeu
_MODE_READu_MODE_READ_EOFu_check_not_closeduiouUnsupportedOperation(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyu_check_can_read�s
uBZ2File._check_can_readcCs/|jtkr+|j�tjd��ndS(NuFile not open for writing(u_modeu_MODE_WRITEu_check_not_closeduiouUnsupportedOperation(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyu_check_can_write�s
uBZ2File._check_can_writecCsV|jttfkr1|j�tjd��n|jj�sRtjd��ndS(Nu3Seeking is only supported on files open for readingu3The underlying file object does not support seeking(u_modeu
_MODE_READu_MODE_READ_EOFu_check_not_closeduiouUnsupportedOperationu_fpuseekable(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyu_check_can_seek�s
uBZ2File._check_can_seekcCs|jtkrdSx�|jt|j�kr |jjpI|jj t
�}|s�|jjrwt|_|j|_
dStd��n|jjr�t�|_y|jj|�|_Wq�tk
r�t|_|j|_
dSYq�Xn|jj|�|_d|_qWdS(NuACompressed file ended before the end-of-stream marker was reachediFT(u_modeu_MODE_READ_EOFuFalseu_buffer_offsetulenu_bufferu
_decompressoruunused_datau_fpureadu_BUFFER_SIZEueofu_posu_sizeuEOFErroruBZ2Decompressoru
decompressuOSErroruTrue(uselfurawblock((u(/opt/alt/python33/lib64/python3.3/bz2.pyu_fill_buffer�s,
uBZ2File._fill_buffercCs�|j|jd�|_d|_g}xJ|j�rt|rP|j|j�n|jt|j�7_d|_q+W|r�dj|�SdS(Nis(u_bufferu_buffer_offsetu_fill_bufferuappendu_posulenujoin(uselfureturn_dataublocks((u(/opt/alt/python33/lib64/python3.3/bz2.pyu _read_all�s
uBZ2File._read_allcCsC|j|}|t|j�krd|j|j|�}||_|jt|�7_|r`|SdS|j|jd�|_d|_g}x�|dkr+|j�r+|t|j�kr�|jd|�}||_n|j}d|_|r|j|�n|jt|�7_|t|�8}q�W|r?dj|�SdS(Nis(u_buffer_offsetulenu_bufferu_posuNoneu_fill_bufferuappendujoin(uselfunureturn_datauendudataublocks((u(/opt/alt/python33/lib64/python3.3/bz2.pyu_read_block�s*
uBZ2File._read_blockic
CsB|j�3|j�|j�s$dS|j|jd�SWdQXdS(u�Return buffered data without advancing the file position.
Always returns at least one byte of data, unless at EOF.
The exact number of bytes returned is unspecified.
sN(u_locku_check_can_readu_fill_bufferu_bufferu_buffer_offset(uselfun((u(/opt/alt/python33/lib64/python3.3/bz2.pyupeeks
uBZ2File.peekic CsQ|j�B|j�|dkr$dS|dkr:|j�S|j|�SWdQXdS(u�Read up to size uncompressed bytes from the file.
If size is negative or omitted, read until EOF is reached.
Returns b'' if the file is already at EOF.
isN(u_locku_check_can_readu _read_allu_read_block(uselfusize((u(/opt/alt/python33/lib64/python3.3/bz2.pyureads
uBZ2File.readc
Cs�|j��|j�|dksE|jt|j�krI|j�rIdS|dkr�|j|j|j|�}|jt|�7_n(|j|jd�}d|_d|_|jt|�7_|SWdQXdS(u�Read up to size uncompressed bytes, while trying to avoid
making multiple reads from the underlying stream.
Returns b'' if the file is at EOF.
isN(u_locku_check_can_readu_buffer_offsetulenu_bufferu_fill_bufferu_pos(uselfusizeudata((u(/opt/alt/python33/lib64/python3.3/bz2.pyuread1s
% u
BZ2File.read1c
Cs'|j�tjj||�SWdQXdS(u_Read up to len(b) bytes into b.
Returns the number of bytes read (0 for EOF).
N(u_lockuiouBufferedIOBaseureadinto(uselfub((u(/opt/alt/python33/lib64/python3.3/bz2.pyureadinto:s
uBZ2File.readintocCs�t|t�s<t|d�s-td��n|j�}n|j��|j�|dkr�|jjd|j �d}|dkr�|j|j |�}||_ |j
t|�7_
|Sntj
j||�SWdQXdS(u
Read a line of uncompressed bytes from the file.
The terminating newline (if present) is retained. If size is
non-negative, no more than size bytes will be read (in which
case the line may be incomplete). Returns b'' if already at EOF.
u __index__uInteger argument expectedis
iN(u
isinstanceuintuhasattru TypeErroru __index__u_locku_check_can_readu_bufferufindu_buffer_offsetu_posulenuiouBufferedIOBaseureadline(uselfusizeuenduline((u(/opt/alt/python33/lib64/python3.3/bz2.pyureadlineBs
uBZ2File.readlinec
Csct|t�s<t|d�s-td��n|j�}n|j�tjj||�SWdQXdS(u�Read a list of lines of uncompressed bytes from the file.
size can be specified to control the number of lines read: no
further lines will be read once the total size of the lines read
so far equals or exceeds size.
u __index__uInteger argument expectedN( u
isinstanceuintuhasattru TypeErroru __index__u_lockuiouBufferedIOBaseu readlines(uselfusize((u(/opt/alt/python33/lib64/python3.3/bz2.pyu readlinesYs
uBZ2File.readlinescCs_|j�P|j�|jj|�}|jj|�|jt|�7_t|�SWdQXdS(u�Write a byte string to the file.
Returns the number of uncompressed bytes written, which is
always len(data). Note that due to buffering, the file on disk
may not reflect the data written until close() is called.
N(u_locku_check_can_writeu_compressorucompressu_fpuwriteu_posulen(uselfudatau
compressed((u(/opt/alt/python33/lib64/python3.3/bz2.pyuwritegs
u
BZ2File.writec
Cs'|j�tjj||�SWdQXdS(u�Write a sequence of byte strings to the file.
Returns the number of uncompressed bytes written.
seq can be any iterable yielding byte strings.
Line separators are not added between the written byte strings.
N(u_lockuiouBufferedIOBaseu
writelines(uselfuseq((u(/opt/alt/python33/lib64/python3.3/bz2.pyu
writelinesus
uBZ2File.writelinescCsG|jjdd�t|_d|_t�|_d|_d|_dS(Nis( u_fpuseeku
_MODE_READu_modeu_posuBZ2Decompressoru
_decompressoru_bufferu_buffer_offset(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyu_rewind�s uBZ2File._rewindcCs�|j��|j�|dkr#no|dkr?|j|}nS|dkr}|jdkrm|jdd�n|j|}ntdj|���||jkr�|j�n
||j8}|j |dd�|jSWdQXdS(u�Change the file position.
The new position is specified by offset, relative to the
position indicated by whence. Values for whence are:
0: start of stream (default); offset must not be negative
1: current stream position
2: end of stream; offset must not be positive
Returns the new file position.
Note that seeking is emulated, so depending on the parameters,
this operation may be extremely slow.
iiiureturn_datauInvalid value for whence: {}NF(
u_locku_check_can_seeku_posu_sizeu _read_alluFalseu
ValueErroruformatu_rewindu_read_block(uselfuoffsetuwhence((u(/opt/alt/python33/lib64/python3.3/bz2.pyuseek�s
uBZ2File.seekcCs%|j�|j�|jSWdQXdS(u!Return the current file position.N(u_locku_check_not_closedu_pos(uself((u(/opt/alt/python33/lib64/python3.3/bz2.pyutell�s
uBZ2File.tellNTi����i����i����i����( u__name__u
__module__u__qualname__u__doc__uNoneu__init__ucloseupropertyuclosedufilenouseekableureadableuwritableu_check_not_closedu_check_can_readu_check_can_writeu_check_can_seeku_fill_bufferuTrueu _read_allu_read_blockupeekureaduread1ureadintoureadlineu readlinesuwriteu
writelinesu_rewinduseekutell(u
__locals__((u(/opt/alt/python33/lib64/python3.3/bz2.pyuBZ2File s4 >
#*urbi cCs�d|kr1d|kr�td|f��q�nQ|d k rLtd��n|d k rgtd��n|d k r�td��n|jdd�}t||d|�}d|kr�tj||||�S|Sd S(
u�Open a bzip2-compressed file in binary or text mode.
The filename argument can be an actual filename (a str or bytes object), or
an existing file object to read from or write to.
The mode argument can be "r", "rb", "w", "wb", "a" or "ab" for binary mode,
or "rt", "wt" or "at" for text mode. The default mode is "rb", and the
default compresslevel is 9.
For binary mode, this function is equivalent to the BZ2File constructor:
BZ2File(filename, mode, compresslevel). In this case, the encoding, errors
and newline arguments must not be provided.
For text mode, a BZ2File object is created, and wrapped in an
io.TextIOWrapper instance with the specified encoding, error handling
behavior, and line ending(s).
utubuInvalid mode: %ru0Argument 'encoding' not supported in binary modeu.Argument 'errors' not supported in binary modeu/Argument 'newline' not supported in binary modeuu
compresslevelN(u
ValueErroruNoneureplaceuBZ2Fileuiou
TextIOWrapper(ufilenameumodeu
compressleveluencodinguerrorsunewlineubz_modeubinary_file((u(/opt/alt/python33/lib64/python3.3/bz2.pyuopen�scCs#t|�}|j|�|j�S(u�Compress a block of data.
compresslevel, if given, must be a number between 1 and 9.
For incremental compression, use a BZ2Compressor object instead.
(u
BZ2Compressorucompressuflush(udatau
compresslevelucomp((u(/opt/alt/python33/lib64/python3.3/bz2.pyucompress�scCs�g}xv|r~t�}y|j|�}Wntk
rL|rEPn�YnX|j|�|jsrtd��n|j}q Wdj|�S(ujDecompress a block of data.
For incremental decompression, use a BZ2Decompressor object instead.
uACompressed data ended before the end-of-stream marker was reacheds(uBZ2Decompressoru
decompressuOSErroruappendueofu
ValueErroruunused_dataujoin(udatauresultsudecompures((u(/opt/alt/python33/lib64/python3.3/bz2.pyu
decompress�s
(u__doc__u__all__u
__author__ubuiltinsuiouwarningsu threadinguRLockuImportErrorudummy_threadingu_bz2u
BZ2CompressoruBZ2Decompressoru_MODE_CLOSEDu
_MODE_READu_MODE_READ_EOFu_MODE_WRITEu_BUFFER_SIZEuBufferedIOBaseuBZ2FileuNoneuopenucompressu
decompress(((u(/opt/alt/python33/lib64/python3.3/bz2.pyu<module>s,
��'
?>