Hacked By AnonymousFox

Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/gzip.cpython-39.opt-2.pyc

a

���eU�@s�ddlZddlZddlZddlZddlZddlZddlZddlZgd�Zd\Z	Z
ZZZ
d\ZZdZdZdZdedddfd	d
�Zdd�ZGd
d�d�ZGdd�de�ZGdd�dej�ZGdd�dej�Zefdd�dd�Zdd�Zdd�Zedkr�e�dS)�N)�BadGzipFile�GzipFile�open�compress�
decompress)�����)rrr��	�rbcCs�d|vr d|vrPtd|f��n0|dur0td��|dur@td��|durPtd��|�dd�}t|tttjf�r|t|||�}n,t|d�s�t|d	�r�td|||�}nt	d
��d|vr�t
�||||�S|SdS)N�t�bzInvalid mode: %rz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode��read�writez1filename must be a str or bytes object, or a file)�
ValueError�replace�
isinstance�str�bytes�os�PathLiker�hasattr�	TypeError�io�
TextIOWrapper)�filename�mode�
compresslevel�encoding�errors�newlineZgz_modeZbinary_file�r%�)/opt/alt/python39/lib64/python3.9/gzip.pyrs$rcCs|�t�d|��dS)Nz<L)r�structZpack)�output�valuer%r%r&�write32uEsr*c@s8eZdZd
dd�Zdd�Zddd�Zdd	�Zd
d�ZdS)�_PaddedFile�cCs ||_t|�|_||_d|_dS�Nr)�_buffer�len�_length�file�_read)�self�f�prependr%r%r&�__init__Os
z_PaddedFile.__init__cCs~|jdur|j�|�S|j||jkrJ|j}|j|7_|j||j�S|j}d|_|j|d�|j�||j|�SdS�N)r2r1rr0r.)r3�sizerr%r%r&rUs
�z_PaddedFile.readcCs>|jdur||_n|jt|�8_dSt|j�|_d|_dSr-)r2r.r/r0)r3r5r%r%r&r5bs
z_PaddedFile.prependcCsd|_d|_|j�|�Sr7)r2r.r1�seek)r3Zoffr%r%r&r9ksz_PaddedFile.seekcCsdS�NTr%�r3r%r%r&�seekablepsz_PaddedFile.seekableN)r,)r,)�__name__�
__module__�__qualname__r6rr5r9r<r%r%r%r&r+Js


	r+c@seZdZdS)rN)r=r>r?r%r%r%r&rtsrc@s�eZdZdZddeddfdd�Zedd��Zedd��Zdd	�Z	d
d�Z
dd
�Zdd�Zd+dd�Z
d,dd�Zdd�Zedd��Zdd�Zejfdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zejfd'd(�Zd-d)d*�ZdS).rNc	CsV|r"d|vsd|vr"td�|���|r6d|vr6|d7}|durTt�||pJd�}|_|dur|t|dd�}t|ttf�s�d}n
t	�
|�}|}|dur�t|dd�}|�d	�r�t|_
t|�}t�|�|_||_nl|�d
��r(|dur�ddl}|�dtd
�t|_
|�|�t�|tjtjtjd�|_||_ntd�|���||_|j
tk�rR|� |�dS)Nr�UzInvalid mode: {!r}rr�namerr �r)�w�a�xrz�GzipFile was opened for writing, but this will change in future Python releases.  Specify the mode argument for opening it for writing.r)!r�format�builtinsr�	myfileobj�getattrrrrr�fspath�
startswith�READr �_GzipReaderr�BufferedReaderr.rA�warnings�warn�
FutureWarning�WRITE�_init_write�zlibZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�_write_mtime�fileobj�_write_gzip_header)	r3rr r!rW�mtimeZorigmode�rawrOr%r%r&r6�sN#

�
�zGzipFile.__init__cCsBddl}|�dtd�|jtkr<|jdd�dkr<|jdS|jS)Nrzuse the name attributer����.gz)rOrP�DeprecationWarningr rRrA)r3rOr%r%r&r�s

