WcG.cs gdZdZddlmZddlZddlZddlZddlm Z m Z dZ dZ dZ Gdd ejZ dd Zdd ZdZdS))BZ2File BZ2CompressorBZ2Decompressoropencompress decompressz%Nadeem Vawda )rN)rricseZdZ ddddZdZedZdZdZd Z d Z dd Z ddZ ddZ dZddZddZdZdZej(fdZdZdS)rr  compresslevelcs` d|_d|_t|_d|cxkrdkst dt d|dvr d}t }np|dvrd}t }t||_nP|d vrd }t }t||_n0|d vrd }t }t||_nt d |t|tttjfr"t|||_d|_||_n8t|dst|dr||_||_n t!d|jt krLt#j$|jt&t(}t+j,||_dSd|_dS)NFrr z%compresslevel must be between 1 and 9)rrbr )Zwwbr)Zxxbr)ZaabrInvalid mode: Treadwritez6filename must be a str, bytes, file or PathLike object)Ztrailing_errorr)_fp_closefp _MODE_CLOSED_mode ValueError _MODE_READ _MODE_WRITEr _compressor isinstanceZstrbytesosZPathLike _builtin_openhasattr TypeError _compressionZDecompressReaderrOSErrorioZBufferedReader_buffer_pos)selffilenamemoder Z mode_codeZraws /usr/lib64/python3.12/bz2.py__init__zBZ2File.__init__%s " ! ]''''a''DE E(DE E ? " "D"II [ D#I,];D   [ D#I,];D   [ D#I,];D  *449: : heR[[ 9 : :$Xt4DH DM"DJJ Xv & &'(G*D*DDH"DJJTU U :: # #//99C,,S1DLLLDIIIcs |jtkrdS |jtkr|jj nQ|jt kr<|j j|jjd|_ |jr|j j d|_d|_ t|_d|_dS#d|_d|_ t|_d|_wxYw# |jr|j j d|_d|_ t|_d|_w#d|_d|_ t|_d|_wxYwxYw)NF) rrrr%closerrrrflushrr' r*r-z BZ2File.closease :: % % F $zzZ'' ""$$${**t//55788#'  $===HHNN$$ % ) #   % ) # #### $===HHNN$$ % ) #  $  % ) # #### $ $ $s0BD 'C''#D  E>'E6"E>#E;;E>cs. |jtkSN)rrr/r0r*closedzBZ2File.closedys*zz\))r,cs\ |j|jjSr1)_check_not_closedrfilenor/r0r*r4zBZ2File.fileno~s%A   xx  r,cs\ |jo|jjSr1)readabler%seekabler/r0r*r6zBZ2File.seekables#7}}:4<<#8#8#::r,cP |j|jtkSr1)r3rrr/r0r*r5zBZ2File.readables#=   zzZ''r,cr7r1)r3rrr/r0r*writablezBZ2File.writables#=   zz[((r,rc^ |j|jj|Sr1)_check_can_readr%peek)r'Zn r*r;z BZ2File.peeks/ ||  ##r,cr9r1)r:r%rr'Zsizer<r*rz BZ2File.reads- ||  &&r,cs |j|dkrtj}|jj |S)Nr)r:r$ZDEFAULT_BUFFER_SIZEr%read1r>r<r*r?z BZ2File.read1sA  !88))D||!!$''r,cr9r1)r:r%readinto)r'br<r*r@zBZ2File.readintos-  ||$$Q''r,c t|ts,t|ds td|j }|j |j j|SN __index__zInteger argument expected)rintr r!rDr:r%readliner>r<r*rFzBZ2File.readlines_ $$$4-- ;<<>>#D ||$$T**r,crBrC)rrEr r!rDr:r% readlinesr>r<r*rGzBZ2File.readliness_ $$$4-- ;<<>>#D ||%%d++r,csF |jt|ttfrt |}nt |}|j }|jj|}|jj||xj|z c_ |Sr1) Z_check_can_writerrZ bytearrayZlenZ memoryviewZnbytesrrrrr&)r'dataZlengthZ compressed r*rz BZ2File.writes   dUI. / /YFFd#D[[F%%..t4  z"" V  r,csH tjj||Sr1)r" BaseStream writelines)r'Zseqr<r*rKzBZ2File.writeliness" &&11$<rPs  - - -5 ****** ////////   rrrrrl%%rrj-.-1''''T....r,