Hacked By AnonymousFox

Current Path : /usr/lib64/python3.8/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/__pycache__/gzip.cpython-38.opt-2.pyc

U

e5d�S�@sddlZddlZddlZddlZddlZddlZddlZddlZdddddgZd\Z	Z
ZZZ
d\ZZd	Zd
ZdZdedddfd
d�Zdd�ZGdd�d�ZGdd�de�ZGdd�dej�ZGdd�dej�Zefdd�dd�Zdd�Zdd�Zedkr�e�dS)�N�BadGzipFile�GzipFile�open�compress�
decompress)�����)rrr��	�rbcCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|�dd�}t|tttjf�r|t|||�}n,t|d�s�t|d	�r�td|||�}nt	d
��d|kr�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%�/usr/lib64/python3.8/gzip.pyrs$cCs|�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~|jdkr|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>|jdkr||_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&rtsc@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).rNcCs4|r"d|ksd|kr"td�|���|r6d|kr6|d7}|dkrTt�||pJd�}|_|dkr|t|dd�}t|ttf�s�d}n
t	�
|�}|dkr�t|dd�}|�d	�r�t|_
t|�}t�|�|_||_nN|�d
��rt|_
|�|�t�|tjtjtjd�|_||_ntd�|���||_|j
tk�r0|�|�dS)Nr�UzInvalid mode: {!r}rr�namerr �r)�w�a�xr)r�format�builtinsr�	myfileobj�getattrrrrr�fspath�
startswith�READr �_GzipReaderr�BufferedReaderr.rA�WRITE�_init_write�zlibZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�_write_mtime�fileobj�_write_gzip_header)r3rr r!rT�mtime�rawr%r%r&r6�s@#


�zGzipFile.__init__cCsBddl}|�dtd�|jtkr<|jdd�dkr<|jdS|jS)Nrzuse the name attributer����.gz)�warnings�warn�DeprecationWarningr rOrA)r3rZr%r%r&r�s

zGzipFile.filenamecCs
|jjjSr7)r.rW�_last_mtimer;r%r%r&rV�szGzipFile.mtimecCs.t|j�}d|dd�dtt|��dS)Nz<gzip r���� �>)�reprrT�hex�id)r3�sr%r%r&�__repr__�s
zGzipFile.__repr__cCs.||_t�d�|_d|_g|_d|_d|_dS�Nr,r)rArQ�crc32�crcr8Zwritebuf�bufsize�offset)r3rr%r%r&rP�szGzipFile._init_writecCs|j�d�|j�d�z<tj�|j�}t|t�s<|�d�}|�	d�rR|dd�}Wnt
k
rld}YnXd}|rzt}|j�t|��d��|j
}|dkr�t��}t|jt|��|tkr�d}n|tkr�d	}nd
}|j�|�|j�d�|�r|j�|d
�dS)N���zlatin-1s.gzrXr,r�����)rTrr�path�basenamerArr�encode�endswith�UnicodeEncodeError�FNAME�chrrS�timer*�int�_COMPRESS_LEVEL_BEST�_COMPRESS_LEVEL_FAST)r3r!Zfname�flagsrVZxflr%r%r&rU�s6



zGzipFile._write_gzip_headercCs�|��|jtkr&ddl}t|jd��|jdkr8td��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 rO�errno�OSError�EBADFrTrrrr/�
memoryview�nbytesrrr8rQrgrhrj)r3�datar~Zlengthr%r%r&rs 



zGzipFile.writer^cCs2|��|jtkr&ddl}t|jd��|j�|�S)Nrz$read() on write-only GzipFile object)r}r rLr~rr�r.r�r3r8r~r%r%r&rs

z
GzipFile.readcCs@|��|jtkr&ddl}t|jd��|dkr4tj}|j�	|�S)Nrz%read1() on write-only GzipFile object)
r}r rLr~rr�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 rLr~rr�r.�peek)r3�nr~r%r%r&r�3s

z
GzipFile.peekcCs
|jdkSr7�rTr;r%r%r&�closed:szGzipFile.closedcCs�|j}|dkrdSd|_zP|jtkrR|�|j���t||j	�t||j
d@�n|jtkrf|j��W5|j}|r�d|_|��XdS)N���)
rTrH�closer rOrr�flushr*rhr8rLr.)r3rTrHr%r%r&r�>s

zGzipFile.closecCs4|��|jtkr0|j�|j�|��|j��dSr7)r}r rOrTrrr�)r3Z	zlib_moder%r%r&r�Qs
zGzipFile.flushcCs
|j��Sr7)rT�filenor;r%r%r&r�XszGzipFile.filenocCs"|jtkrtd��|j�d�dS)NzCan't rewind in write moder)r rLrr.r9r;r%r%r&�rewind`s
zGzipFile.rewindcCs
|jtkSr7)r rLr;r%r%r&�readablegszGzipFile.readablecCs
|jtkSr7)r rOr;r%r%r&�writablejszGzipFile.writablecCsdSr:r%r;r%r%r&r<mszGzipFile.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�ro)r rOr�SEEK_SET�SEEK_CURrjrr�rangerrLr}r.r9)r3rj�whence�count�chunk�ir%r%r&r9ps 





z
GzipFile.seekcCs|��|j�|�Sr7)r}r.�readline)r3r8r%r%r&r��szGzipFile.readline)r^)r^)r^)r=r>r?rHrzr6�propertyrrVrerPrUrrr�r�r�r�rQZZ_SYNC_FLUSHr�r�r�r�r�r<rr�r9r�r%r%r%r&rxs8�
I

 



csZeZdZ�fdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	�fdd�Z
�ZS)rMcs,t�jt|�tjtjd�d|_d|_dS)N)ZwbitsT)�superr6r+rQZ
decompressobjrR�_new_memberr])r3�fp��	__class__r%r&r6�s
�z_GzipReader.__init__cCst�d�|_d|_dSrf)rQrg�_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,FrkzNot a gzipped file (%r)z<BBIxxr
zUnknown compression methodz<HrroT)r�rrr'�unpackr�r]�FEXTRArv�FCOMMENT�FHCRC)r3�magic�method�flagZ	extra_lenrdr%r%r&�_read_gzip_header�s0�

z_GzipReader._read_gzip_headerr^cCs�|dkr|��S|sdS|jjr>|��d|_|jf|j�|_|jrf|��|��s`|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)rQrgr�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 producedror)
r'r�r�r�rrbr�r�rr5)r3rgZisize�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)rVc	Cs6t��}t|d||d��}|�|�W5QRX|��S)N�wb)rTr r!rV)r�BytesIOrr�getvalue)r�r!rVr�r4r%r%r&rsc
Cs0tt�|�d��}|��W5QR�SQRXdS)Nr�)rrr�r)r�r4r%r%r&rsc	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
jjk	�rt|��|t
jjk	r�|��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 rTrXrYzfilename doesn't end in .gz: r�)rr rTr!r�)�argparser�Zadd_mutually_exclusive_group�add_argument�
parse_args�_COMPRESS_LEVEL_TRADEOFFZfastr{Zbestrzr�rr�sys�stdin�buffer�stdout�exitrrGrrr�)	r��parser�groupr�r!�argr4�gr�r%r%r&�main'sR�
�



�
r��__main__) r'r�rxrrQrGrZ_compression�__all__ZFTEXTr�r�rvr�rLrOr{r�rzrr*r+rrZ
BaseStreamrZDecompressReaderrMrrr�r=r%r%r%r&�<module>s8 �
,*	0

Hacked By AnonymousFox1.0, Coded By AnonymousFox