zGzipFile.filenamecCs
|jjjSr7)r.rZ�_last_mtimer;r%r%r&rY�szGzipFile.mtimecCs.t|j�}d|dd�dtt|��dS)Nz<gzip r���� �>)�reprrW�hex�id)r3�sr%r%r&�__repr__�s
zGzipFile.__repr__cCs.||_t�d�|_d|_g|_d|_d|_dS�Nr,r)rArT�crc32�crcr8Zwritebuf�bufsize�offset)r3rr%r%r&rS�szGzipFile._init_writecCs|j�d�|j�d�z<tj�|j�}t|t�s<|�d�}|�	d�rR|dd�}Wnt
yjd}Yn0d}|rxt}|j�t|��d��|j
}|dur�t��}t|jt|��|tkr�d}n|tkr�d	}nd
}|j�|�|j�d�|�r|j�|d
�dS)N���zlatin-1s.gzr[r,r�����)rWrr�path�basenamerArr�encode�endswith�UnicodeEncodeError�FNAME�chrrV�timer*�int�_COMPRESS_LEVEL_BEST�_COMPRESS_LEVEL_FAST)r3r!Zfname�flagsrYZxflr%r%r&rX�s6



zGzipFile._write_gzip_headercCs�|��|jtkr&ddl}t|jd��|jdur8td��t|t	�rLt
|�}nt|�}|j}|dkr�|j�
|j�|��|j|7_t�||j�|_|j|7_|S)Nrz$write() on read-only GzipFile objectz!write() on closed GzipFile object)�_check_not_closedr rR�errno�OSError�EBADFrWrrrr/�
memoryview�nbytesrrr8rTrhrirk)r3�datarZlengthr%r%r&rs 



zGzipFile.writer_cCs2|��|jtkr&ddl}t|jd��|j�|�S)Nrz$read() on write-only GzipFile object)r~r rLrr�r�r.r�r3r8rr%r%r&r's

z
GzipFile.readcCs@|��|jtkr&ddl}t|jd��|dkr4tj}|j�	|�S)Nrz%read1() on write-only GzipFile object)
r~r rLrr�r�r�DEFAULT_BUFFER_SIZEr.�read1r�r%r%r&r�.s
zGzipFile.read1cCs2|��|jtkr&ddl}t|jd��|j�|�S)Nrz$peek() on write-only GzipFile object)r~r rLrr�r�r.�peek)r3�nrr%r%r&r�;s

z
GzipFile.peekcCs
|jduSr7�rWr;r%r%r&�closedBszGzipFile.closedcCs�|j}|durdSd|_zh|jtkrR|�|j���t||j�t||jd@�n|jt	krf|j
��W|j}|r�d|_|��n|j}|r�d|_|��0dS)N���)
rWr rRrr�flushr*rir8rLr.�closerH)r3rWrHr%r%r&r�Fs&


