eaiovnaovbqoebvqoeavibavo B YI~dP@sddlZddlZddlZddlZddlZddlZddlZddlZddddgZd\Z Z Z Z Z d\ZZdZd Zd Zdd dZd dZGdddZGdddejZGdddejZdddZddZddZedkredS)NGzipFileopencompress decompress))rrr rbcCsd|kr d|krPtd|fn0|dk r0td|dk r@td|dk rPtd|dd}t|tttjfr|t|||}n,t|dst|d rtd|||}nt d d|krt ||||S|SdS) 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 TextIOWrapper)filenamemode compresslevelencodingerrorsnewlineZgz_modeZ binary_filer$)/opt/alt/python37/lib64/python3.7/gzip.pyrs$ cCs|td|dS)Nz|jdkr||_n|jt|8_dSt|j|_d|_dS)Nr)r1r-r.r/)r2r4r$r$r%r4bs   z_PaddedFile.prependcCsd|_d|_|j|S)N)r1r-r0seek)r2Zoffr$r$r%r7ksz_PaddedFile.seekcCsdS)NTr$)r2r$r$r%seekablepsz_PaddedFile.seekableN)r,)r,)__name__ __module__ __qualname__r5rr4r7r8r$r$r$r%r+Js   r+c@seZdZdZd,ddZeddZeddZd d Zd d Z d dZ ddZ d-ddZ d.ddZ ddZeddZddZejfddZddZd d!Zd"d#Zd$d%Zd&d'Zejfd(d)Zd/d*d+ZdS)0rNr cCs4|r"d|ksd|kr"td||r6d|kr6|d7}|dkrTt||pJd}|_|dkr|t|dd}t|ttfsd}n t |}|dkrt|dd}| d rt |_ t|}t||_||_nN| d rt|_ ||t|tjtj tjd |_||_ntd|||_|j tkr0||dS) NrUzInvalid mode: {!r}rr namerrr)waxr)rformatbuiltinsr myfileobjgetattrrrrrfspath startswithREADr _GzipReaderrBufferedReaderr-r=WRITE _init_writezlibZ compressobjZDEFLATED MAX_WBITSZ DEF_MEM_LEVELr _write_mtimefileobj_write_gzip_header)r2rrr rPmtimerawr$r$r%r5s>#         zGzipFile.__init__cCsBddl}|dtd|jtkr<|jdddkr<|jdS|jS)Nrzuse the name attributerz.gz)warningswarnDeprecationWarningrrKr=)r2rUr$r$r%rs  zGzipFile.filenamecCs |jjjS)N)r-rS _last_mtime)r2r$r$r%rRszGzipFile.mtimecCs.t|j}d|dddtt|dS)Nz)reprrPhexid)r2sr$r$r%__repr__s zGzipFile.__repr__cCs.||_td|_d|_g|_d|_d|_dS)Nr,r)r=rMcrc32crcr6Zwritebufbufsizeoffset)r2rr$r$r%rLs  zGzipFile._init_writecCs|jd|jdyt|d}t |ddd }n>|dkrtjj}tdd tjjd}nt |d}t|d d }x| d }|sP| |qW|tjjk r| |tjjk r>| q>WdS) Nrrz-d-rr )rrrPrTz.gzzfilename doesn't end in .gz:ri) sysargvrstdinbufferstdoutprintr\rrCrrr)argsrargr3grr$r$r%_test"s<       r__main__)r r NNN)r )r&rrqrrMrCrZ _compression__all__ZFTEXTrrrorrHrKrtZ_COMPRESS_LEVEL_TRADEOFFrsrr*r+Z BaseStreamrZDecompressReaderrIrrrr9r$r$r$r%s0   +) &