JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbrў fS_c@sBdZddlZddlZddlZddlZddlZddlZddlZddddgZddd d d f\Z Z Z Z Z ddf\ZZd d eeeddZddZddZGdddZGdddejZd ddZddZddZedkr>endS(uFunctions 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|krtd|fqnQ|d k rLtdn|d k rgtdn|d k rtdn|jdd}t|ttfrt|||}nBt|dst|d rtd |||}n td d|kr"t j ||||S|Sd S( uOpen 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_modeu binary_file((u)/opt/alt/python33/lib64/python3.3/gzip.pyuopens$       cCs|jtjd|dS(NuddZd?ddZddZddZdd d!Zd"d#Zd$d%Zed&d'Zd(d)Zejd*d+Zd,d-Zd.d/Zd0d1Zd2d3Z d4d5Z!d6d7d8Z"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|dkrtj||psd}|_n|dkrt|dd}t|tt fsd}qn|dkrt|dd}n|j d r@t |_ d|_d |_d |_d |_||_d |_t|}ne|j drt|_ |j|tj|tjtj tjd |_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_writeuzlibu compressobjuDEFLATEDu 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|jdddkrR|jdS|jS(Niuuse the name attributeiiu.gzi(uwarningsuwarnuDeprecationWarningumodeuWRITEuname(uselfuwarnings((u)/opt/alt/python33/lib64/python3.3/gzip.pyufilenames  ( uGzipFile.filenamecCsZ|j}t|tr$|j}nt|}d|dddtt|dS(Nui(ufileobju isinstanceu _PaddedFileufileurepruhexuid(uselfufileobjus((u)/opt/alt/python33/lib64/python3.3/gzip.pyu__repr__s    uGzipFile.__repr__cCs|jrtdndS(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_closeds uGzipFile._check_closedcCs>||_tjdd@|_d|_g|_d|_dS(Nsli(unameuzlibucrc32ucrcusizeuwritebufubufsize(uselfufilename((u)/opt/alt/python33/lib64/python3.3/gzip.pyu _init_writes    uGzipFile._init_writec CsF|jjd|jjdy\tjj|j}t|tsY|jd}n|j dr{|dd }nWnt k rd}YnXd}|rt }n|jjt |jd|j }|dkrtj}nt|jt||jjd|jjd |rB|jj|d ndS( Nssulatin-1s.gzisisssi(ufileobjuwriteuosupathubasenameunameu isinstanceubytesuencodeuendswithuUnicodeEncodeErroruFNAMEuchrumtimeuNoneutimeuwrite32uuint(uselfufnameuflagsumtime((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_write_gzip_headers,     uGzipFile._write_gzip_headercCs#tjdd@|_d|_dS(Nsli(uzlibucrc32ucrcusize(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyu _init_readsuGzipFile._init_readcCs|jjd}|dkr-tdn|dkrHtdnt|jjd}|dkr{tdnt|jjd}t|j|_|jjd|t@r t|jjd}|d t|jjd}|jj|n|t@rFx/|jjd}| s<|d krPqqn|t @rx/|jjd}| sx|d krSPqSqSn|t @r|jjdn|jj }|r|j j |}|j |ndS( Nisu Reached EOFsuNot 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|jdn|jdkrXtdnt |t rv|j }nt |dkr|j t ||_ tj||jd@|_|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|jdn|jdkr\|jdkr\dSd}|dkry-x&|j |t |j |d}qtWq)t k r|j}Yq)Xnmy=x6||jkr|j |t |j |d}qWWn-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|jdn|jdkr\|jdkr\dSy$x|jdkr~|j qbWWnt k rYnX|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|jdn|dkrEd}n|jdkr|jdkrgdSy0x)|jdkr|jt |dqmWWqt k rYqXn|j |j }|j}|t |j|kst|j|||S(Niu$peek() on write-only GzipFile objectidsi(umodeuREADuerrnouIOErroruEBADFu extrasizeufileobjuNoneu_readumaxuEOFErroruoffsetu extrastartulenuextrabufuAssertionError(uselfunuerrnouoffsetu remaining((u)/opt/alt/python33/lib64/python3.3/gzip.pyupeeks"     u GzipFile.peekcCs/t||j|_|jt|8_dS(N(ulenu extrasizeuoffset(uselfubuf((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_unreadsuGzipFile._unreadcCs-|jdkrtdn|jr]|j|jtjtj |_ d|_n|jj |}|dkr|j j }|jj |j jd|j|j|tdn|j j |}|j||j jdkr)|jj |j jd|jd|_ndS(Nu Reached EOFsFT(ufileobjuNoneuEOFErroru _new_memberu _init_readu_read_gzip_headeruzlibu decompressobju MAX_WBITSu decompressuFalseureaduflushuprependu unused_datauTrueu _read_eofu_add_read_data(uselfusizeubufu uncompress((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_reads(         uGzipFile._readcCstj||jd@|_|j|j}|j|d||_|jt||_|j|_|jt||_dS(Nl( uzlibucrc32ucrcuoffsetu extrastartuextrabufu extrasizeulenusize(uselfudatauoffset((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_add_read_datas  uGzipFile._add_read_datacCst|j}t|j}||jkrUtdt|t|jfn"||jd@krwtdnd}x"|dkr|jjd}qW|r|jj|dndS(NuCRC check failed %s != %slu!Incorrect length of data producedsiT( uread32ufileobjucrcuIOErroruhexusizeureaduprependuTrue(uselfucrc32uisizeuc((u)/opt/alt/python33/lib64/python3.3/gzip.pyu _read_eofsuGzipFile._read_eofcCs |jdkS(N(ufileobjuNone(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyuclosedsuGzipFile.closedcCs|jdkrdS|jtkrq|jj|jjt|j|jt|j|j d@d|_n|jt krd|_n|j r|j j d|_ ndS(Nl( ufileobjuNoneumodeuWRITEuwriteucompressuflushuwrite32uucrcusizeuREADu myfileobjuclose(uself((u)/opt/alt/python33/lib64/python3.3/gzip.pyucloses    uGzipFile.closecCsI|j|jtkrE|jj|jj||jjndS(N(u _check_closedumodeuWRITEufileobjuwriteucompressuflush(uselfu zlib_mode((u)/opt/alt/python33/lib64/python3.3/gzip.pyuflush s uGzipFile.flushcCs |jjS(uInvoke 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_|jtkrtdn|jjdd|_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|}q1tdn|jtkr||jkr^tdn||j}td}x%t|dD]}|j|qW|jt|dnt|jtkr-||jkr|j n||j}x%t|dD]}|j dqW|j |dn|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|dkrt ||kr|d}n|dks|dkrO|j |d|d|j ||ddPn|j ||t |}t ||d}qW||jkrt ||jdd|_ndj |S(Nis isiii(uoffsetu extrastartuextrabufufindu extrasizeusysumaxsizeu min_readsizeureadulenuappendu_unreaduminujoin(uselfusizeuoffsetuiureadsizeubufsuc((u)/opt/alt/python33/lib64/python3.3/gzip.pyureadlineIs4    *  uGzipFile.readlineNi(iiii($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|jS(uCompress 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|}|jSWdQXdS(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 Cstjdd}|o&|ddk}|rB|dd}n|sTdg}nxx|D]p}|r|dkrtddddd tjj}tjj}qa|ddd krtd t|q[nt|d}t j|ddd }na|dkr<tjj}tdddd d tjj}n%t j|d}t|d d }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:uwbiii( usysuargvuGzipFileustdinubufferustdoutuprinturepruopenubuiltinsureaduwriteuclose(uargsu decompressuargufuguchunk((u)/opt/alt/python33/lib64/python3.3/gzip.pyu_tests<   !  $ u_testu__main__(u__doc__ustructusysutimeuosuzlibubuiltinsuiou__all__uFTEXTuFHCRCuFEXTRAuFNAMEuFCOMMENTuREADuWRITEuNoneuopenuwrite32uuread32u _PaddedFileuBufferedIOBaseuGzipFileucompressu decompressu_testu__name__(((u)/opt/alt/python33/lib64/python3.3/gzip.pyus&0   $+  8  &