Your IP : 18.116.15.124


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



���]��@sKddlZejZGdd�dej�ZGdd�dej�ZdS)�Nc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
BaseStreamcCs|jrtd��dS)NzI/O operation on closed file)�closed�
ValueError)�self�r�1/opt/alt/python35/lib64/python3.5/_compression.py�_check_not_closeds	zBaseStream._check_not_closedcCs|j�stjd��dS)NzFile not open for reading)�readable�io�UnsupportedOperation)rrrr�_check_can_readszBaseStream._check_can_readcCs|j�stjd��dS)NzFile not open for writing)�writabler
r)rrrr�_check_can_writeszBaseStream._check_can_writecCs:|j�stjd��|j�s6tjd��dS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r	r
r�seekable)rrrr�_check_can_seekszBaseStream._check_can_seekN)�__name__�
__module__�__qualname__rrrrrrrrr	srcs�eZdZdd�Zfdd�Z�fdd�Zdd�Zd	d
�Zddd
�Zdd�Z	e
jdd�Zdd�Z
�S)�DecompressReadercCsdS)NTr)rrrrr	$szDecompressReader.readablecKsX||_d|_d|_d|_||_||_|j|j�|_||_dS)NFr����)�_fp�_eof�_pos�_size�_decomp_factory�_decomp_args�
_decompressor�_trailing_error)r�fp�decomp_factory�trailing_error�decomp_argsrrr�__init__'s						zDecompressReader.__init__csd|_t�j�S)N)r�super�close)r)�	__class__rrr%;s	zDecompressReader.closecCs
|jj�S)N)rr)rrrrr?szDecompressReader.seekablecCsdt|��K}|jd��2}|jt|��}||dt|��<WdQRXWdQRXt|�S)N�B)�
memoryview�cast�read�len)r�b�view�	byte_view�datarrr�readintoBs!$zDecompressReader.readintorcCs?|dkr|j�S|s&|jr*dSd}x�|jjr�|jjpZ|jjt�}|sdP|j|j	�|_y|jj
||�}Wq�|jk
r�PYq�XnN|jjr�|jjt�}|s�t
d��nd}|jj
||�}|r3Pq3W|s&d|_|j|_dS|jt|�7_|S)Nr�zACompressed file ended before the end-of-stream marker was reachedT)�readallrr�eof�unused_datarr*�BUFFER_SIZErr�
decompressr�needs_input�EOFErrorrrr+)r�sizer/�rawblockrrrr*Hs>
		zDecompressReader.readcCs;|jjd�d|_d|_|j|j�|_dS)NrF)r�seekrrrrr)rrrr�_rewindrs		zDecompressReader._rewindcCs|tjkrn{|tjkr1|j|}n\|tjkrx|jdkrhx|jtj�rgqRW|j|}ntdj	|���||jkr�|j
�n
||j8}xB|dkr�|jttj|��}|s�P|t|�8}q�W|jS)NrzInvalid value for whence: {})
r
�SEEK_SET�SEEK_CURr�SEEK_ENDrr*�DEFAULT_BUFFER_SIZEr�formatr<�minr+)r�offset�whencer/rrrr;xs&

zDecompressReader.seekcCs|jS)N)r)rrrr�tell�szDecompressReader.tellr)rrrr	r#r%rr0r*r<r
r=r;rErr)r&rr!s*r)r
r@r5�BufferedIOBaser�	RawIOBaserrrrr�<module>s	

?>