Qf1dZddlZddlZejZGddej ZGddejZy)z7Internal classes used by the gzip, lzma and bz2 modulesNc(eZdZdZdZdZdZdZy) BaseStreamzMode-checking helper functions.c2|jr tdy)NzI/O operation on closed file)closed ValueErrorselfs 3/opt/alt/python312/lib64/python3.12/_compression.py_check_not_closedzBaseStream._check_not_closed s ;;;< < cN|jstjdy)NzFile not open for reading)readableioUnsupportedOperationrs r _check_can_readzBaseStream._check_can_read"}}))*EF Fr cN|jstjdy)NzFile not open for writing)writablerrrs r _check_can_writezBaseStream._check_can_writerr c|jstjd|jstjdy)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)rrrseekablers r _check_can_seekzBaseStream._check_can_seeksO}}))+FG G}}))+EF Fr N)__name__ __module__ __qualname____doc__r rrrr r rr s)=GGFr rcteZdZdZdZd dZfdZdZdZd dZ dZ d Z e jfd Zd ZxZS)DecompressReaderz5Adapts the decompressor API to a RawIOBase reader APIcy)NTrrs r rzDecompressReader.readable$sr c ||_d|_d|_d|_||_||_|jdi|j |_||_y)NFrr)_fp_eof_pos_size_decomp_factory _decomp_args _decompressor_trailing_error)r fpdecomp_factorytrailing_error decomp_argss r __init__zDecompressReader.__init__'sZ   .'1T11FD4E4EF .r c.d|_t| SN)r)superclose)r __class__s r r3zDecompressReader.close;s!w}r c6|jjSr1)r#rrs r rzDecompressReader.seekable?sxx  ""r ct|5}|jd5}|jt|}||dt|ddddddtS#1swYxYw#1swYtSxYw)NB) memoryviewcastreadlen)r bview byte_viewdatas r readintozDecompressReader.readintoBsc ]dDIIcNi99S^,D$(Ijs4y !%3]4y%3N]4ys"A.)A"A."A+ 'A..Bc|dkr|jS|r |jryd} |jjry|jjxs|j j t}|sn|jdi|j|_ |jj||}n`|jjr,|j j t}|s tdd}|jj||}|rn|sd|_|j|_y|xjt!|z c_|S#|j$rYLwxYw)Nrr TzACompressed file ended before the end-of-stream marker was reachedr)readallr$r)eof unused_datar#r: BUFFER_SIZEr'r( decompressr* needs_inputEOFErrorr%r&r;)r sizer?rawblocks r r:zDecompressReader.readHsY !8<<> !tyy!!%% ..::7 HHMM+6%9T%9%9&)''&)"--884HD %%11#xx}}[9H#&(JKK #H))44XtD12DIDJ SY  '++sEE('E(cg}|jtjx}r3|j||jtjx}r3dj |S)Nr )r:sysmaxsizeappendjoin)r chunksr?s r rBzDecompressReader.readallqsXii ,,d, MM$ ii ,,d,xxr c|jjdd|_d|_|jdi|j |_y)NrFr)r#seekr$r%r'r(r)rs r _rewindzDecompressReader._rewind|s>  a  1T11FD4E4EFr c|tjk(rn|tjk(r|j|z}n|tjk(r_|j dkr@|j tjr! |j tjr!|j |z}ntdj|||jkr|jn||jz}|dkDrL|j ttj|}|s |jS|t|z}|dkDrL|jS)NrzInvalid value for whence: {}) rSEEK_SETSEEK_CURr%SEEK_ENDr&r:DEFAULT_BUFFER_SIZErformatrSminr;)r offsetwhencer?s r rRzDecompressReader.seeks R[[  r{{ "YY'F r{{ "zzA~ii 6 67ii 6 67ZZ&(F;BB6JK K DII  LLN dii Fqj99S!7!7@ADyy c$i F qj yyr c|jS)z!Return the current file position.)r%rs r tellzDecompressReader.tells yyr )r)r")rrrrrr/r3rr@r:rBrSrrUrRr^ __classcell__)r4s@r rr!sC?.(# 'R G #%++<r r) rrrLrXrEBufferedIOBaser RawIOBaserrr r rbs?= $$ F""F0Ar||Ar