AlkantarClanX12

Your IP : 13.59.87.145


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/gzip.cpython-310.opt-2.pyc

o

6��fYU�@s	ddlZddlZddlZddlZddlZddlZddlZddlZgd�Zd\Z	Z
ZZZ
d\ZZdZdZdZdedddfd	d
�Zdd�ZGd
d�d�ZGdd�de�ZGdd�dej�ZGdd�dej�Zefdd�dd�Zdd�Zdd�Zedkre�dSdS)�N)�BadGzipFile�GzipFile�open�compress�
decompress)�����)rrr��	�rbcCs�	d|vrd|vrtd|f��n|durtd��|dur!td��|dur)td��|�dd�}t|tttjf�r?t|||�}nt|d�sIt|d	�rQtd|||�}nt	d
��d|vrft
�|�}t
�||||�S|S)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�
text_encoding�
TextIOWrapper)�filename�mode�
compresslevel�encoding�errors�newlineZgz_modeZbinary_file�r&�+/opt/alt/python310/lib64/python3.10/gzip.pyrs*�
rcCs|�t�d|��dS)Nz<L)r�structZpack)�output�valuer&r&r'�write32uFsr+c@s:eZdZ	d
dd�Zdd�Zd
dd�Zdd	�Zd
d�ZdS)�_PaddedFile�cCs ||_t|�|_||_d|_dS�Nr)�_buffer�len�_length�file�_read)�self�f�prependr&r&r'�__init__Ps

z_PaddedFile.__init__cCsz|jdur|j�|�S|j||jkr%|j}|j|7_|j||j�S|j}d|_|j|d�|j�||j|�S�N)r3r2rr1r/)r4�sizerr&r&r'rVs
�z_PaddedFile.readcCs>|jdur	||_n|jt|�8_dSt|j�|_d|_dSr.)r3r/r0r1)r4r6r&r&r'r6cs

z_PaddedFile.prependcCsd|_d|_|j�|�Sr8)r3r/r2�seek)r4Zoffr&r&r'r:lsz_PaddedFile.seekcC�dS�NTr&�r4r&r&r'�seekableq�z_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@s�eZdZ	dZddeddfdd�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	CsX	|rd|vsd|vrtd�|���|rd|vr|d7}|dur+t�||p&d�}|_|dur?t|dd�}t|ttf�s>d}nt	�
|�}|}|durPt|dd�}|�d	�rft|_
t|�}t�|�|_||_n5|�d
�r�|durzddl}|�dtd
�t|_
|�|�t�|tjtjtjd�|_||_ntd�|���||_|j
tkr�|� |�dSdS)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/rD�warnings�warn�
FutureWarning�WRITE�_init_write�zlibZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�_write_mtime�fileobj�_write_gzip_header)	r4r r!r"rZ�mtimeZorigmode�rawrRr&r&r'r7�sT!�


�
�
�zGzipFile.__init__cCsBddl}|�dtd�|jtkr|jdd�dkr|jdS|jS)Nrzuse the name attributer����.gz)rRrS�DeprecationWarningr!rUrD)r4rRr&r&r'r �s

zGzipFile.filenamecCs	|jjjSr8)r/r]�_last_mtimer=r&r&r'r\�s
zGzipFile.mtimecCs.t|j�}d|dd�dtt|��dS)Nz<gzip r���� �>)�reprrZ�hex�id)r4�sr&r&r'�__repr__�s
$zGzipFile.__repr__cCs.||_t�d�|_d|_g|_d|_d|_dS�Nr-r)rDrW�crc32�crcr9Zwritebuf�bufsize�offset)r4r r&r&r'rV�s
zGzipFile._init_writecCs|j�d�|j�d�ztj�|j�}t|t�s|�d�}|�	d�r)|dd�}Wnt
y5d}Ynwd}|r<t}|j�t|��d��|j
}|durRt��}t|jt|��|tkrad}n	|tkrhd	}nd
}|j�|�|j�d�|r�|j�|d
�dSdS)N���zlatin-1s.gzr^r-r�����)rZrr�path�basenamerDrr�encode�endswith�UnicodeEncodeError�FNAME�chrrY�timer+�int�_COMPRESS_LEVEL_BEST�_COMPRESS_LEVEL_FAST)r4r"Zfname�flagsr\Zxflr&r&r'r[�s<


