o ?OgYU@s ddlZddlZddlZddlZddlZddlZddlZddlZgdZd\Z Z Z Z Z d\ZZdZdZdZdedddfd d Zd d ZGd ddZGdddeZGdddejZGdddejZefddddZddZddZedkredSdS)N) BadGzipFileGzipFileopencompress decompress))rrr rbcCs d|vrd|vrtd|fn|durtd|dur!td|dur)td|dd}t|tttjfr?t|||}nt|dsIt|d rQtd|||}nt d d|vrft |}t ||||S|S) NtbzInvalid mode: %rz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary modereadwritez1filename must be a str or bytes object, or a file) ValueErrorreplace isinstancestrbytesosPathLikerhasattr TypeErrorio text_encoding TextIOWrapper)filenamemode compresslevelencodingerrorsnewlineZgz_modeZ binary_filer&+/opt/alt/python310/lib64/python3.10/gzip.pyrs*  rcCs|td|dS)Nz|jdur ||_n |jt|8_dSt|j|_d|_dSr.)r3r/r0r1)r4r6r&r&r'r6cs   z_PaddedFile.prependcCsd|_d|_|j|Sr8)r3r/r2seek)r4Zoffr&r&r'r:ls z_PaddedFile.seekcCdSNTr&r4r&r&r'seekableqz_PaddedFile.seekableN)r-)__name__ __module__ __qualname__r7rr6r:r>r&r&r&r'r,Ks   r,c@s eZdZdS)rN)r@rArBr&r&r&r'rusrc@seZdZ dZddeddfddZeddZeddZdd Z d d Z d d Z ddZ d+ddZ d+ddZddZeddZddZejfddZddZdd Zd!d"Zd#d$Zd%d&Zejfd'd(Zd+d)d*ZdS),rNc CsX |rd|vs d|vrtd||rd|vr|d7}|dur+t||p&d}|_|dur?t|dd}t|ttfs>d}nt |}|}|durPt|dd}| d rft |_ t|}t||_||_n5| d r|durzd dl}|d td t|_ ||t|tjtj tjd |_||_ntd|||_|j tkr| |dSdS)NrUzInvalid mode: {!r}rrnamerr!r)waxrzGzipFile was opened for writing, but this will change in future Python releases. Specify the mode argument for opening it for writing.r)!rformatbuiltinsr myfileobjgetattrrrrrfspath startswithREADr! _GzipReaderrBufferedReaderr/rDwarningswarn FutureWarningWRITE _init_writezlibZ compressobjZDEFLATED MAX_WBITSZ DEF_MEM_LEVELr _write_mtimefileobj_write_gzip_header) r4r r!r"rZmtimeZorigmoderawrRr&r&r'r7sT!         zGzipFile.__init__cCsBddl}|dtd|jtkr|jdddkr|jdS|jS)Nrzuse the name attributer.gz)rRrSDeprecationWarningr!rUrD)r4rRr&r&r'r s  zGzipFile.filenamecCs |jjjSr8)r/r] _last_mtimer=r&r&r'r\s zGzipFile.mtimecCs.t|j}d|dddtt|dS)Nz)reprrZhexid)r4sr&r&r'__repr__s $zGzipFile.__repr__cCs.||_td|_d|_g|_d|_d|_dSNr-r)rDrWcrc32crcr9Zwritebufbufsizeoffset)r4r r&r&r'rVs   zGzipFile._init_writecCs|jd|jdztj|j}t|ts|d}| dr)|dd}Wn t y5d}Ynwd}|rvr?zGzipFile.seekablecCs|jtkrC|tjkr|tjkr|j|}ntd||jkr"td||j}d}t|dD]}| |q/| d|d|jS|jt krS| |j ||S|jS)NzSeek from end not supportedzNegative seek in write modesirs)r!rUrSEEK_SETSEEK_CURrnrrrangerrOrr/r:)r4rnwhencecountchunkir&r&r'r:ys"        z GzipFile.seekcCs||j|Sr8)rr/readline)r4r9r&r&r'rs zGzipFile.readlinerb)r@rArBrKr~r7propertyr r\rirVr[rrrrrrrWZ Z_SYNC_FLUSHrrrrrr>rrr:rr&r&r&r'rys8  Q      rcsZeZdZfddZddZddZddZdd d Zd d ZddZ fddZ Z S)rPcs,tjt|tjtj dd|_d|_dS)N)ZwbitsT)superr7r,rWZ decompressobjrX _new_memberra)r4fp __class__r&r'r7s  z_GzipReader.__init__cCstd|_d|_dSrj)rWrk_crc _stream_sizer=r&r&r' _init_reads  z_GzipReader._init_readcCsR |j|}t||kr'|j|t|}|std||7}t||ks |S)NACompressed file ended before the end-of-stream marker was reached)_fprr0EOFError)r4rrrr&r&r' _read_exacts   z_GzipReader._read_exactcCs|jd}|dkr dS|dkrtd|td|d\}}|_|dkr+td|t@r>td |d\}|||t@rQ |jd }|rO|d krPnqC|t @rd |jd }|rb|d krcnqV|t @rm|dd S) Nrr-FrozNot a gzipped file (%r)z   %z_GzipReader.readcCs$t||j|_|jt||_dSr8)rWrkrrr0)r4rr&r&r'rsz_GzipReader._add_read_datacCstd|d\}}||jkrtdt|t|jf||jd@kr(tdd}|dkr8|jd}|dks.|rB|j |dSdS)Nz tt|d }|WdS1swYdS)Nr)rrrr)rr5r&r&r'r(s$rc Csddlm}|dd}|}|jdddd|jd dd d|jd d dd d|jdddgdd|}t}|jr>t}n|jrCt }|j D]{}|j r}|dkr]t ddt jjd}t jj}n@|dddkrmt d|t|d}t|ddd}n |dkrt jj}t ddt jj|d}n t|d}t|dd} |tj}|sn||q|t jjur||t jjur|qFdS)Nr)ArgumentParserzeA simple command line interface for the gzip module: act like gzip, but do not delete the input file.) descriptionz--fast store_truezcompress faster)actionhelpz--bestzcompress betterz-dz --decompresszact like gunzip instead of gzipargs*-r2)nargsdefaultmetavarrr)r r!rZr^r_zfilename doesn't end in .gz: r)r r!rZr")argparserZadd_mutually_exclusive_group add_argument parse_args_COMPRESS_LEVEL_TRADEOFFZfastrZbestr~rrrsysstdinbufferstdoutexitrrJrrrrr) rparsergrouprr"argr5grr&r&r'main0sZ           r__main__) r(rr|rrWrJrZ _compression__all__ZFTEXTrrrzrrOrUrrr~rr+r,rrZ BaseStreamrZDecompressReaderrPrrrr@r&r&r&r's:  -* 0