grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026o ®û|j1ã@sBdZddlZddlZejZGdd„dejƒZGdd„dejƒZdS)z7Internal classes used by the gzip, lzma and bz2 moduleséNc@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) Ú BaseStreamzMode-checking helper functions.cCs|jrtdƒ‚dS)NzI/O operation on closed file)ÚclosedÚ ValueError©Úself©rú3/opt/alt/python310/lib64/python3.10/_compression.pyÚ_check_not_closed sÿzBaseStream._check_not_closedcCó| ¡s t d¡‚dS)NzFile not open for reading)ÚreadableÚioÚUnsupportedOperationrrrrÚ_check_can_readó ÿzBaseStream._check_can_readcCr )NzFile not open for writing)Úwritabler r rrrrÚ_check_can_writerzBaseStream._check_can_writecCs(| ¡s t d¡‚| ¡st 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__Ú__doc__r rrrrrrrr s  rcsreZdZdZdd„Zddd„Z‡fdd„Zd d „Zd d „Zddd„Z dd„Z dd„Z e j fdd„Zdd„Z‡ZS)ÚDecompressReaderz5Adapts the decompressor API to a RawIOBase reader APIcCsdS)NTrrrrrr $szDecompressReader.readablercKsB||_d|_d|_d|_||_||_|jdi|j¤Ž|_||_dS)NFréÿÿÿÿr)Ú_fpÚ_eofÚ_posÚ_sizeÚ_decomp_factoryÚ _decomp_argsÚ _decompressorÚ_trailing_error)rÚfpZdecomp_factoryZtrailing_errorZ decomp_argsrrrÚ__init__'s zDecompressReader.__init__csd|_tƒ ¡S©N)r ÚsuperÚcloser©Ú __class__rrr&;s zDecompressReader.closecCs |j ¡Sr$)rrrrrrr?s zDecompressReader.seekablec Cs’t|ƒ�9}| d¡�}| t|ƒ¡}||dt|ƒ…<Wdƒn1s$wYWdƒt|ƒSWdƒt|ƒS1s@wYt|ƒS)NÚB)Ú memoryviewÚcastÚreadÚlen)rÚbZviewZ byte_viewÚdatarrrÚreadintoBs(þ ýýzDecompressReader.readintorcCsê|dkr| ¡S|r |jrdSd} |jjrA|jjp|j t¡}|s#n<|jdi|j ¤Ž|_z |j  ||¡}Wn$|j y@Ynw|jj rR|j t¡}|sQt dƒ‚nd}|j  ||¡}|r^nq|sjd|_|j|_dS|jt|ƒ7_|S)NróTzACompressed file ended before the end-of-stream marker was reachedr)Úreadallrr ÚeofZ unused_datarr,Ú BUFFER_SIZErrÚ decompressr!Z needs_inputÚEOFErrorrrr-)rÚsizer/Zrawblockrrrr,HsH  ÿÿþ ÿèzDecompressReader.readcCs8g}| tj¡}r| |¡| tj¡}s d |¡S)Nr1)r,ÚsysÚmaxsizeÚappendÚjoin)rZchunksr/rrrr2qs  ÿ zDecompressReader.readallcCs0|j d¡d|_d|_|jdi|j¤Ž|_dS)NrFr)rÚseekrrrrr rrrrÚ_rewind|s zDecompressReader._rewindcCsÈ|tjkrn/|tjkr|j|}n$|tjkr.|jdkr(| tj¡r( | tj¡s!|j|}ntd  |¡ƒ‚||jkr?|  ¡n||j8}|dkra| t tj|ƒ¡}|sW |jS|t |ƒ8}|dksH|jS)NrzInvalid value for whence: {}) r ÚSEEK_SETÚSEEK_CURrÚSEEK_ENDrr,ÚDEFAULT_BUFFER_SIZErÚformatr=Úminr-)rÚoffsetÚwhencer/rrrr<‚s,       ÿ     þüzDecompressReader.seekcCs|jS)z!Return the current file position.)rrrrrÚtell szDecompressReader.tell)r)r)rrrrr r#r&rr0r,r2r=r r>r<rFÚ __classcell__rrr'rr!s   ) r) rr r8rAr4ÚBufferedIOBaserÚ RawIOBaserrrrrÚs