�zGzipFile.closecCs4|��|jtkr0|j�|j�|��|j��dSr7)r~r rRrWrrr�)r3Z	zlib_moder%r%r&r�Ys
zGzipFile.flushcCs
|j��Sr7)rW�filenor;r%r%r&r�`szGzipFile.filenocCs"|jtkrtd��|j�d�dS)NzCan't rewind in write moder)r rLr�r.r9r;r%r%r&�rewindhs
zGzipFile.rewindcCs
|jtkSr7)r rLr;r%r%r&�readableoszGzipFile.readablecCs
|jtkSr7)r rRr;r%r%r&�writablerszGzipFile.writablecCsdSr:r%r;r%r%r&r<uszGzipFile.seekablecCs�|jtkr�|tjkr2|tjkr*|j|}ntd��||jkrDtd��||j}d}t|d�D]}|�	|�q^|�	d|d�n |jt
kr�|��|j�
||�S|jS)NzSeek from end not supportedzNegative seek in write modes�rp)r rRr�SEEK_SET�SEEK_CURrkrr��rangerrLr~r.r9)r3rk�whence�count�chunk�ir%r%r&r9xs 





z
GzipFile.seekcCs|��|j�|�Sr7)r~r.�readline)r3r8r%r%r&r��szGzipFile.readline)r_)r_)r_)r=r>r?rHr{r6�propertyrrYrfrSrXrrr�r�r�r�rTZZ_SYNC_FLUSHr�r�r�r�r�r<rr�r9r�r%r%r%r&rxs4�
Q

 



rcsZeZdZ�fdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	�fdd�Z
�ZS)rMcs,t�jt|�tjtjd�d|_d|_dS)N)ZwbitsT)�superr6r+rTZ
decompressobjrU�_new_memberr^)r3�fp��	__class__r%r&r6�s
�z_GzipReader.__init__cCst�d�|_d|_dSrg)rTrh�_crc�_stream_sizer;r%r%r&�
_init_read�sz_GzipReader._init_readcCsF|j�|�}t|�|krB|j�|t|��}|s8td��||7}q|S)N�ACompressed file ended before the end-of-stream marker was reached)�_fprr/�EOFError)r3r�r�rr%r%r&�_read_exact�s
z_GzipReader._read_exactcCs�|j�d�}|dkrdS|dkr,td|��t�d|�d��\}}|_|dkrVtd��|t@r|t�d	|�d��\}|�|�|t@r�|j�d
�}|r�|dkr�q�q�|t	@r�|j�d
�}|r�|dkr�q�q�|t
@r�|�d�dS)
Nrr,FrlzNot a gzipped file (%r)z<BBIxxr
zUnknown compression methodz<HrrpT)r�rrr'�unpackr�r^�FEXTRArw�FCOMMENT�FHCRC)r3�magic�method�flagZ	extra_lenrer%r%r&�_read_gzip_header�s0�

z_GzipReader._read_gzip_headerr_cCs�|dkr|��S|sdS|jjrB|��d|_|jfi|j��|_|jrj|��|��sd|j	|_
dSd|_|j�t
j�}|j�||�}|jjdkr�|j�|jj�n|jjdkr�|j�|jj�|dkr�q�|dkrtd��q|�|�|j	t|�7_	|S)Nrr,TFr�)�readallZ
_decompressor�eof�	_read_eofr�Z_decomp_factoryZ_decomp_argsr�r�Z_posZ_sizer�rrr�rZunconsumed_tailr5Zunused_datar��_add_read_datar/)r3r8�bufZ
uncompressr%r%r&r�s:�

z_GzipReader.readcCs$t�||j�|_|jt|�|_dSr7)rTrhr�r�r/)r3r�r%r%r&r�sz_GzipReader._add_read_datacCs�t�d|�d��\}}||jkr<tdt|�t|j�f��n||jd@krRtd��d}|dkrl|j�d�}qV|r||j�	|�dS)Nz<IIr
zCRC check failed %s != %sr�z!Incorrect length of data producedrpr)
r'r�r�r�rrcr�r�rr5)r3rhZisize�cr%r%r&r�s

�
z_GzipReader._read_eofcst���d|_dSr:)r��_rewindr�r;r�r%r&r�s
z_GzipReader._rewind)r_)r=r>r?r6r�r�r�rr�r�r��
__classcell__r%r%r�r&rM�s!
3rM)rYcCsJt��}t|d||d��}|�|�Wd�n1s80Y|��S)N�wb)rWr r!rY)r�BytesIOrr�getvalue)r�r!rYr�r4r%r%r&rs(rcCs<tt�|�d��}|��Wd�S1s.0YdS)Nr�)rrr�r)r�r4r%r%r&r'src	Cs�ddlm}|dd�}|��}|jdddd�|jd	dd
d�|jdddd
d�|jdddgdd�|��}t}|jr|t}n
|jr�t	}|j
D]�}|jr�|dkr�tddt
jjd�}t
jj}n>|dd�dkr�t
�d|���t|d�}t�|dd�d�}nB|dk�r"t
jj}tddt
jj|d�}nt�|d�}t|dd�}|�d�}|�sP�q^|�|��q<|t
jju�rt|��|t
jjur�|��q�dS)Nr)�ArgumentParserzeA simple command line interface for the gzip module: act like gzip, but do not delete the input file.)Zdescriptionz--fast�
store_truezcompress faster)�action�helpz--bestzcompress betterz-dz--decompresszact like gunzip instead of gzip�args�*�-r1)�nargs�default�metavarrr)rr rWr[r\zfilename doesn't end in .gz: r�)rr rWr!r�)�argparser�Zadd_mutually_exclusive_group�add_argument�
parse_args�_COMPRESS_LEVEL_TRADEOFFZfastr|Zbestr{r�rr�sys�stdin�buffer�stdout�exitrrGrrr�)	r��parser�groupr�r!�argr4�gr�r%r%r&�main/sR�
�



�
r��__main__) r'r�ryrrTrGrZ_compression�__all__ZFTEXTr�r�rwr�rLrRr|r�r{rr*r+r�rZ
BaseStreamrZDecompressReaderrMrrr�r=r%r%r%r&�<module>s4 �
,*	0

Hacked By AnonymousFox1.0, Coded By AnonymousFox