U e5dÜã@s6ddlZejZGdd„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ú$/usr/lib64/python3.8/_compression.pyÚ_check_not_closed szBaseStream._check_not_closedcCs| ¡st d¡‚dS)NzFile not open for reading)ÚreadableÚioÚUnsupportedOperationrrrrÚ_check_can_readszBaseStream._check_can_readcCs| ¡st d¡‚dS)NzFile not open for writing)Úwritabler r rrrrÚ_check_can_writeszBaseStream._check_can_writecCs(| ¡st d¡‚| ¡s$t d¡‚dS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r r r ÚseekablerrrrÚ_check_can_seeks zBaseStream._check_can_seekN)Ú__name__Ú __module__Ú __qualname__r r rrrrrrr srcsfeZdZdd„Zddd„Z‡fdd„Zdd „Zd d „Zdd d„Zdd„Z e j fdd„Z dd„Z ‡ZS)ÚDecompressReadercCsdS)NTrrrrrr $szDecompressReader.readablercKs>||_d|_d|_d|_||_||_|jf|jŽ|_||_dS)NFréÿÿÿÿ)Ú_fpÚ_eofÚ_posÚ_sizeÚ_decomp_factoryÚ _decomp_argsÚ _decompressorÚ_trailing_error)rÚfpZdecomp_factoryZtrailing_errorZ decomp_argsrrrÚ__init__'szDecompressReader.__init__csd|_tƒ ¡S©N)rÚsuperÚcloser©Ú __class__rrr#;szDecompressReader.closecCs |j ¡Sr!)rrrrrrr?szDecompressReader.seekablec CsPt|ƒ�:}| d¡�$}| t|ƒ¡}||dt|ƒ…<W5QRXW5QRXt|ƒS)NÚB)Ú memoryviewÚcastÚreadÚlen)rÚbZviewZ byte_viewÚdatarrrÚreadintoBs$zDecompressReader.readintorcCsì|dkr| ¡S|r|jrdSd}|jjr„|jjp<|j t¡}|sDqÀ|jf|j Ž|_z|j  ||¡}Wq¸|j k r€YqÀYq¸Xn4|jj r¦|j t¡}|sªt dƒ‚nd}|j  ||¡}|r"qÀq"|sÖd|_|j|_dS|jt|ƒ7_|S)NrózACompressed file ended before the end-of-stream marker was reachedT)ÚreadallrrÚeofZ unused_datarr)Ú BUFFER_SIZErrÚ decompressrZ needs_inputÚEOFErrorrrr*)rÚsizer,Zrawblockrrrr)Hs@  ÿÿ   zDecompressReader.readcCs,|j d¡d|_d|_|jf|jŽ|_dS)NrF)rÚseekrrrrrrrrrÚ_rewindrs zDecompressReader._rewindcCs°|tjkr nR|tjkr"|j|}n<|tjkrP|jdkrD| tj¡rDq6|j|}ntd  |¡ƒ‚||jkrr|  ¡n ||j8}|dkrª| t tj|ƒ¡}|sœqª|t |ƒ8}q||jS)NrzInvalid value for whence: {}) r ÚSEEK_SETÚSEEK_CURrÚSEEK_ENDrr)ÚDEFAULT_BUFFER_SIZErÚformatr6Úminr*)rÚoffsetÚwhencer,rrrr5xs&          zDecompressReader.seekcCs|jSr!)rrrrrÚtell–szDecompressReader.tell)r)r)rrrr r r#rr-r)r6r r7r5r?Ú __classcell__rrr$rr!s   *r)r r:r1ÚBufferedIOBaserÚ RawIOBaserrrrrÚs