���zGzipFile._write_gzip_headercCs�|��|jtkrddl}t|jd��|jdurtd��t|t	t
f�r(t|�}nt|�}|j
}|dkrS|j�|j�|��|j|7_t�||j�|_|j|7_|S)Nrz$write() on read-only GzipFile objectz!write() on closed GzipFile object)�_check_not_closedr!rU�errno�OSError�EBADFrZrrr�	bytearrayr0�
memoryview�nbytesrrr9rWrkrlrn)r4�datar�Zlengthr&r&r'rs 


zGzipFile.writerbcC�2|��|jtkrddl}t|jd��|j�|�S)Nrz$read() on write-only GzipFile object)r�r!rOr�r�r�r/r�r4r9r�r&r&r'r(�

z
GzipFile.readcCsB	|��|jtkrddl}t|jd��|dkrtj}|j�	|�S)Nrz%read1() on write-only GzipFile object)
r�r!rOr�r�r�r�DEFAULT_BUFFER_SIZEr/�read1r�r&r&r'r�/s
zGzipFile.read1cCr�)Nrz$peek() on write-only GzipFile object)r�r!rOr�r�r�r/�peek)r4�nr�r&r&r'r�<r�z
GzipFile.peekcCs
|jduSr8�rZr=r&r&r'�closedCs
zGzipFile.closedcCs�|j}|dur	dSd|_z7|jtkr)|�|j���t||j�t||jd@�n
|jt	kr3|j
��W|j}|rBd|_|��dSdS|j}|rQd|_|��ww)N���)
rZr!rUrr�flushr+rlr9rOr/�closerK)r4rZrKr&r&r'r�Gs,


���
�zGzipFile.closecCs8|��|jtkr|j�|j�|��|j��dSdSr8)r�r!rUrZrrr�)r4Z	zlib_moder&r&r'r�Zs

�zGzipFile.flushcCs	|j��Sr8)rZ�filenor=r&r&r'r�as
zGzipFile.filenocCs$	|jtkr
td��|j�d�dS)NzCan't rewind in write moder)r!rOr�r/r:r=r&r&r'�rewindis
zGzipFile.rewindcC�
|jtkSr8)r!rOr=r&r&r'�readablep�
zGzipFile.readablecCr�r8)r!rUr=r&r&r'�writablesr�zGzipFile.writablecCr;r<r&r=r&r&r'r>vr?zGzipFile.seekablecCs�|jtkrC|tjkr|tjkr|j|}ntd��||jkr"td��||j}d}t|d�D]}|�	|�q/|�	d|d�|jS|jt
krS|��|j�
||�S|jS)NzSeek from end not supportedzNegative seek in write modesirs)r!rUr�SEEK_SET�SEEK_CURrnrr��rangerrOr�r/r:)r4rn�whence�count�chunk�ir&r&r'r:ys"





�z
GzipFile.seekcCs|��|j�|�Sr8)r�r/�readline)r4r9r&r&r'r��szGzipFile.readline�rb)r@rArBrKr~r7�propertyr r\rirVr[rrr�r�r�r�rWZZ_SYNC_FLUSHr�r�r�r�r�r>rr�r:r�r&r&r&r'rys8

�Q

 



