Viewing File: /opt/alt/python35/lib64/python3.5/__pycache__/_compression.cpython-35.opt-1.pyc



Yf@sQdZddlZejZGdddejZGdddejZdS)z7Internal classes used by the gzip, lzma and bz2 modulesNc@sFeZdZdZddZddZddZdd	Zd
S)
BaseStreamzMode-checking helper functions.cCs|jrtddS)NzI/O operation on closed file)closed
ValueError)selfr1/opt/alt/python35/lib64/python3.5/_compression.py_check_not_closeds	zBaseStream._check_not_closedcCs|jstjddS)NzFile not open for reading)readableioUnsupportedOperation)rrrr_check_can_readszBaseStream._check_can_readcCs|jstjddS)NzFile not open for writing)writabler
r)rrrr_check_can_writeszBaseStream._check_can_writecCs:|jstjd|js6tjddS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r	r
rseekable)rrrr_check_can_seekszBaseStream._check_can_seekN)__name__
__module____qualname____doc__rrrrrrrrr	s
rcseZdZdZddZfddZfddZdd	Zd
dZdd
dZ	ddZ
ejddZ
ddZS)DecompressReaderz5Adapts the decompressor API to a RawIOBase reader APIcCsdS)NTr)rrrrr	$szDecompressReader.readablecKsX||_d|_d|_d|_||_||_|j|j|_||_dS)NFr)_fp_eof_pos_size_decomp_factory_decomp_args
_decompressor_trailing_error)rfpZdecomp_factoryZtrailing_errorZdecomp_argsrrr__init__'s						zDecompressReader.__init__csd|_tjS)N)rsuperclose)r)	__class__rrr#;s	zDecompressReader.closecCs
|jjS)N)rr)rrrrr?szDecompressReader.seekablecCsdt|K}|jd2}|jt|}||dt|<WdQRXWdQRXt|S)NB)
memoryviewcastreadlen)rbZviewZ	byte_viewdatarrrreadintoBs!$zDecompressReader.readintorcCs?|dkr|jS|s&|jr*dSd}x|jjr|jjpZ|jjt}|sdP|j|j	|_y|jj
||}Wq|jk
rPYqXnN|jjr|jjt}|st
dnd}|jj
||}|r3Pq3W|s&d|_|j|_dS|jt|7_|S)NrzACompressed file ended before the end-of-stream marker was reachedT)readallrreofZunused_datarr(BUFFER_SIZErrZ
decompressrZneeds_inputEOFErrorrrr))rsizer+Zrawblockrrrr(Hs>
		zDecompressReader.readcCs;|jjdd|_d|_|j|j|_dS)NrF)rseekrrrrr)rrrr_rewindrs		zDecompressReader._rewindcCs|tjkrn{|tjkr1|j|}n\|tjkrx|jdkrhx|jtjrgqRW|j|}ntdj	|||jkr|j
n
||j8}xB|dkr|jttj|}|sP|t|8}qW|jS)NrzInvalid value for whence: {})
r
SEEK_SETSEEK_CURrSEEK_ENDrr(DEFAULT_BUFFER_SIZErformatr4minr))roffsetwhencer+rrrr3xs&

zDecompressReader.seekcCs|jS)z!Return the current file position.)r)rrrrtellszDecompressReader.tellr)rrrrr	r!r#rr,r(r4r
r5r3r=rr)r$rr!s*r)rr
r8r0BufferedIOBaser	RawIOBaserrrrr<module>s	
Back to Directory File Manager