Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/gzip.cpython-37.opt-2.pyc

B

YI~d�P�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddddgZd\Z	Z
ZZZ
d\ZZdZd	Zd
Zddd�Zd
d�ZGdd�d�ZGdd�dej�ZGdd�dej�Zddd�Zdd�Zdd�Zedkr�e�dS)�N�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$�)/opt/alt/python37/lib64/python3.7/gzip.pyrs$cCs|�t�d|��dS)Nz<L)r�struct�pack)�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)r1r0rr/r-)r2�sizerr$r$r%rUs
z_PaddedFile.readcCs>|jdkr||_n|jt|�8_dSt|j�|_d|_dS)Nr)r1r-r.r/)r2r4r$r$r%r4bs
z_PaddedFile.prependcCsd|_d|_|j�|�S)N)r1r-r0�seek)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@s�eZdZdZd,dd�Zedd��Zedd��Zd	d
�Zdd�Z	d
d�Z
dd�Zd-dd�Zd.dd�Z
dd�Zedd��Zdd�Zejfdd�Zdd�Zd 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|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-r=�WRITE�_init_write�zlibZcompressobjZDEFLATED�	MAX_WBITSZ
DEF_MEM_LEVELr�_write_mtime�fileobj�_write_gzip_header)r2rrr rP�mtime�rawr$r$r%r5�s>#


zGzipFile.__init__cCsBddl}|�dtd�|jtkr<|jdd�dkr<|jdS|jS)Nrzuse the name attributer���z.gz)�warnings�warn�DeprecationWarningrrKr=)r2rUr$r$r%r�s

zGzipFile.filenamecCs
|jjjS)N)r-rS�_last_mtime)r2r$r$r%rR�szGzipFile.mtimecCs.t|j�}d|dd�dtt|��dS)Nz<gzip r���� �>)�reprrP�hex�id)r2�sr$r$r%�__repr__�s
zGzipFile.__repr__cCs.||_t�d�|_d|_g|_d|_d|_dS)Nr,r)r=rM�crc32�crcr6Zwritebuf�bufsize�offset)r2rr$r$r%rL�szGzipFile._init_writecCs|j�d�|j�d�y<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)Ns��zlatin-1s.gzrTr,r�����)rPrr�path�basenamer=rr�encode�endswith�UnicodeEncodeError�FNAME�chrrO�timer*�int�_COMPRESS_LEVEL_BEST�_COMPRESS_LEVEL_FAST)r2r Zfname�flagsrRZxflr$r$r%rQ�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_closedrrK�errno�OSError�EBADFrPrrrr.�
memoryview�nbytesrrr6rMrarbrd)r2�datarw�lengthr$r$r%rs 



zGzipFile.writerYcCs2|��|jtkr&ddl}t|jd��|j�|�S)Nrz$read() on write-only GzipFile object)rvrrHrwrxryr-r)r2r6rwr$r$r%rs

z
GzipFile.readcCs@|��|jtkr&ddl}t|jd��|dkr4tj}|j�	|�S)Nrz%read1() on write-only GzipFile object)
rvrrHrwrxryr�DEFAULT_BUFFER_SIZEr-�read1)r2r6rwr$r$r%r!s
zGzipFile.read1cCs2|��|jtkr&ddl}t|jd��|j�|�S)Nrz$peek() on write-only GzipFile object)rvrrHrwrxryr-�peek)r2�nrwr$r$r%r�.s

z
GzipFile.peekcCs
|jdkS)N)rP)r2r$r$r%�closed5szGzipFile.closedcCs�|j}|dkrdSd|_zP|jtkrR|�|j���t||j�t||jd@�n|jt	krf|j
��Wd|j}|r�d|_|��XdS)Nl��)
rPrrKrr�flushr*rbr6rHr-�closerD)r2rPrDr$r$r%r�9s

zGzipFile.closecCs4|��|jtkr0|j�|j�|��|j��dS)N)rvrrKrPrrr�)r2Z	zlib_moder$r$r%r�Ls
zGzipFile.flushcCs
|j��S)N)rP�fileno)r2r$r$r%r�SszGzipFile.filenocCs"|jtkrtd��|j�d�dS)NzCan't rewind in write moder)rrHrxr-r7)r2r$r$r%�rewind[s
zGzipFile.rewindcCs
|jtkS)N)rrH)r2r$r$r%�readablebszGzipFile.readablecCs
|jtkS)N)rrK)r2r$r$r%�writableeszGzipFile.writablecCsdS)NTr$)r2r$r$r%r8hszGzipFile.seekablecCs�|jtkr�|tjkr2|tjkr*|j|}ntd��||jkrDtd��||j}d}xt|d�D]}|�	|�q`W|�	d|d�n |jt
kr�|��|j�
||�S|jS)NzSeek from end not supportedzNegative seek in write modesirh)rrKr�SEEK_SET�SEEK_CURrdrrx�rangerrHrvr-r7)r2rd�whence�count�chunk�ir$r$r%r7ks 





z
GzipFile.seekcCs|��|j�|�S)N)rvr-�readline)r2r6r$r$r%r�szGzipFile.readline)NNrNN)rY)rY)rY)r9r:r;rDr5�propertyrrRr`rLrQrrrr�r�r�rMZZ_SYNC_FLUSHr�r�r�r�r�r8rr�r7r�r$r$r$r%rss,
H 