rcsZeZdZ�fdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	�fdd�Z
�ZS)rPcs,t�jt|�tjtjd�d|_d|_dS)N)ZwbitsT)�superr7r,rWZ
decompressobjrX�_new_memberra)r4�fp��	__class__r&r'r7�s
�
z_GzipReader.__init__cCst�d�|_d|_dSrj)rWrk�_crc�_stream_sizer=r&r&r'�
_init_read�s
z_GzipReader._init_readcCsR	|j�|�}t|�|kr'|j�|t|��}|std��||7}t|�|ks
|S)N�ACompressed file ended before the end-of-stream marker was reached)�_fprr0�EOFError)r4r�r�rr&r&r'�_read_exact�s�z_GzipReader._read_exactcCs�|j�d�}|dkrdS|dkrtd|��t�d|�d��\}}|_|dkr+td��|t@r>t�d	|�d��\}|�|�|t@rQ	|j�d�}|rO|dkrPnqC|t	@rd	|j�d�}|rb|dkrcnqV|t
@rm|�d�d
S)
Nrr-FrozNot a gzipped file (%r)z<BBIxxr
zUnknown compression methodz<HTrrs)r�rrr(�unpackr�ra�FEXTRArz�FCOMMENT�FHCRC)r4�magic�method�flagZ	extra_lenrhr&r&r'�_read_gzip_header�s8�
��
z_GzipReader._read_gzip_headerrbcCs�|dkr|��S|sdS	|jjr"|��d|_|jdi|j��|_|jr6|��|��s3|j	|_
dSd|_|j�t
j�}|j�||�}|jjdkrS|j�|jj�n|jjdkra|j�|jj�|dkrfn	|dkrntd��q
|�|�|j	t|�7_	|S)Nrr-TFr�r&)�readallZ
_decompressor�eof�	_read_eofr�Z_decomp_factoryZ_decomp_argsr�r�Z_posZ_sizer�rrr�rZunconsumed_tailr6Zunused_datar��_add_read_datar0)r4r9�bufZ
uncompressr&r&r'r�s>��
%z_GzipReader.readcCs$t�||j�|_|jt|�|_dSr8)rWrkr�r�r0)r4r�r&r&r'r�sz_GzipReader._add_read_datacCs�t�d|�d��\}}||jkrtdt|�t|j�f��||jd@kr(td��d}|dkr8|j�d�}|dks.|rB|j�	|�dSdS)Nz<IIr
zCRC check failed %s != %sr�z!Incorrect length of data producedrsr)
r(r�r�r�rrfr�r�rr6)r4rkZisize�cr&r&r'r�s

���z_GzipReader._read_eofcst���d|_dSr<)r��_rewindr�r=r�r&r'r�s

z_GzipReader._rewindr�)r@rArBr7r�r�r�rr�r�r��
__classcell__r&r&r�r'rP�s
!3rP)r\cCsR	t��}t|d||d��}|�|�Wd�|��S1s wY|��S)N�wb)rZr!r"r\)r�BytesIOrr�getvalue)r�r"r\r�r5r&r&r'rs
��rcCs>	tt�|�d��}|��Wd�S1swYdS)Nr�)rrr�r)r�r5r&r&r'r(s$�rc	Cs�ddlm}|dd�}|��}|jdddd�|jd	dd
d�|jdddd
d�|jdddgdd�|��}t}|jr>t}n|jrCt	}|j
D]{}|jr}|dkr]tddt
jjd�}t
jj}n@|dd�dkrmt
�d|���t|d�}t�|dd�d�}n |dkr�t
jj}tddt
jj|d�}n
t�|d�}t|dd�}	|�tj�}|s�n|�|�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)�action�helpz--bestzcompress betterz-dz--decompresszact like gunzip instead of gzip�args�*�-r2)�nargs�default�metavarrr)r r!rZr^r_zfilename doesn't end in .gz: r�)r r!rZr")�argparser�Zadd_mutually_exclusive_group�add_argument�
parse_args�_COMPRESS_LEVEL_TRADEOFFZfastrZbestr~r�rr�sys�stdin�buffer�stdout�exitrrJrrr�rr�)	r��parser�groupr�r"�argr5�gr�r&r&r'�main0sZ�
�


�
���r��__main__) r(r�r|rrWrJrZ_compression�__all__ZFTEXTr�r�rzr�rOrUrr�r~rr+r,r�rZ
BaseStreamrZDecompressReaderrPrrr�r@r&r&r&r'�<module>s: 
�-*	0
