3 \@s6ddlZejZGdddejZGdddejZdS)Nc@s,eZdZddZddZddZddZd S) BaseStreamcCs|jrtddS)NzI/O operation on closed file)closed ValueError)selfr$/usr/lib64/python3.6/_compression.py_check_not_closed szBaseStream._check_not_closedcCs|jstjddS)NzFile not open for reading)readableioUnsupportedOperation)rrrr_check_can_readszBaseStream._check_can_readcCs|jstjddS)NzFile not open for writing)writabler r )rrrr_check_can_writeszBaseStream._check_can_writecCs(|jstjd|js$tjddS)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 srcsheZdZddZffddZfddZddZd d Zdd d ZddZ e j fddZ ddZ ZS)DecompressReadercCsdS)NTr)rrrrr $szDecompressReader.readablecKs>||_d|_d|_d|_||_||_|jf|j|_||_dS)NFr)_fp_eof_pos_size_decomp_factory _decomp_args _decompressor_trailing_error)rfpZdecomp_factoryZtrailing_errorZ decomp_argsrrr__init__'szDecompressReader.__init__csd|_tjS)N)rsuperclose)r) __class__rrr";szDecompressReader.closecCs |jjS)N)rr)rrrrr?szDecompressReader.seekablecCsPt|:}|jd$}|jt|}||dt|<WdQRXWdQRXt|S)NB) memoryviewcastreadlen)rbZviewZ byte_viewdatarrrreadintoBs$zDecompressReader.readintorc Cs|dkr|jS| s|jr dSd}x|jjr|jjp@|jjt}|sHP|jf|j |_y|jj ||}Wq|j k rPYqXn4|jj r|jjt}|st dnd}|jj ||}|r&Pq&W|sd|_|j|_dS|jt|7_|S)NrzACompressed file ended before the end-of-stream marker was reachedT)readallrreofZ unused_datarr' BUFFER_SIZErrZ decompressrZ needs_inputEOFErrorrrr()rsizer*Zrawblockrrrr'Hs>      zDecompressReader.readcCs,|jjdd|_d|_|jf|j|_dS)NrF)rseekrrrrr)rrrr_rewindrs zDecompressReader._rewindcCs|tjkr nV|tjkr"|j|}n@|tjkrT|jdkrHx|jtjrFq8W|j|}ntdj |||jkrv|j n ||j8}x0|dkr|jt tj|}|sP|t |8}qW|jS)NrzInvalid value for whence: {}) r SEEK_SETSEEK_CURrSEEK_ENDrr'DEFAULT_BUFFER_SIZErformatr3minr()roffsetwhencer*rrrr2xs&          zDecompressReader.seekcCs|jS)N)r)rrrrtellszDecompressReader.tellr)r)rrrr r r"rr+r'r3r r4r2r< __classcell__rr)r#rr!s   *r)r r7r/BufferedIOBaser RawIOBaserrrrrs