AlkantarClanX12

Your IP : 18.221.59.121


Current Path : /proc/self/root/usr/lib64/python3.6/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib64/python3.6/__pycache__/gzip.cpython-36.opt-2.pyc

3


 \nO�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddddgZd\Z	Z
ZZZ
d\ZZdd
d�Zdd�ZGdd�d�ZGdd�dej�ZGdd�dej�Zddd�Zdd�Zdd�Zedkr�e�dS)�N�GzipFile�open�compress�
decompress������rb�	cCs�d|kr d|krPtd|f��n0|dk	r0td��|dk	r@td��|dk	rPtd��|jdd�}t|tttjf�r|t|||�}n,t|d�s�t|d	�r�td|||�}nt	d
��d|kr�t
j||||�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.6/gzip.pyrs$cCs|jtjd|��dS)Nz<L)r�structZpack)�output�valuer#r#r$�write32u@sr(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__Js
z_PaddedFile.__init__cCs~|jdkr|jj|�S|j||jkrJ|j}|j|7_|j||j�S|j}d|_|j|d�|jj||j|�SdS)N)r/r.rr-r+)r0�sizerr#r#r$rPs
z_PaddedFile.readcCs>|jdkr||_n|jt|�8_dSt|j�|_d|_dS)Nr)r/r+r,r-)r0r2r#r#r$r2]s
z_PaddedFile.prependcCsd|_d|_|jj|�S)N)r/r+r.�seek)r0Zoffr#r#r$r5fsz_PaddedFile.seekcCsdS)NTr#)r0r#r#r$�seekableksz_PaddedFile.seekableN)r*)r*)�__name__�
__module__�__qualname__r3rr2r5r6r#r#r#r$r)Es


	r)c@s�eZdZdZd,dd�Zedd��Zedd��Zd	d
�Zdd�Z	d
d�Z
dd�Zd.dd�Zd0dd�Z
dd�Zedd��Zdd�Zejfdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zejfd(d)�Zd2d*d+�ZdS)3rNrcCs2|r"d|ksd|kr"tdj|���|r6d|kr6|d7}|dkrTtj||pJd�}|_|dkr|t|dd�}t|ttf�s�d}n
t	j
|�}|dkr�t|dd�}|jd	�r�t|_
t|�}tj|�|_||_nN|jd��rt|_
|j|�tj|tjtjtjd
�|_||_ntdj|���||_|j
tk�r.|j�dS)Nr
�UzInvalid mode: {!r}rr�namerr�r�w�a�xr)r=r>r?)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)r0rrrrN�mtime�rawr#r#r$r3{s>#


zGzipFile.__init__cCsBddl}|jdtd�|jtkr<|jdd�dkr<|jdS|jS)Nrzuse the name attributer�z.gz���)�warnings�warn�DeprecationWarningrrIr;)r0rTr#r#r$r�s

zGzipFile.filenamecCs
|jjjS)N)r+rQ�_last_mtime)r0r#r#r$rP�szGzipFile.mtimecCs.t|j�}d|dd�dtt|��dS)Nz<gzip r� �>���)�reprrN�hex�id)r0�sr#r#r$�__repr__�s
zGzipFile.__repr__cCs.||_tjd�|_d|_g|_d|_d|_dS)Nr*r)r;rK�crc32�crcr4Zwritebuf�bufsize�offset)r0rr#r#r$rJ�szGzipFile._init_writecCs�|jjd�|jjd�y<tjj|j�}t|t�s<|jd�}|j	d�rR|dd�}Wnt
k
rld}YnXd}|rzt}|jjt|�jd��|j
}|dkr�tj�}t|jt|��|jjd�|jjd	�|r�|jj|d
�dS)Ns��zlatin-1s.gzrRr*r����rS)rNrr�path�basenamer;rr�encode�endswith�UnicodeEncodeError�FNAME�chrrM�timer(�int)r0Zfname�flagsrPr#r#r$rO�s,



zGzipFile._write_gzip_headercCs�|j�|jtkr&ddl}t|jd��|jdkr8td��t|t	�rLt
|�}nt|�}|j}|dkr�|jj
|jj|��|j|7_tj||j�|_|j|7_|S)Nrz$write() on read-only GzipFile objectz!write() on closed GzipFile object)�_check_not_closedrrI�errno�OSError�EBADFrNrrrr,�
memoryview�nbytesrrr4rKr`rarc)r0�datarsZlengthr#r#r$r�s 



zGzipFile.writercCs2|j�|jtkr&ddl}t|jd��|jj|�S)Nrz$read() on write-only GzipFile object)rrrrFrsrtrur+r)r0r4rsr#r#r$rs

z
GzipFile.readcCs@|j�|jtkr&ddl}t|jd��|dkr4tj}|jj	|�S)Nrz%read1() on write-only GzipFile object)
rrrrFrsrtrur�DEFAULT_BUFFER_SIZEr+�read1)r0r4rsr#r#r$rzs
zGzipFile.read1cCs2|j�|jtkr&ddl}t|jd��|jj|�S)Nrz$peek() on write-only GzipFile object)rrrrFrsrtrur+�peek)r0�nrsr#r#r$r{#s

z
GzipFile.peekcCs
|jdkS)N)rN)r0r#r#r$�closed*szGzipFile.closedcCs�|j}|dkrdSd|_zP|jtkrR|j|jj��t||j�t||jd@�n|jt	krf|j
j�Wd|j}|r�d|_|j�XdS)Nl��)
rNrrIrr�flushr(rar4rFr+�closerB)r0rNrBr#r#r$r.s

zGzipFile.closecCs4|j�|jtkr0|jj|jj|��|jj�dS)N)rrrrIrNrrr~)r0Z	zlib_moder#r#r$r~As
zGzipFile.flushcCs
|jj�S)N)rN�fileno)r0r#r#r$r�HszGzipFile.filenocCs"|jtkrtd��|jjd�dS)NzCan't rewind in write moder)rrFrtr+r5)r0r#r#r$�rewindPs
zGzipFile.rewindcCs
|jtkS)N)rrF)r0r#r#r$�readableWszGzipFile.readablecCs
|jtkS)N)rrI)r0r#r#r$�writableZszGzipFile.writablecCsdS)NTr#)r0r#r#r$r6]szGzipFile.seekablecCs�|jtkr�|tjkr2|tjkr*|j|}ntd��||jkrDtd��||j}dd}xt|d�D]}|j	|�qdW|j	d|d�n |jt
kr�|j�|jj
||�S|jS)NzSeek from end not supportedzNegative seek in write modergi)rrIr�SEEK_SET�SEEK_CURrcrrt�rangerrFrrr+r5)r0rc�whence�count�chunk�ir#r#r$r5`s 





