ACC SHELL

Path : /usr/lib/python/
File Upload :
Current File : //usr/lib/python/gzip.pyo

Ñò
nÄMc
@sÝdZddkZddkZddkZddkZddkZddgZddddd	f\ZZZ	Z
Zddf\ZZ
d
„Zd„Zdd
d„Zdfd„ƒYZd„ZedjoeƒndS(s‘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.iÿÿÿÿNtGzipFiletopeniiiiicCs|itid|ƒƒdS(Ns<L(twritetstructtpack(toutputtvalue((s/usr/lib/python2.6/gzip.pytwrite32uscCstid|idƒƒdS(Ns<Iii(Rtunpacktread(tinput((s/usr/lib/python2.6/gzip.pytread32strbi	cCst|||ƒS(sŸShorthand for GzipFile(filename, mode, compresslevel).

    The filename argument is required; mode defaults to 'rb'
    and compresslevel defaults to 9.

    (R(tfilenametmodet
compresslevel((s/usr/lib/python2.6/gzip.pyRscBs+eZdZd Zd"Zd d dd d„Zed„ƒZd„Z	d„Z
d„Zd	„Zd
„Z
d„Zdd
„Zd„Zdd„Zd„Zd„Zd„Zd„Zeid„Zd„Zd„Zd„Zd„Zdd„Zdd„Zdd„Zd„Z d„Z!d„Z"RS(#sˆThe GzipFile class simulates most of the methods of a file object with
    the exception of the readinto() and truncate() methods.

    i
ii	c	Cs¸|od|jo|d7}n|djo$ti||pdƒ}|_n|djo't|dƒo
|i}q‡d}n|djo't|dƒo
|i}q»d}n|dd!djo:t|_t|_	d|_
d|_||_d	|_n||dd!d
jp|dd!djoBt
|_|i|ƒti|tititidƒ|_ntd|d
‚||_d|_|it
jo|iƒndS(sAConstructor 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, a StringIO 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'.
        Be aware that only the 'rb', 'ab', and 'wb' values should be used
        for cross-platform portability.

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

        tbRtnametRiitridtwtasMode s not supportedN(tNonet__builtin__Rt	myfileobjthasattrRRtREADtTruet_new_membertextrabuft	extrasizetmin_readsizetWRITEt_init_writetzlibtcompressobjtDEFLATEDt	MAX_WBITSt
DEF_MEM_LEVELtcompresstIOErrortfileobjtoffsett_write_gzip_header(tselfR
RRR)((s/usr/lib/python2.6/gzip.pyt__init__,s@ 
$





					
(	
			cCsVddk}|idtdƒ|itjo |iddjo|idS|iS(Niÿÿÿÿsuse the name attributeiiýÿÿÿs.gz(twarningstwarntDeprecationWarningRR R(R,R.((s/usr/lib/python2.6/gzip.pyR
rs
$cCs6t|iƒ}d|dd!dtt|ƒƒdS(Ns<gzip iiÿÿÿÿt t>(treprR)thextid(R,ts((s/usr/lib/python2.6/gzip.pyt__repr__zscCs>||_tidƒd@|_d|_g|_d|_dS(NRlÿÿi(RR"tcrc32tcrctsizetwritebuftbufsize(R,R
((s/usr/lib/python2.6/gzip.pyR!~s
			cCsÓ|iidƒ|iidƒ|i}|idƒo|d }nd}|o
t}n|iit|ƒƒt|ittiƒƒƒ|iidƒ|iidƒ|o|ii|dƒndS(	Ns‹ss.gziýÿÿÿissÿt(	R)RRtendswithtFNAMEtchrRtlongttime(R,tfnametflags((s/usr/lib/python2.6/gzip.pyR+…s	
cCs#tidƒd@|_d|_dS(NRlÿÿi(R"R8R9R:(R,((s/usr/lib/python2.6/gzip.pyt
_init_read•scCs”|iidƒ}|djo
td‚nt|iidƒƒ}|djo
td‚nt|iidƒƒ}|iidƒ|t@oLt|iidƒƒ}|dt|iidƒƒ}|ii|ƒn|t@o?x<to0|iidƒ}|p
|d	joPqëqëWn|t@o?x<to0|iidƒ}|p
|d	joPq5q5Wn|t@o|iidƒndS(
Nis‹sNot a gzipped fileiisUnknown compression methodiiR=(	R)R	R(tordtFEXTRAR?RtFCOMMENTtFHCRC(R,tmagictmethodtflagtxlenR6((s/usr/lib/python2.6/gzip.pyt_read_gzip_header™s4



 cCsÍ|itjo"ddk}t|idƒ‚n|idjo
td‚nt|ƒdjog|i	t|ƒ|_	t
i||iƒd@|_|ii
|ii|ƒƒ|it|ƒ7_ndS(Niÿÿÿÿs$write() on read-only GzipFile objects!write() on closed GzipFile objectilÿÿ(RR terrnoR(tEBADFR)Rt
ValueErrortlenR:R"R8R9RR'R*(R,tdataRO((s/usr/lib/python2.6/gzip.pyR»s
iÿÿÿÿc	Csu|itjo"ddk}t|idƒ‚n|idjo|idjodSd}|djoYy6x/to'|i	|ƒt
|i|dƒ}qpWWq5tj
o|i}q5Xnsy?x8||ijo'|i	|ƒt
|i|dƒ}qÉWWn0tj
o$||ijo
|i}q5nX|i
| }|i
||_
|i||_|i|7_|S(Niÿÿÿÿs$read() on write-only GzipFile objectiRii(RRROR(RPRR)RRt_readtmintmax_read_chunktEOFErrorRR*(R,R:ROtreadsizetchunk((s/usr/lib/python2.6/gzip.pyR	Ès6 



cCs?||i|_t|ƒ|i|_|it|ƒ8_dS(N(RRRRR*(R,tbuf((s/usr/lib/python2.6/gzip.pyt_unreadèscCsv|idjo
td‚n|ioŒ|iiƒ}|iiddƒ||iiƒjo
td‚n|ii|ƒ|iƒ|iƒti	ti
ƒ|_t|_n|ii
|ƒ}|djo3|iiƒ}|iƒ|i|ƒtd‚n|ii|ƒ}|i|ƒ|iidjo;|iit|iiƒddƒ|iƒt|_ndS(NsReached EOFiiRii(R)RRWRttelltseekRERNR"t
decompressobjR%t
decompresstFalseR	tflusht	_read_eoft_add_read_datatunused_dataRRR(R,R:tposRZt
uncompress((s/usr/lib/python2.6/gzip.pyRTís0










$
cCs\ti||iƒd@|_|i||_|it|ƒ|_|it|ƒ|_dS(Nlÿÿ(R"R8R9RRRRR:(R,RS((s/usr/lib/python2.6/gzip.pyRcscCs|iiddƒt|iƒ}t|iƒ}||ijo)tdt|ƒt|iƒfƒ‚n"||id@jo
td‚ndS(NiøÿÿÿisCRC check failed %s != %slÿÿs!Incorrect length of data produced(R)R]RR9R(R4R:(R,R8tisize((s/usr/lib/python2.6/gzip.pyRb%scCsº|idjodS|itjoP|ii|iiƒƒt|i|iƒt|i|i	d@ƒd|_n|it
jo
d|_n|io|iiƒd|_ndS(Nlÿÿ(
R)RRR RR'RaRR9R:RRtclose(R,((s/usr/lib/python2.6/gzip.pyRh4s



cCsNy)|idjo|idjodSWntj
odSX|iƒdS(N(RRR)tAttributeErrorRh(R,((s/usr/lib/python2.6/gzip.pyt__del__Cs	cCsA|itjo |ii|ii|ƒƒn|iiƒdS(N(RR R)RR'Ra(R,t	zlib_mode((s/usr/lib/python2.6/gzip.pyRaLs cCs
|iiƒS(s¥Invoke the underlying file object's fileno() method.

        This will raise AttributeError if the underlying file object
        doesn't support fileno().
        (R)tfileno(R,((s/usr/lib/python2.6/gzip.pyRlRscCstS(N(R`(R,((s/usr/lib/python2.6/gzip.pytisattyZscCs|iS(N(R*(R,((s/usr/lib/python2.6/gzip.pyR\]scCsX|itjotdƒ‚n|iidƒt|_d|_d|_d|_	dS(s[Return the uncompressed stream file position indicator to the
        beginning of the filesCan't rewind in write modeiRN(
RRR(R)R]RRRRR*(R,((s/usr/lib/python2.6/gzip.pytrewind`s			icCs3|o.|djo|i|}q5tdƒ‚n|itjor||ijotdƒ‚n||i}x)t|dƒD]}|iddƒqƒW|i|ddƒny|itjoh||ijo|iƒn||i}x%t|dƒD]}|i	dƒqW|i	|dƒndS(NisSeek from end not supportedsNegative seek in write modeiR=(
R*RQRR R(trangeRRRnR	(R,R*twhencetcountti((s/usr/lib/python2.6/gzip.pyR]ks(


cCsS|djoti}|i}n|}g}xä|djoÖ|i|ƒ}|idƒ}||jp |djo!t|ƒ|jo|d}n|djp
|djo/|i||d ƒ|i||dƒPn|i|ƒ|t|ƒ}t||dƒ}q2W||ijo t||iddƒ|_ndi	|ƒS(Nis
iÿÿÿÿiRii(
tsystmaxintRR	tfindRRtappendR[RUtjoin(R,R:RXtbufstcRr((s/usr/lib/python2.6/gzip.pytreadlines*
	

-
 cCst|djo
ti}ng}xM|djo?|iƒ}|djoPn|i|ƒ|t|ƒ}q#W|S(NiR(RsRtRzRvRR(R,tsizehinttLtline((s/usr/lib/python2.6/gzip.pyt	readlines s




cCs"x|D]}|i|ƒqWdS(N(R(R,R|R}((s/usr/lib/python2.6/gzip.pyt
writelines®scCs|S(N((R,((s/usr/lib/python2.6/gzip.pyt__iter__²scCs"|iƒ}|o|St‚dS(N(Rzt
StopIteration(R,R}((s/usr/lib/python2.6/gzip.pytnextµsNi(i (#t__name__t
__module__t__doc__RRRVR-tpropertyR
R7R!R+RERNRR	R[RTRcRbRhRjR"tZ_SYNC_FLUSHRaRlRmR\RnR]RzR~RR€R‚(((s/usr/lib/python2.6/gzip.pyR#s<E					"	
 	2											c
CsÁtid}|o|ddj}|o|d}n|p
dg}nxm|D]e}|oˆ|djo+tddddd	tiƒ}ti}qF|d
djodGt|ƒGHqTnt|dƒ}ti|d
 d
ƒ}n^|djo+ti}tdddd
d	tiƒ}n&ti|dƒ}t|dd
ƒ}x4to,|i	dƒ}|pPn|i
|ƒqIW|tij	o|iƒn|tij	o|iƒqTqTWdS(Niis-dt-R
RRRR)iýÿÿÿs.gzsfilename doesn't end in .gz:twbi(RstargvRtstdintstdoutR3RRRR	RRh(targsR_targtftgRY((s/usr/lib/python2.6/gzip.pyt_test½s@




	"t__main__(R…RRsRBR"Rt__all__tFTEXTRIRGR?RHRR RRRRR‘Rƒ(((s/usr/lib/python2.6/gzip.pyt<module>s$$			ÿ›	&


ACC SHELL 2018