csZeZdZ�fdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	�fdd�Z
�ZS)rIcs,t�jt|�tjtjd�d|_d|_dS)N)ZwbitsT)�superr5r+rMZ
decompressobjrN�_new_memberrX)r2�fp)�	__class__r$r%r5�sz_GzipReader.__init__cCst�d�|_d|_dS)Nr,r)rMra�_crc�_stream_size)r2r$r$r%�
_init_read�sz_GzipReader._init_readcCsJ|j�|�}x8t|�|krD|j�|t|��}|s:td��||7}qW|S)NzACompressed file ended before the end-of-stream marker was reached)�_fprr.�EOFError)r2r�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�x|j�d
�}|r�|dkr�Pq�W|t	@r�x|j�d
�}|r�|dkr�Pq�W|t
@r�|�d�dS)
Nrr,Fs�zNot a gzipped file (%r)z<BBIxxr	zUnknown compression methodz<HrrhT)r�rrxr&�unpackr�rX�FEXTRAro�FCOMMENT�FHCRC)r2�magic�method�flagZ	extra_lenr_r$r$r%�_read_gzip_header�s0

z_GzipReader._read_gzip_headerrYcCs�|dkr|��S|sdSx�|jjr@|��d|_|jf|j�|_|jrh|��|��sb|j	|_
dSd|_|j�t
j�}|j�||�}|jjdkr�|j�|jj�n|jjdkr�|j�|jj�|dkr�P|dkrtd��qW|�|�|j	t|�7_	|S)Nrr,TFzACompressed file ended before the end-of-stream marker was reached)�readallZ
_decompressor�eof�	_read_eofr�Z_decomp_factoryZ_decomp_argsr�r�Z_posZ_sizer�rrr~rZunconsumed_tailr4Zunused_datar��_add_read_datar.)r2r6�bufZ
uncompressr$r$r%r�s:

z_GzipReader.readcCs$t�||j�|_|jt|�|_dS)N)rMrar�r�r.)r2r|r$r$r%r��sz_GzipReader._add_read_datacCs�t�d|�d��\}}||jkr<tdt|�t|j�f��n||jd@krRtd��d}x|dkrn|j�d�}qXW|r�|j�	|�dS)Nz<IIr	zCRC check failed %s != %sl��z!Incorrect length of data producedrhr)
r&r�r�r�rxr]r�r�rr4)r2raZisize�cr$r$r%r��s


z_GzipReader._read_eofcst���d|_dS)NT)r��_rewindr�)r2)r�r$r%r�
s
z_GzipReader._rewind)rY)r9r:r;r5r�r�r�rr�r�r��
__classcell__r$r$)r�r%rI�s!
3rIc	Cs4t��}t|d|d��}|�|�WdQRX|��S)N�wb)rPrr )r�BytesIOrr�getvalue)r|r r�r3r$r$r%rsc	Cs$tt�|�d��
}|��SQRXdS)N)rP)rrr�r)r|r3r$r$r%rscCs:tjdd�}|o|ddk}|r.|dd�}|s8dg}x�|D]�}|r�|dkrjtddtjjd�}tjj}q�|dd�d	kr�td
t|��q>t|d�}t	�|dd�d�}n>|dkr�tjj}tddtjjd�}nt	�|d�}t|d	d�}x|�
d�}|s�P|�|�q�W|tjjk	�r|��|tjjk	r>|��q>WdS)
Nrrz-d�-rr
)rrrPrTz.gzzfilename doesn't end in .gz:r�i)
�sys�argvr�stdin�buffer�stdout�printr\rrCrrr�)�argsr�argr3�gr�r$r$r%�_test"s<



r��__main__)r
rNNN)r)r&r�rqrrMrCrZ_compression�__all__ZFTEXTr�r�ror�rHrKrtZ_COMPRESS_LEVEL_TRADEOFFrsrr*r+Z
BaseStreamrZDecompressReaderrIrrr�r9r$r$r$r%�<module>s0 
+)
	&

Hacked By AnonymousFox1.0, Coded By AnonymousFox