zyMa.Dc$@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.ed/d) d0ed1ed2ed3ed4ed5d6d!Zed) eed7d"Zeeed8d#Zd&S(9uSInterface 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. u CHECK_NONEu CHECK_CRC32u CHECK_CRC64u CHECK_SHA256u CHECK_ID_MAXu CHECK_UNKNOWNu FILTER_LZMA1u FILTER_LZMA2u FILTER_DELTAu FILTER_X86u FILTER_IA64u FILTER_ARMuFILTER_ARMTHUMBuFILTER_POWERPCu FILTER_SPARCu FORMAT_AUTOu FORMAT_XZu FORMAT_ALONEu FORMAT_RAWuMF_HC3uMF_HC4uMF_BT2uMF_BT3uMF_BT4u MODE_FASTu MODE_NORMALuPRESET_DEFAULTuPRESET_EXTREMEuLZMACompressoruLZMADecompressoruLZMAFileu LZMAErroruopenucompressu decompressuis_check_supportediN(u*(u_encode_filter_propertiesu_decode_filter_propertiesiiii c BsL|EeZdZdZdd3dd4dd3dd3d3ddd Zd d Zed d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd5d d!Zd5d"d#Zd6d$d%Zd7d&d'Zd8d(d)Zd*d+Zd,d-Zd.d/d0Zd1d2Zd3S(9uLZMAFileu@A file object providing transparent LZMA (de)compression. An LZMAFile can act as a wrapper for an existing file object, or refer directly to a named file on disk. Note that LZMAFile provides a *binary* file interface - data read is returned as bytes, and data to be written must be given as bytes. uformatucheckiupresetufiltersurc Csd|_d|_t|_d|_d|_|dkr|dkrTtdn|dk rotdn|dkrt }nt }i|d6|d6|_ t |j |_ d|_nc|dkr |dkrt}nt}td|d |d|d||_ntdj|t|ttfrzd|krP|d7}ntj|||_d|_||_n?t|dst|dr||_||_n tddS(uOpen an LZMA-compressed file in binary 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. mode can be "r" for reading (default), "w" for (over)writing, or "a" for appending. These can equivalently be given as "rb", "wb", and "ab" respectively. format specifies the container format to use for the file. If mode is "r", this defaults to FORMAT_AUTO. Otherwise, the default is FORMAT_XZ. check specifies the integrity check to use. This argument can only be used when opening a file for writing. For FORMAT_XZ, the default is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not support integrity checks - for these formats, check must be omitted, or be CHECK_NONE. When opening a file for reading, the *preset* argument is not meaningful, and should be omitted. The *filters* argument should also be omitted, except when format is FORMAT_RAW (in which case it is required). When opening a file for writing, the settings used by the compressor can be specified either as a preset compression level (with the *preset* argument), or in detail as a custom filter chain (with the *filters* argument). For FORMAT_XZ and FORMAT_ALONE, the default is to use the PRESET_DEFAULT preset level. For FORMAT_RAW, the caller must always specify a filter chain; the raw compressor does not support preset compression levels. preset (if provided) should be an integer in the range 0-9, optionally OR-ed with the constant PRESET_EXTREME. filters (if provided) should be a sequence of dicts. Each dict should have an entry for "id" indicating ID of the filter, plus additional entries for options to the filter. iiururbuACannot specify an integrity check when opening a file for readinguICannot specify a preset compression level when opening a file for readinguformatufiltersuwuwbuauabucheckupresetuInvalid mode: {!r}ubureaduwriteu1filename must be a str or bytes object, or a fileNFi(ururbi(uwuwbuauabT(uNoneu_fpuFalseu_closefpu _MODE_CLOSEDu_modeu_posu_sizeu ValueErroru FORMAT_AUTOu _MODE_READu _init_argsuLZMADecompressoru _decompressoru_bufferu FORMAT_XZu _MODE_WRITEuLZMACompressoru _compressoruformatu isinstanceustrubytesubuiltinsuopenuTrueuhasattru TypeError(uselfufilenameumodeuformatucheckupresetufiltersu mode_code((u)/opt/alt/python33/lib64/python3.3/lzma.pyu__init__1sB+                    uLZMAFile.__init__cCs|jtkrdSzb|jttfkr@d|_d|_n4|jtkrt|jj |j j d|_ nWdz|j r|jj nWdd|_d|_ t|_XXdS(uFlush and close the file. May be called more than once without error. Once the file is closed, any other operation on it will raise a ValueError. NF(u_modeu _MODE_CLOSEDu _MODE_READu_MODE_READ_EOFuNoneu _decompressoru_bufferu _MODE_WRITEu_fpuwriteu _compressoruflushu_closefpucloseuFalse(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyucloses     uLZMAFile.closecCs |jtkS(uTrue if this file is closed.(u_modeu _MODE_CLOSED(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyuclosedsuLZMAFile.closedcCs|j|jjS(u3Return the file descriptor for the underlying file.(u_check_not_closedu_fpufileno(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyufilenos uLZMAFile.filenocCs|jo|jjS(u)Return whether the file supports seeking.(ureadableu_fpuseekable(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyuseekablesuLZMAFile.seekablecCs|j|jttfkS(u/Return whether the file was opened for reading.(u_check_not_closedu_modeu _MODE_READu_MODE_READ_EOF(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyureadables uLZMAFile.readablecCs|j|jtkS(u/Return whether the file was opened for writing.(u_check_not_closedu_modeu _MODE_WRITE(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyuwritables uLZMAFile.writablecCs|jrtdndS(NuI/O operation on closed file(uclosedu ValueError(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyu_check_not_closeds uLZMAFile._check_not_closedcCs"|jstjdndS(NuFile not open for reading(ureadableuiouUnsupportedOperation(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyu_check_can_reads uLZMAFile._check_can_readcCs"|jstjdndS(NuFile not open for writing(uwritableuiouUnsupportedOperation(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyu_check_can_writes uLZMAFile._check_can_writecCsC|jstjdn|jjs?tjdndS(Nu3Seeking is only supported on files open for readingu3The underlying file object does not support seeking(ureadableuiouUnsupportedOperationu_fpuseekable(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyu_check_can_seeks uLZMAFile._check_can_seekc Csx|jrdS|jjr+|jj}n|jjt}|sw|jjrht|_ |j |_ dSt dn|jjrt|j|_y|jj||_Wqtk rt|_ |j |_ dSYqXq|jj||_qdS(NuACompressed file ended before the end-of-stream marker was reachedTF(u_bufferuTrueu _decompressoru unused_datau_fpureadu _BUFFER_SIZEueofu_MODE_READ_EOFu_modeu_posu_sizeuFalseuEOFErroruLZMADecompressoru _init_argsu decompressu LZMAError(uselfurawblock((u)/opt/alt/python33/lib64/python3.3/lzma.pyu _fill_buffers*          uLZMAFile._fill_buffercCsjg}xJ|jrR|r.|j|jn|jt|j7_d|_q W|rfdj|SdS(Ns(u _fill_bufferuappendu_bufferu_posulenuNoneujoin(uselfu return_dataublocks((u)/opt/alt/python33/lib64/python3.3/lzma.pyu _read_alls uLZMAFile._read_allcCsg}x|dkr|jr|t|jkrb|jd|}|j|d|_n|j}d|_|r|j|n|jt|7_|t|8}q W|rdj|SdS(Nis(u _fill_bufferulenu_bufferuNoneuappendu_posujoin(uselfunu return_dataublocksudata((u)/opt/alt/python33/lib64/python3.3/lzma.pyu _read_blocks  uLZMAFile._read_blockcCs1|j|jtks&|j r*dS|jS(uReturn 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. s(u_check_can_readu_modeu_MODE_READ_EOFu _fill_bufferu_buffer(uselfusize((u)/opt/alt/python33/lib64/python3.3/lzma.pyupeeks u LZMAFile.peekcCsP|j|jtks%|dkr)dS|dkr?|jS|j|SdS(uRead 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. isN(u_check_can_readu_modeu_MODE_READ_EOFu _read_allu _read_block(uselfusize((u)/opt/alt/python33/lib64/python3.3/lzma.pyureads    u LZMAFile.readcCs|j|dks2|jtks2|j r6dSd|koVt|jknr|jd|}|j|d|_n|j}d|_|jt|7_|S(uRead up to size uncompressed bytes, while trying to avoid making multiple reads from the underlying stream. Returns b"" if the file is at EOF. isN(u_check_can_readu_modeu_MODE_READ_EOFu _fill_bufferulenu_bufferuNoneu_pos(uselfusizeudata((u)/opt/alt/python33/lib64/python3.3/lzma.pyuread1's  %  uLZMAFile.read1cCsK|j|jj|}|jj||jt|7_t|S(uWrite 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. (u_check_can_writeu _compressorucompressu_fpuwriteu_posulen(uselfudatau compressed((u)/opt/alt/python33/lib64/python3.3/lzma.pyuwrite=s  uLZMAFile.writecCsD|jjddt|_d|_t|j|_d|_ dS(Ni( u_fpuseeku _MODE_READu_modeu_posuLZMADecompressoru _init_argsu _decompressoruNoneu_buffer(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyu_rewindKs   uLZMAFile._rewindicCs|j|dkrno|dkr5|j|}nS|dkrs|jdkrc|jddn|j|}ntdj|||jkr|jn ||j8}|jt kr|j |ddn|jS(uChange 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. iiiu return_datauInvalid value for whence: {}F( u_check_can_seeku_posu_sizeu _read_alluFalseu ValueErroruformatu_rewindu_modeu_MODE_READ_EOFu _read_block(uselfuoffsetuwhence((u)/opt/alt/python33/lib64/python3.3/lzma.pyuseekRs       u LZMAFile.seekcCs|j|jS(u!Return the current file position.(u_check_not_closedu_pos(uself((u)/opt/alt/python33/lib64/python3.3/lzma.pyutell|s u LZMAFile.tellNiTiii(u__name__u __module__u __qualname__u__doc__uNoneu__init__ucloseupropertyuclosedufilenouseekableureadableuwritableu_check_not_closedu_check_can_readu_check_can_writeu_check_can_seeku _fill_bufferuTrueu _read_allu _read_blockupeekureaduread1uwriteu_rewinduseekutell(u __locals__((u)/opt/alt/python33/lib64/python3.3/lzma.pyuLZMAFile&s. 'U         $    *uformatucheckupresetufiltersuencodinguerrorsunewlineurbc Csd|kr1d|krtd|fqnQ|d k rLtdn|d k rgtdn|d k rtdn|jdd} t|| d|d |d |d |} d|krtj| |||S| Sd S( uOpen 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", "a", or "ab" for binary mode, or "rt", "wt" 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). utubuInvalid mode: %ru0Argument 'encoding' not supported in binary modeu.Argument 'errors' not supported in binary modeu/Argument 'newline' not supported in binary modeuuformatucheckupresetufiltersN(u ValueErroruNoneureplaceuLZMAFileuiou TextIOWrapper( ufilenameumodeuformatucheckupresetufiltersuencodinguerrorsunewlineulz_modeu binary_file((u)/opt/alt/python33/lib64/python3.3/lzma.pyuopens      cCs,t||||}|j||jS(uCompress 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 object instead. (uLZMACompressorucompressuflush(udatauformatucheckupresetufiltersucomp((u)/opt/alt/python33/lib64/python3.3/lzma.pyucompresssc Csg}xt|||}y|j|}Wntk rO|rHPnYnX|j||jsutdn|j}|s Pq q dj|S(uDecompress a block of data. Refer to LZMADecompressor's docstring for a description of the optional arguments *format*, *check* and *filters*. For incremental decompression, use a LZMADecompressor object instead. uACompressed data ended before the end-of-stream marker was reacheds(uLZMADecompressoru decompressu LZMAErroruappendueofu unused_dataujoin(udatauformatumemlimitufiltersuresultsudecompures((u)/opt/alt/python33/lib64/python3.3/lzma.pyu decompresss     (u__doc__u__all__ubuiltinsuiou_lzmau_encode_filter_propertiesu_decode_filter_propertiesu _MODE_CLOSEDu _MODE_READu_MODE_READ_EOFu _MODE_WRITEu _BUFFER_SIZEuBufferedIOBaseuLZMAFileuNoneuopenu FORMAT_XZucompressu FORMAT_AUTOu decompress(((u)/opt/alt/python33/lib64/python3.3/lzma.pyu s2        ]+