JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr j fK$@sSdZddddddddd d d d d ddddddddddddddddddd d!d"d#d$g$Zd%d&lZd%d&lZd%d'lTd%d(lmZmZd%Zd)Zd*Z d+Z d,Z Gd-ddej Z d.d/d&d0d) d1d&d2d&d3d&d4d&d5d&d6d!Zed) d&d&d7d"Zed&d&d8d#Zd&S)9aSInterface to the liblzma compression library. This module provides a class for reading and writing compressed files, classes for incremental (de)compression, and convenience functions for one-shot (de)compression. These classes and functions support both the XZ and legacy LZMA container formats, as well as raw compressed data streams. Z CHECK_NONEZ CHECK_CRC32Z CHECK_CRC64Z CHECK_SHA256Z CHECK_ID_MAXZ CHECK_UNKNOWNZ FILTER_LZMA1Z FILTER_LZMA2Z FILTER_DELTAZ FILTER_X86Z FILTER_IA64Z FILTER_ARMZFILTER_ARMTHUMBZFILTER_POWERPCZ FILTER_SPARC FORMAT_AUTO FORMAT_XZZ FORMAT_ALONEZ FORMAT_RAWZMF_HC3ZMF_HC4ZMF_BT2ZMF_BT3ZMF_BT4Z MODE_FASTZ MODE_NORMALZPRESET_DEFAULTZPRESET_EXTREMELZMACompressorLZMADecompressorLZMAFile LZMAErroropencompress decompressZis_check_supportedN)*)_encode_filter_properties_decode_filter_propertiesi c @sWeZdZdZdddddd7ddddd d Zd d Zed dZddZddZ ddZ ddZ ddZ ddZ ddZddZdd Zd!d"d#Zd!d$d%Zd8d&d'Zd9d(d)Zd:d*d+Zd;d,d-Zd.d/Zd0d1Zd2d3d4Zd5d6ZdS)s     zLZMAFile.closecCs |jtkS)zTrue if this file is closed.)r%r$)r6r9r9r:closedszLZMAFile.closedcCs|j|jjS)z3Return the file descriptor for the underlying file.)_check_not_closedr"fileno)r6r9r9r:rAs zLZMAFile.filenocCs|jo|jjS)z)Return whether the file supports seeking.)readabler"seekable)r6r9r9r:rCszLZMAFile.seekablecCs|j|jttfkS)z/Return whether the file was opened for reading.)r@r%r)r<)r6r9r9r:rBs zLZMAFile.readablecCs|j|jtkS)z/Return whether the file was opened for writing.)r@r%r.)r6r9r9r:writables zLZMAFile.writablecCs|jrtdndS)NzI/O operation on closed file)r?r()r6r9r9r:r@s zLZMAFile._check_not_closedcCs5|jttfkr1|jtjdndS)NzFile not open for reading)r%r)r<r@ioUnsupportedOperation)r6r9r9r:_check_can_reads zLZMAFile._check_can_readcCs/|jtkr+|jtjdndS)NzFile not open for writing)r%r.r@rErF)r6r9r9r:_check_can_writes zLZMAFile._check_can_writecCsV|jttfkr1|jtjdn|jjsRtjdndS)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)r%r)r<r@rErFr"rC)r6r9r9r:_check_can_seeks  zLZMAFile._check_can_seekc Cs|jtkrdSx|jt|jkr|jjpI|jjt }|s|jj rwt|_|j |_ dSt dn|jj rt|j|_y|jj||_Wqtk rt|_|j |_ dSYqXn|jj||_d|_qWdS)NFzACompressed file ended before the end-of-stream marker was reachedr T)r%r<r-lenr,r+ unused_datar"r _BUFFER_SIZEeofr&r'EOFErrorrr*r r)r6Zrawblockr9r9r: _fill_buffers,          zLZMAFile._fill_bufferTcCs|j|jd|_d|_g}xJ|jrt|rP|j|jn|jt|j7_d|_q+W|rdj|SdS)Nr r)r,r-rOappendr&rJjoin)r6 return_datablocksr9r9r: _read_alls  zLZMAFile._read_allcCsC|j|}|t|jkrd|j|j|}||_|jt|7_|r`|SdS|j|jd|_d|_g}x|dkr+|jr+|t|jkr|jd|}||_n|j}d|_|r|j|n|jt|7_|t|8}qW|r?dj|SdS)Nr r)r-rJr,r&rOrPrQ)r6nrRenddatarSr9r9r: _read_blocks*      zLZMAFile._read_blockcCs.|j|jsdS|j|jdS)zReturn buffered data without advancing the file position. Always returns at least one byte of data, unless at EOF. The exact number of bytes returned is unspecified. rN)rGrOr,r-)r6sizer9r9r:peek!s  z LZMAFile.peekcCsA|j|dkrdS|dkr0|jS|j|SdS)zRead up to size uncompressed bytes from the file. If size is negative or omitted, read until EOF is reached. Returns b"" if the file is already at EOF. r rN)rGrTrX)r6rYr9r9r:r,s     z LZMAFile.readcCs|j|dks;|jt|jkr?|j r?dS|dkr|j|j|j|}|jt|7_n(|j|jd}d|_d|_|jt|7_|S)zRead up to size uncompressed bytes, while trying to avoid making multiple reads from the underlying stream. Returns b"" if the file is at EOF. r rN)rGr-rJr,rOr&)r6rYrWr9r9r:read1:s  %    zLZMAFile.read1cCs|j|dkry|jjd|jd}|dkry|j|j|}||_|jt|7_|Sntjj||S)a Read a line of uncompressed bytes from the file. The terminating newline (if present) is retained. If size is non-negative, no more than size bytes will be read (in which case the line may be incomplete). Returns b'' if already at EOF. r s r) rGr,findr-r&rJrEBufferedIOBasereadline)r6rYrVliner9r9r:r^Ts    zLZMAFile.readlinecCsK|j|jj|}|jj||jt|7_t|S)zWrite a bytes object to the file. Returns the number of uncompressed bytes written, which is always len(data). Note that due to buffering, the file on disk may not reflect the data written until close() is called. )rHr/rr"r r&rJ)r6rWZ compressedr9r9r:r fs  zLZMAFile.writecCsM|jjddt|_d|_t|j|_d|_d|_ dS)Nr r) r"seekr)r%r&rr*r+r,r-)r6r9r9r:_rewindts    zLZMAFile._rewindr cCs|j|dkrno|dkr5|j|}nS|dkrs|jdkrc|jddn|j|}ntdj|||jkr|jn ||j8}|j|dd|jS)aChange the file position. The new position is specified by offset, relative to the position indicated by whence. Possible values for whence are: 0: start of stream (default): offset must not be negative 1: current stream position 2: end of stream; offset must not be positive Returns the new file position. Note that seeking is emulated, sp depending on the parameters, this operation may be extremely slow. r rrrRFzInvalid value for whence: {})rIr&r'rTr(rrarX)r6offsetwhencer9r9r:r`|s      z LZMAFile.seekcCs|j|jS)z!Return the current file position.)r@r&)r6r9r9r:tells z LZMAFile.tellr!r!r!r!r!)__name__ __module__ __qualname____doc__r;r>propertyr?rArCrBrDr@rGrHrIrOrTrXrZrr[r^r rar`rdr9r9r9r:r&s0  !V         #   )rrrrrencodingerrorsnewlinec Csd|kr1d|krtd|fqnQ|dk rLtdn|dk rgtdn|dk rtdn|jdd} t|| d |d |d |d |} d|krtj| |||S| SdS) aOpen an LZMA-compressed file in binary or text mode. filename can be either an actual file name (given as a str or bytes object), in which case the named file is opened, or it can be an existing file object to read from or write to. The mode argument can be "r", "rb" (default), "w", "wb", "x", "xb", "a", or "ab" for binary mode, or "rt", "wt", "xt", or "at" for text mode. The format, check, preset and filters arguments specify the compression settings, as for LZMACompressor, LZMADecompressor and LZMAFile. For binary mode, this function is equivalent to the LZMAFile constructor: LZMAFile(filename, mode, ...). In this case, the encoding, errors and newline arguments must not be provided. For text mode, a LZMAFile object is created, and wrapped in an io.TextIOWrapper instance with the specified encoding, error handling behavior, and line ending(s). trzInvalid mode: %rNz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary moderrrr)r(replacerrE TextIOWrapper) r7r8rrrrrjrkrlZlz_modeZ binary_filer9r9r:rs      cCs,t||||}|j||jS)zCompress a block of data. Refer to LZMACompressor's docstring for a description of the optional arguments *format*, *check*, *preset* and *filters*. For incremental compression, use an LZMACompressor instead. )rrr=)rWrrrrcompr9r9r:rsc Csg}xt|||}y|j|}Wntk rO|rHPnYnX|j||jsutdn|j}|s Pq q Wdj|S)zDecompress a block of data. Refer to LZMADecompressor's docstring for a description of the optional arguments *format*, *check* and *filters*. For incremental decompression, use an LZMADecompressor instead. zACompressed data ended before the end-of-stream marker was reachedr)rr rrPrMrKrQ)rWrZmemlimitrZresultsZdecompresr9r9r:r s     )rh__all__r3rEZ_lzmar r r$r)r<r.rLr]rrrrrr r9r9r9r: s2        -