Your IP : 3.137.214.16


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/bz2.cpython-35.opt-2.pyc



���]�0�@sddddddgZdZddlmZdd	lZdd	lZdd	lZydd
lm	Z	Wn"e
k
r�dd
lm	Z	YnXddlm
Z
mZdZdZd
ZGdd�dej�Zddd	d	d	dd�Zddd�Zdd�Zd	S)�BZ2File�
BZ2Compressor�BZ2Decompressor�open�compress�
decompressz%Nadeem Vawda <nadeem.vawda@gmail.com>�)rN)�RLock)rr��c@seZdZddddd�Zdd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
ddd�Zd(dd�Zd)dd�Z
dd�Zd*dd�Zd+dd�Zd d!�Zd"d#�Zejd$d%�Zd&d'�ZdS),r�rN�	cCs�t�|_d|_d|_t|_|dk	rCtjdt�d|koZdknskt	d��|dkr�d}t
}n�|dkr�d
}t}t|�|_
ng|dkr�d}t}t|�|_
n=|dkrd}t}t|�|_
nt	d|f��t|ttf�rSt||�|_d|_||_n?t|d�sqt|d�r�||_||_ntd��|jt
kr�tj|jtdt�}tj|�|_n	d|_dS)NFz)Use of 'buffering' argument is deprecatedr	rz%compresslevel must be between 1 and 9�r�rb�w�wb�x�xb�a�abzInvalid mode: %rT�read�writez1filename must be a str or bytes object, or a file�trailing_errorr)r
rr)rr)rr)rr)r�_lock�_fp�_closefp�_MODE_CLOSED�_mode�warnings�warn�DeprecationWarning�
ValueError�
_MODE_READ�_MODE_WRITEr�_compressor�
isinstance�str�bytes�
_builtin_open�hasattr�	TypeError�_compression�DecompressReaderr�OSError�io�BufferedReader�_buffer�_pos)�self�filename�mode�	buffering�
compresslevel�	mode_code�raw�r8�(/opt/alt/python35/lib64/python3.5/bz2.py�__init__*sL							zBZ2File.__init__cCs�|j��|jtkrdSzT|jtkr?|jj�n1|jtkrp|jj|j	j
��d|_	Wdz|jr�|jj�Wdd|_d|_t|_d|_XXWdQRXdS)NF)rrrr!r/�closer"rrr#�flushr)r1r8r8r9r;os 

				z
BZ2File.closecCs
|jtkS)N)rr)r1r8r8r9�closed�szBZ2File.closedcCs|j�|jj�S)N)�_check_not_closedr�fileno)r1r8r8r9r?�s
zBZ2File.filenocCs|j�o|jj�S)N)�readabler/�seekable)r1r8r8r9rA�szBZ2File.seekablecCs|j�|jtkS)N)r>rr!)r1r8r8r9r@�s
zBZ2File.readablecCs|j�|jtkS)N)r>rr")r1r8r8r9�writable�s
zBZ2File.writablerc	Cs/|j�|j�|jj|�SWdQRXdS)N)r�_check_can_readr/�peek)r1�nr8r8r9rD�s

zBZ2File.peekr	c	Cs/|j�|j�|jj|�SWdQRXdS)N)rrCr/r)r1�sizer8r8r9r�s

zBZ2File.readc	CsD|j�4|j�|dkr)tj}|jj|�SWdQRXdS)Nr)rrCr-�DEFAULT_BUFFER_SIZEr/�read1)r1rFr8r8r9rH�s


	z
BZ2File.read1c	Cs/|j�|j�|jj|�SWdQRXdS)N)rrCr/�readinto)r1�br8r8r9rI�s

zBZ2File.readintoc	Cset|t�s6t|d�s*td��|j�}|j�|j�|jj|�SWdQRXdS)N�	__index__zInteger argument expected)	r$�intr(r)rKrrCr/�readline)r1rFr8r8r9rM�s

zBZ2File.readlinec	Cset|t�s6t|d�s*td��|j�}|j�|j�|jj|�SWdQRXdS)NrKzInteger argument expected)	r$rLr(r)rKrrCr/�	readlines)r1rFr8r8r9rN�s

zBZ2File.readlinescCs`|j�P|j�|jj|�}|jj|�|jt|�7_t|�SWdQRXdS)N)r�_check_can_writer#rrrr0�len)r1�data�
compressedr8r8r9r�s

z
BZ2File.writec
Cs(|j�tjj||�SWdQRXdS)N)rr*�
BaseStream�
writelines)r1�seqr8r8r9rT�s
zBZ2File.writelinesc
Cs2|j�"|j�|jj||�SWdQRXdS)N)r�_check_can_seekr/�seek)r1�offset�whencer8r8r9rWs

zBZ2File.seekc	CsB|j�2|j�|jtkr0|jj�S|jSWdQRXdS)N)rr>rr!r/�tellr0)r1r8r8r9rZs



zBZ2File.tell���r[r[r[)�__name__�
__module__�__qualname__r:r;�propertyr=r?rAr@rBrDrrHrIrMrNrrTr-�SEEK_SETrWrZr8r8r8r9rs"E


	rrcCs�d|kr.d|krvtd|f��nH|dk	rFtd��|dk	r^td��|dk	rvtd��|jdd�}t||d|�}d|kr�tj||||�S|SdS)	N�trJzInvalid mode: %rz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moder
r5)r �replacerr-�
TextIOWrapper)r2r3r5�encoding�errors�newline�bz_mode�binary_filer8r8r9r scCs#t|�}|j|�|j�S)N)rrr<)rQr5�compr8r8r9rHscCs�g}xs|r{t�}y|j|�}Wntk
rL|rEPn�YnX|j|�|jsotd��|j}q	Wdj|�S)NzACompressed data ended before the end-of-stream marker was reached�)rrr,�append�eofr �unused_data�join)rQ�results�decomp�resr8r8r9rSs		

	
)�__all__�
__author__�builtinsrr'r-rr*�	threadingr�ImportError�dummy_threading�_bz2rrrr!r"rSrrrr8r8r8r9�<module>s(	
�'

?>