a DOg@s6ddlZejZGdddejZGdddejZdS)Nc@s,eZdZddZddZddZddZd S) BaseStreamcCs|jrtddS)NzI/O operation on closed file)closed ValueErrorselfr1/opt/alt/python39/lib64/python3.9/_compression.py_check_not_closed szBaseStream._check_not_closedcCs|stddS)NzFile not open for reading)readableioUnsupportedOperationrrrr_check_can_readszBaseStream._check_can_readcCs|stddS)NzFile not open for writing)writabler r rrrr_check_can_writeszBaseStream._check_can_writecCs(|std|s$tddS)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 srcsfeZdZddZdddZfddZdd Zd d Zdd dZddZ e j fddZ ddZ ZS)DecompressReadercCsdS)NTrrrrrr $szDecompressReader.readablercKsB||_d|_d|_d|_||_||_|jfi|j|_||_dS)NFr)_fp_eof_pos_size_decomp_factory _decomp_args _decompressor_trailing_error)rfpZdecomp_factoryZtrailing_errorZ decomp_argsrrr__init__'szDecompressReader.__init__csd|_tSN)rsupercloser __class__rrr#;szDecompressReader.closecCs |jSr!)rrrrrrr?szDecompressReader.seekablec Csxt|X}|d.}|t|}||dt|<Wdn1sH0YWdn1sf0Yt|S)NB) memoryviewcastreadlen)rbZviewZ byte_viewdatarrrreadintoBsLzDecompressReader.readintorcCs|dkr|S|r|jrdSd}|jjr|jjp<|jt}|sDq|jfi|j |_z|j ||}Wq|j yYqYq0n4|jj r|jt}|st dnd}|j ||}|r"qq"|sd|_|j|_dS|jt|7_|S)NrzACompressed file ended before the end-of-stream marker was reachedT)readallrreofZ unused_datarr) BUFFER_SIZErr decompressrZ needs_inputEOFErrorrrr*)rsizer,Zrawblockrrrr)Hs@     zDecompressReader.readcCs0|jdd|_d|_|jfi|j|_dS)NrF)rseekrrrrrrrrr_rewindrs zDecompressReader._rewindcCs|tjkr nR|tjkr"|j|}n<|tjkrP|jdkrD|tjrDq6|j|}ntd |||jkrr| n ||j8}|dkr|t tj|}|sq|t |8}q||jS)NrzInvalid value for whence: {}) r SEEK_SETSEEK_CURrSEEK_ENDrr)DEFAULT_BUFFER_SIZErformatr6minr*)roffsetwhencer,rrrr5xs&          zDecompressReader.seekcCs|jSr!)rrrrrtellszDecompressReader.tell)r)r)rrrr r r#rr-r)r6r r7r5r? __classcell__rrr$rr!s   *r)r r:r1BufferedIOBaser RawIOBaserrrrrs