AlkantarClanX12

Your IP : 52.14.58.79


Current Path : /proc/self/root/opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python33/lib64/python3.3/__pycache__/gzip.cpython-33.pyo

�
��fS_c@sBdZddlZddlZddlZddlZddlZddlZddlZddddgZddd	d
df\Z	Z
ZZZ
ddf\ZZdd
eeedd�Zdd�Zdd�ZGdd�d�ZGdd�dej�Zd
dd�Zdd�Zdd�Zedkr>e�ndS(u�Functions that read and write gzipped files.

The user of the file doesn't have to worry about the compression,
but random access is not allowed.iNuGzipFileuopenucompressu
decompressiiiiiurbi	cCs*d|kr1d|kr�td|f��q�nQ|dk	rLtd��n|dk	rgtd��n|dk	r�td��n|jdd�}t|ttf�r�t|||�}nBt|d�s�t|d	�r�td|||�}ntd
��d|kr"t	j
||||�S|SdS(u�Open a gzip-compressed file in binary or text mode.

    The filename argument can be an actual filename (a str or bytes object), or
    an existing file object to read from or write to.

    The mode argument can be "r", "rb", "w", "wb", "a" or "ab" for binary mode,
    or "rt", "wt" or "at" for text mode. The default mode is "rb", and the
    default compresslevel is 9.

    For binary mode, this function is equivalent to the GzipFile constructor:
    GzipFile(filename, mode, compresslevel). In this case, the encoding, errors
    and newline arguments must not be provided.

    For text mode, a GzipFile object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error handling
    behavior, and line ending(s).

    utubuInvalid mode: %ru0Argument 'encoding' not supported in binary modeu.Argument 'errors' not supported in binary modeu/Argument 'newline' not supported in binary modeuureaduwriteu1filename must be a str or bytes object, or a fileN(u
ValueErroruNoneureplaceu
isinstanceustrubytesuGzipFileuhasattru	TypeErroruiou
TextIOWrapper(ufilenameumodeu
compressleveluencodinguerrorsunewlineugz_modeubinary_file((u)/opt/alt/python33/lib64/python3.3/gzip.pyuopens$cCs|jtjd|��dS(Nu<L(uwriteustructupack(uoutputuvalue((u)/opt/alt/python33/lib64/python3.3/gzip.pyuwrite32u?suwrite32ucCstjd|jd��dS(Nu<Iii(ustructuunpackuread(uinput((u)/opt/alt/python33/lib64/python3.3/gzip.pyuread32Dsuread32cBsn|EeZdZdZddd�Zdd�Zdddd�Zd	d
�Zddd
�Z	dd�Z
dS(u_PaddedFileu�Minimal read-only file object that prepends a string to the contents
    of an actual file. Shouldn't be used outside of gzip.py, as it lacks
    essential functionality.scCs.||_t|�|_||_d|_dS(Ni(u_bufferulenu_lengthufileu_read(uselfufuprepend((u)/opt/alt/python33/lib64/python3.3/gzip.pyu__init__Ls		u_PaddedFile.__init__cCs�|jdkr|jj|�S|j||jkra|j}|j|7_|j||j�S|j}d|_|j|d�|jj||j|�SdS(N(u_readuNoneufileureadu_lengthu_buffer(uselfusizeuread((u)/opt/alt/python33/lib64/python3.3/gzip.pyureadRs			u_PaddedFile.readcCs�|jdkr||_nQ|rOt|�|jkrO|jt|�8_dS|j|jd�||_t|j�|_d|_dS(Ni(u_readuNoneu_bufferulenu_length(uselfuprependureadprevious((u)/opt/alt/python33/lib64/python3.3/gzip.pyuprepend_su_PaddedFile.prependcCs'|jdkrdS|j|jd�S(Ns(u_readuNoneu_buffer(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyuunusedjsu_PaddedFile.unusedicCs�|dkrk|jdk	rkd||jko<|jknrT|j|7_dS||j|j7}nd|_d|_|jj||�S(Nii(u_readuNoneu_lengthu_bufferufileuseek(uselfuoffsetuwhence((u)/opt/alt/python33/lib64/python3.3/gzip.pyuseekos&		u_PaddedFile.seekcCst|j|�S(N(ugetattrufile(uselfuname((u)/opt/alt/python33/lib64/python3.3/gzip.pyu__getattr__{su_PaddedFile.__getattr__NF(u__name__u
__module__u__qualname__u__doc__u__init__ureaduFalseuprependuunuseduseeku__getattr__(u
__locals__((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_PaddedFileGs
u_PaddedFilecBs�|EeZdZdZd;Zd=Zd;d;dd;d;dd�Zedd��Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zd>dd�Zd?dd�Zdd�Zdd�Zdd d!�Zd"d#�Zd$d%�Zed&d'��Zd(d)�Zejd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Z d4d5�Z!d6d7d8�Z"d@d9d:�Z#d;S(AuGzipFileuThe GzipFile class simulates most of the methods of a file object with
    the exception of the readinto() and truncate() methods.

    This class only supports opening files in binary mode. If you need to open a
    compressed file in text mode, use the gzip.open() function.

    i
ii	c
Cs�|r6d|ksd|kr6tdj|���n|rUd|krU|d7}n|dkr�tj||psd�}|_n|dkr�t|dd�}t|tt	f�s�d}q�n|dkr�t|dd�}n|j
d	�r@t|_d|_d
|_d|_d|_||_d|_t|�}ne|j
d�r�t|_|j|�tj|tjtjtjd�|_ntdj|���||_d|_||_|jtkr�|j �ndS(uzConstructor for the GzipFile class.

        At least one of fileobj and filename must be given a
        non-trivial value.

        The new class instance is based on fileobj, which can be a regular
        file, an io.BytesIO object, or any other object which simulates a file.
        It defaults to None, in which case filename is opened to provide
        a file object.

        When fileobj is not None, the filename argument is only used to be
        included in the gzip file header, which may includes the original
        filename of the uncompressed file.  It defaults to the filename of
        fileobj, if discernible; otherwise, it defaults to the empty string,
        and in this case the original filename is not included in the header.

        The mode argument can be any of 'r', 'rb', 'a', 'ab', 'w', or 'wb',
        depending on whether the file will be read or written.  The default
        is the mode of fileobj if discernible; otherwise, the default is 'rb'.
        A mode of 'r' is equivalent to one of 'rb', and similarly for 'w' and
        'wb', and 'a' and 'ab'.

        The compresslevel argument is an integer from 0 to 9 controlling the
        level of compression; 1 is fastest and produces the least compression,
        and 9 is slowest and produces the most compression. 0 is no compression
        at all. The default is 9.

        The mtime argument is an optional numeric timestamp to be written
        to the stream when compressing.  All gzip compressed streams
        are required to contain a timestamp.  If omitted or None, the
        current time is used.  This module ignores the timestamp when
        decompressing; however, some programs, such as gunzip, make use
        of it.  The format of the timestamp is the same as that of the
        return value of time.time() and of the st_mtime member of the
        object returned by os.stat().

        utuUuInvalid mode: {!r}uburbunameuumodeursiiduwuaNT(uwua(!u
ValueErroruformatuNoneubuiltinsuopenu	myfileobjugetattru
isinstanceustrubytesu
startswithuREADumodeuTrueu_new_memberuextrabufu	extrasizeu
extrastartunameumin_readsizeu_PaddedFileuWRITEu_init_writeuzlibucompressobjuDEFLATEDu	MAX_WBITSu
DEF_MEM_LEVELucompressufileobjuoffsetumtimeu_write_gzip_header(uselfufilenameumodeu
compresslevelufileobjumtime((u)/opt/alt/python33/lib64/python3.3/gzip.pyu__init__�sF(
"								
				uGzipFile.__init__cCsYddl}|jdtd�|jtkrR|jdd�dkrR|jdS|jS(Niuuse the name attributeiiu.gzi����(uwarningsuwarnuDeprecationWarningumodeuWRITEuname(uselfuwarnings((u)/opt/alt/python33/lib64/python3.3/gzip.pyufilename�s
(uGzipFile.filenamecCsZ|j}t|t�r$|j}nt|�}d|dd�dtt|��dS(Nu<gzip iu u>i����(ufileobju
isinstanceu_PaddedFileufileurepruhexuid(uselfufileobjus((u)/opt/alt/python33/lib64/python3.3/gzip.pyu__repr__�s
	uGzipFile.__repr__cCs|jrtd��ndS(uLRaises a ValueError if the underlying file object has been closed.

        uI/O operation on closed file.N(uclosedu
ValueError(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyu
_check_closed�s	uGzipFile._check_closedcCs>||_tjd�d@|_d|_g|_d|_dS(Nsl��i(unameuzlibucrc32ucrcusizeuwritebufubufsize(uselfufilename((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_init_write�s
			uGzipFile._init_writecCsF|jjd�|jjd�y\tjj|j�}t|t�sY|jd�}n|j	d�r{|dd�}nWnt
k
r�d}YnXd}|r�t}n|jjt|�jd��|j
}|dkr�tj�}nt|jt|��|jjd�|jjd	�|rB|jj|d
�ndS(Ns�sulatin-1s.gzisiss�si����(ufileobjuwriteuosupathubasenameunameu
isinstanceubytesuencodeuendswithuUnicodeEncodeErroruFNAMEuchrumtimeuNoneutimeuwrite32uuint(uselfufnameuflagsumtime((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_write_gzip_header�s,
		uGzipFile._write_gzip_headercCs#tjd�d@|_d|_dS(Nsl��i(uzlibucrc32ucrcusize(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyu
_init_readsuGzipFile._init_readcCs�|jjd�}|dkr-td��n|dkrHtd��nt|jjd��}|dkr{td��nt|jjd��}t|j�|_|jjd�|t@r
t|jjd��}|d	t|jjd��}|jj|�n|t@rFx/|jjd�}|s<|d
krPqqn|t	@r�x/|jjd�}|sx|d
krSPqSqSn|t
@r�|jjd�n|jj�}|r�|jj|�}|j
|�ndS(NisuReached EOFs�uNot a gzipped fileiiuUnknown compression methodis(ufileobjureaduEOFErroruIOErroruorduread32umtimeuFEXTRAuFNAMEuFCOMMENTuFHCRCuunusedu
decompressu_add_read_data(uselfumagicumethoduflaguxlenusuunusedu
uncompress((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_read_gzip_headers>
 




uGzipFile._read_gzip_headercCs�|j�|jtkr:ddl}t|jd��n|jdkrXtd��nt	|t
�rv|j�}nt|�dkr�|j
t|�|_
tj||j�d@|_|jj|jj|��|jt|�7_nt|�S(Niu$write() on read-only GzipFile objectu!write() on closed GzipFile objectl��(u
_check_closedumodeuWRITEuerrnouIOErroruEBADFufileobjuNoneu
ValueErroru
isinstanceu
memoryviewutobytesulenusizeuzlibucrc32ucrcuwriteucompressuoffset(uselfudatauerrno((u)/opt/alt/python33/lib64/python3.3/gzip.pyuwriteFs
uGzipFile.writeic
Css|j�|jtkr:ddl}t|jd��n|jdkr\|jdkr\dSd}|dkr�y-x&|j	|�t
|j|d�}qtWq)tk
r�|j}Yq)Xnmy=x6||jkr�|j	|�t
|j|d�}q�WWn-tk
r(||jkr$|j}nYnX|j
|j}|j|||�}|j||_|j
|7_
|S(Niu$read() on write-only GzipFile objectsii(u
_check_closedumodeuREADuerrnouIOErroruEBADFu	extrasizeufileobjuNoneu_readuminumax_read_chunkuEOFErroruoffsetu
extrastartuextrabuf(uselfusizeuerrnoureadsizeuoffsetuchunk((u)/opt/alt/python33/lib64/python3.3/gzip.pyuread[s4




u
GzipFile.readcCs|j�|jtkr:ddl}t|jd��n|jdkr\|jdkr\dSy$x|jdkr~|j	�qbWWnt
k
r�YnX|dks�||jkr�|j}n|j|j}|j
|||�}|j|8_|j|7_|S(Niu%read1() on write-only GzipFile objects(u
_check_closedumodeuREADuerrnouIOErroruEBADFu	extrasizeufileobjuNoneu_readuEOFErroruoffsetu
extrastartuextrabuf(uselfusizeuerrnouoffsetuchunk((u)/opt/alt/python33/lib64/python3.3/gzip.pyuread1|s$

uGzipFile.read1cCs�|jtkr0ddl}t|jd��n|dkrEd}n|jdkr�|jdkrgdSy0x)|jdkr�|jt	|d��qmWWq�t
k
r�Yq�Xn|j|j}|j}|j
|||�S(Niu$peek() on write-only GzipFile objectidsi(umodeuREADuerrnouIOErroruEBADFu	extrasizeufileobjuNoneu_readumaxuEOFErroruoffsetu
extrastartuextrabuf(uselfunuerrnouoffsetu	remaining((u)/opt/alt/python33/lib64/python3.3/gzip.pyupeek�s 	
	u
GzipFile.peekcCs/t|�|j|_|jt|�8_dS(N(ulenu	extrasizeuoffset(uselfubuf((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_unread�suGzipFile._unreadcCs-|jdkrtd��n|jr]|j�|j�tjtj�|_	d|_n|jj|�}|dkr�|j	j�}|jj
|j	jd�|j�|j|�td��n|j	j	|�}|j|�|j	jdkr)|jj
|j	jd�|j�d|_ndS(NuReached EOFsFT(ufileobjuNoneuEOFErroru_new_memberu
_init_readu_read_gzip_headeruzlibu
decompressobju	MAX_WBITSu
decompressuFalseureaduflushuprependuunused_datauTrueu	_read_eofu_add_read_data(uselfusizeubufu
uncompress((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_read�s(	





uGzipFile._readcCs�tj||j�d@|_|j|j}|j|d�||_|jt|�|_|j|_|jt|�|_dS(Nl��(	uzlibucrc32ucrcuoffsetu
extrastartuextrabufu	extrasizeulenusize(uselfudatauoffset((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_add_read_data�suGzipFile._add_read_datacCs�t|j�}t|j�}||jkrUtdt|�t|j�f��n"||jd@krwtd��nd}x"|dkr�|jjd�}q�W|r�|jj|d�ndS(NuCRC check failed %s != %sl��u!Incorrect length of data producedsiT(	uread32ufileobjucrcuIOErroruhexusizeureaduprependuTrue(uselfucrc32uisizeuc((u)/opt/alt/python33/lib64/python3.3/gzip.pyu	_read_eof�suGzipFile._read_eofcCs
|jdkS(N(ufileobjuNone(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyuclosed�suGzipFile.closedcCs�|jdkrdS|jtkrq|jj|jj��t|j|j�t|j|j	d@�d|_n|jt
kr�d|_n|jr�|jj�d|_ndS(Nl��(
ufileobjuNoneumodeuWRITEuwriteucompressuflushuwrite32uucrcusizeuREADu	myfileobjuclose(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyuclose�s	
uGzipFile.closecCsI|j�|jtkrE|jj|jj|��|jj�ndS(N(u
_check_closedumodeuWRITEufileobjuwriteucompressuflush(uselfu	zlib_mode((u)/opt/alt/python33/lib64/python3.3/gzip.pyuflushs
uGzipFile.flushcCs
|jj�S(u�Invoke the underlying file object's fileno() method.

        This will raise AttributeError if the underlying file object
        doesn't support fileno().
        (ufileobjufileno(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyufilenosuGzipFile.filenocCs_|jtkrtd��n|jjd�d|_d|_d|_d|_	d|_
dS(u[Return the uncompressed stream file position indicator to the
        beginning of the fileuCan't rewind in write modeisNT(umodeuREADuIOErrorufileobjuseekuTrueu_new_memberuextrabufu	extrasizeu
extrastartuoffset(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyurewinds				uGzipFile.rewindcCs
|jtkS(N(umodeuREAD(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyureadable'suGzipFile.readablecCs
|jtkS(N(umodeuWRITE(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyuwritable*suGzipFile.writablecCsdS(NT(uTrue(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyuseekable-suGzipFile.seekableicCs4|r1|dkr"|j|}q1td��n|jtkr�||jkr^td��n||j}td�}x%t|d�D]}|j|�q�W|jt|d��nt|jtkr-||jkr�|j	�n||j}x%t|d�D]}|j
d�qW|j
|d�n|jS(NiuSeek from end not supporteduNegative seek in write modei(uoffsetu
ValueErrorumodeuWRITEuIOErrorubytesurangeuwriteuREADurewinduread(uselfuoffsetuwhenceucountuchunkui((u)/opt/alt/python33/lib64/python3.3/gzip.pyuseek0s(


u
GzipFile.seekcCs�|dkr�|j|j}|jjd|�d}|dkrx|j||8_|j||7_|j||�Stj}|j}n|}g}x�|dkr�|j|�}|jd�}||ks�|dkr�t	|�|kr�|d}n|dks|dkrO|j
|d|d��|j||dd��Pn|j
|�|t	|�}t||d�}q�W||jkr�t||jdd�|_ndj
|�S(Nis
isiii����(uoffsetu
extrastartuextrabufufindu	extrasizeusysumaxsizeumin_readsizeureadulenuappendu_unreaduminujoin(uselfusizeuoffsetuiureadsizeubufsuc((u)/opt/alt/python33/lib64/python3.3/gzip.pyureadlineIs4	*

uGzipFile.readlineNi(i�i����i����i����($u__name__u
__module__u__qualname__u__doc__uNoneu	myfileobjumax_read_chunku__init__upropertyufilenameu__repr__u
_check_closedu_init_writeu_write_gzip_headeru
_init_readu_read_gzip_headeruwriteureaduread1upeeku_unreadu_readu_add_read_datau	_read_eofucloseducloseuzlibuZ_SYNC_FLUSHuflushufilenourewindureadableuwritableuseekableuseekureadline(u
__locals__((u)/opt/alt/python33/lib64/python3.3/gzip.pyuGzipFiles<U*!*c	CsGtj�}td|ddd|��}|j|�WdQX|j�S(u�Compress data in one shot and return the compressed string.
    Optional argument is the compression level, in range of 0-9.
    ufileobjumodeuwbu
compresslevelN(uiouBytesIOuGzipFileuwriteugetvalue(udatau
compresslevelubufuf((u)/opt/alt/python33/lib64/python3.3/gzip.pyucompressqscCs/tdtj|���}|j�SWdQXdS(uYDecompress a gzip compressed string in one shot.
    Return the decompressed string.
    ufileobjN(uGzipFileuiouBytesIOuread(udatauf((u)/opt/alt/python33/lib64/python3.3/gzip.pyu
decompresszsc	Cs�tjdd�}|o&|ddk}|rB|dd�}n|sTdg}nxx|D]p}|r|dkr�tddddd	tjj�}tjj}qa|dd�dkr�tdt|��q[nt|d�}t	j|dd�d
�}na|dkr<tjj}tdddd
d	tjj�}n%t	j|d�}t|dd
�}x)|j
d�}|s}Pn|j|�qd|tjjk	r�|j�n|tjjk	r[|j�q[q[WdS(Niiu-du-ufilenameuumodeurbufileobjiu.gzufilename doesn't end in .gz:uwbii����i����(
usysuargvuGzipFileustdinubufferustdoutuprinturepruopenubuiltinsureaduwriteuclose(uargsu
decompressuargufuguchunk((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_test�s<
!$
u_testu__main__(u__doc__ustructusysutimeuosuzlibubuiltinsuiou__all__uFTEXTuFHCRCuFEXTRAuFNAMEuFCOMMENTuREADuWRITEuNoneuopenuwrite32uuread32u_PaddedFileuBufferedIOBaseuGzipFileucompressu
decompressu_testu__name__(((u)/opt/alt/python33/lib64/python3.3/gzip.pyu<module>s&0$+8��	&