z
GzipFile.seekcCs|j�|jj|�S)N)rrr+�readline)r0r4r#r#r$r�tszGzipFile.readline)NNrNNrZ)rZrZ)rZrZ)rZ)r7r8r9rBr3�propertyrrPr_rJrOrrrzr{r}rrKZZ_SYNC_FLUSHr~r�r�r�r�r6rr�r5r�r#r#r#r$rns,
H


csZeZdZ�fdd�Zdd�Zdd�Zdd�Zdd
d�Zdd
�Zdd�Z	�fdd�Z
�ZS)rGcs,t�jt|�tjtjd�d|_d|_dS)N)ZwbitsT)�superr3r)rKZ
decompressobjrL�_new_memberrW)r0�fp)�	__class__r#r$r3zsz_GzipReader.__init__cCstjd�|_d|_dS)Nr*r)rKr`�_crc�_stream_size)r0r#r#r$�
_init_read�sz_GzipReader._init_readcCsJ|jj|�}x8t|�|krD|jj|t|��}|s:td��||7}qW|S)NzACompressed file ended before the end-of-stream marker was reached)�_fprr,�EOFError)r0r|rxrr#r#r$�_read_exact�sz_GzipReader._read_exactcCs�|jjd�}|dkrdS|dkr,td|��tjd|jd��\}}|_|dkrVtd��|t@r|tjd	|jd��\}|j|�|t@r�x |jjd
�}|s�|dkr�Pq�W|t	@r�x |jjd
�}|s�|dkr�Pq�W|t
@r�|jd�dS)
Nrr*Fs�zNot a gzipped file (%r)z<BBIxxr	zUnknown compression methodz<HrrgT)r�rrtr%�unpackr�rW�FEXTRArm�FCOMMENT�FHCRC)r0�magic�method�flagZ	extra_lenr^r#r#r$�_read_gzip_header�s0

z_GzipReader._read_gzip_headerrcCs�|dkr|j�S|sdSx�|jjr@|j�d|_|jf|j�|_|jrh|j�|j�sb|j	|_
dSd|_|jjt
j�}|jj||�}|jjdkr�|jj|jj�n|jjdkr�|jj|jj�|dkr�P|dkrtd��qW|j|�|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�rrryrZunconsumed_tailr2Zunused_datar��_add_read_datar,)r0r4�bufZ
uncompressr#r#r$r�s:

z_GzipReader.readcCs$tj||j�|_|jt|�|_dS)N)rKr`r�r�r,)r0rxr#r#r$r��sz_GzipReader._add_read_datacCs�tjd|jd��\}}||jkr<tdt|�t|j�f��n||jd@krRtd��d}x|dkrn|jjd�}qXW|r�|jj	|�dS)Nz<IIr	zCRC check failed %s != %sl��z!Incorrect length of data producedrgr)
r%r�r�r�rtr\r�r�rr2)r0r`Zisize�cr#r#r$r��s


z_GzipReader._read_eofcst�j�d|_dS)NT)r��_rewindr�)r0)r�r#r$r�s
z_GzipReader._rewindrZ)rZ)r7r8r9r3r�r�r�rr�r�r��
__classcell__r#r#)r�r$rGys!
3rGc	Cs4tj�}t|d|d��}|j|�WdQRX|j�S)N�wb)rNrr)r�BytesIOrr�getvalue)rxrr�r1r#r#r$rsc	Cs$ttj|�d��
}|j�SQRXdS)N)rN)rrr�r)rxr1r#r#r$rscCs>tjdd�}|o|ddk}|r.|dd�}|s8dg}�x�|D]�}|r�|dkrltddtjjd�}tjj}q�|d
d�d	kr�td
t|��q@t|d�}t	j|dd�d�}n>|dkr�tjj}tddtjjd�}nt	j|d�}t|d	d�}x |j
d�}|�s�P|j|�q�W|tjjk	�r"|j�|tjjk	r@|j�q@WdS)Nrrz-d�-rr)rrrNrRz.gzzfilename doesn't end in .gz:r�irSrS)
�sys�argvr�stdin�buffer�stdout�printr[rrArrr)�argsr�argr1�gr�r#r#r$�_tests<


r��__main__)rrrr	r
)rr)rrNNN)r)r%r�rorrKrArZ_compression�__all__ZFTEXTr�r�rmr�rFrIrr(r)Z
BaseStreamrZDecompressReaderrGrrr�r7r#r#r#r$�<module>s* 
+)

	&