³ò žl‡Jc @sødZddkZddkZddkZddkZddkZddgZddddd f\ZZZ Z Z ddf\Z Z d „Zd „Zd „Zd „Zd„Zddd„Zdfd„ƒYZd„Zedjo eƒ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|djo|d7}n|S(s‹Return i as an unsigned integer, assuming it fits in 32 bits. If it's >= 2GB when viewed as a 32-bit unsigned int, return a long. ili l((ti((s/sys/lib/python/gzip.pytU32s cCs|d@S(s>Return the low-order 32 bits of an int, as a non-negative int.lÿÿ((R((s/sys/lib/python/gzip.pytLOWU32scCs|itid|ƒƒdS(Ns(treprR-thextid(R0ts((s/sys/lib/python/gzip.pyt__repr__‚scCsY|ddjo|d}n||_tidƒ|_d|_g|_d|_dS(Niýÿÿÿs.gzRi(RR&tcrc32tcrctsizetwritebuftbufsize(R0R((s/sys/lib/python/gzip.pyR%†s   cCs¹|iidƒ|iidƒ|id }d}|o t}n|iit|ƒƒt|ittiƒƒƒ|iidƒ|iidƒ|o|ii|dƒndS(Ns‹siýÿÿÿissÿt(R-RRtFNAMEtchrR tlongttime(R0tfnametflags((s/sys/lib/python/gzip.pyR/s  cCstidƒ|_d|_dS(NRi(R&R9R:R;(R0((s/sys/lib/python/gzip.pyt _init_readscCs”|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(R0tmagictmethodtflagtxlenR7((s/sys/lib/python/gzip.pyt_read_gzip_header¡s0           cCsÉ|itjo"ddk}t|idƒ‚n|idjo td‚nt|ƒdjoc|i t|ƒ|_ t i ||i ƒ|_ |ii |ii|ƒƒ|it|ƒ7_ndS(Niÿÿÿÿs$write() on read-only GzipFile objects!write() on closed GzipFile objecti(RR$terrnoR,tEBADFR-Rt ValueErrortlenR;R&R9R:RR+R.(R0tdataRO((s/sys/lib/python/gzip.pyRÃs  iÿÿÿÿc Csx|itjo"ddk}t|idƒ‚n|idjo|idjodSnd}|djoYy6x/to'|i |ƒt |i |dƒ}qsWWq8t j o|i}q8Xnsy?x8||ijo'|i |ƒt |i |dƒ}qÌWWn0t j o$||ijo |i}q8nX|i | }|i ||_ |i||_|i|7_|S(Niÿÿÿÿs$read() on write-only GzipFile objectiRii(RRROR,RPR"R-RRt_readtmintmax_read_chunktEOFErrorR!R.(R0R;ROtreadsizetchunk((s/sys/lib/python/gzip.pyR Ðs2       cCs?||i|_t|ƒ|i|_|it|ƒ8_dS(N(R!RRR"R.(R0tbuf((s/sys/lib/python/gzip.pyt_unreadðscCsv|idjo td‚n|ioŒ|iiƒ}|iiddƒ||iiƒjo td‚n|ii|ƒ|iƒ|iƒti ti ƒ|_ t |_n|ii |ƒ}|djo3|i iƒ}|iƒ|i|ƒtd‚n|i i |ƒ}|i|ƒ|i idjo;|iit|i iƒ ddƒ|iƒt|_ndS(Ns Reached EOFiiRii(R-RRWR ttelltseekRERNR&t decompressobjR)t decompresstFalseR tflusht _read_eoft_add_read_datat unused_dataRRR(R0R;tposRZt uncompress((s/sys/lib/python/gzip.pyRTõs0           $ cCsXti||iƒ|_|i||_|it|ƒ|_|it|ƒ|_dS(N(R&R9R:R!R"RRR;(R0RS((s/sys/lib/python/gzip.pyRc'scCs‡|iiddƒt|iƒ}tt|iƒƒ}t|ƒt|iƒjo td‚n$|t|iƒjo td‚ndS(NiøÿÿÿisCRC check faileds!Incorrect length of data produced(R-R]RRR:R,RR;(R0R9tisize((s/sys/lib/python/gzip.pyRb-s cCs­|itjoX|ii|iiƒƒt|it|iƒƒt|it|i ƒƒd|_n|it jo d|_n|i o|i i ƒd|_ ndS(N(RR$R-RR+RaR RR:R;RRRtclose(R0((s/sys/lib/python/gzip.pyRh;s    cCsTy,|idjo|idjodSnWntj o dSnX|iƒdS(N(RRR-tAttributeErrorRh(R0((s/sys/lib/python/gzip.pyt__del__Ns  cCsA|itjo |ii|ii|ƒƒn|iiƒdS(N(RR$R-RR+Ra(R0t zlib_mode((s/sys/lib/python/gzip.pyRaWs 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(R0((s/sys/lib/python/gzip.pyRl]scCstS(N(R`(R0((s/sys/lib/python/gzip.pytisattyescCs|iS(N(R.(R0((s/sys/lib/python/gzip.pyR\hscCsX|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]RR R!R"R.(R0((s/sys/lib/python/gzip.pytrewindks   cCsþ|itjor||ijotdƒ‚n||i}x)t|dƒD]}|iddƒqNW|i|ddƒny|itjoh||ijo|iƒn||i}x%t|dƒD]}|idƒqÎW|i|dƒndS(NsNegative seek in write modeiR>( RR$R.R,trangeRRRnR (R0R.tcountR((s/sys/lib/python/gzip.pyR]vs   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( tsystmaxintR#R tfindRRtappendR[RUtjoin(R0R;RXtbufstcR((s/sys/lib/python/gzip.pytreadline‡s(   -  icCst|djo ti}ng}xM|djo?|iƒ}|djoPn|i|ƒ|t|ƒ}q#W|S(NiR(RqRrRxRtRR(R0tsizehinttLtline((s/sys/lib/python/gzip.pyt readlines¦s     cCs"x|D]}|i|ƒqWdS(N(R(R0RzR{((s/sys/lib/python/gzip.pyt writelines´scCs|S(N((R0((s/sys/lib/python/gzip.pyt__iter__¸scCs%|iƒ}|o|Snt‚dS(N(Rxt StopIteration(R0R{((s/sys/lib/python/gzip.pytnext»s Ni(i (!t__name__t __module__t__doc__RRRVR1R8R%R/RERNRR R[RTRcRbRhRjR&t Z_SYNC_FLUSHRaRlRmR\RnR]RxR|R}R~R€(((s/sys/lib/python/gzip.pyR3s:E    "  2            c CsÁtid}|o|ddj}|o|d}n|p dg}nxm|D]e}|oˆ|djo+tddddd tiƒ}ti}qF|d d jod Gt|ƒGHqTnt|dƒ}ti|d d ƒ}n^|djo+ti}tdddd d tiƒ}n&ti|dƒ}t|d d ƒ}x4to,|i dƒ}|pPn|i |ƒqIW|tij o|i ƒn|tij o|i ƒqTqTWdS(Niis-dt-RRRRR-iýÿÿÿs.gzsfilename doesn't end in .gz:twbi( RqtargvRtstdintstdoutR4RRRR RRh(targsR_targtftgRY((s/sys/lib/python/gzip.pyt_testÃs>      " t__main__(RƒRRqRBR&Rt__all__tFTEXTRIRGR?RHRR$RRR R RRRRŽR(((s/sys/lib/python/gzip.pyss"$   $     ÿ‘ &