/snap/core22/2411/usr/lib/python3.10/__pycache__
Edit: /snap/core22/2411/usr/lib/python3.10/__pycache__/lzma.cpython-310.pyc (12100B)
o
`wi3 @ s d Z g dZddlZddlZddlZddlT ddlmZmZ ddlZdZ dZ
dZG dd d ejZ
dddddddddd
dZedddfddZeddfddZdS )aS Interface 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.
)$
CHECK_NONECHECK_CRC32CHECK_CRC64CHECK_SHA256CHECK_ID_MAX
CHECK_UNKNOWNFILTER_LZMA1FILTER_LZMA2FILTER_DELTA
FILTER_X86FILTER_IA64
FILTER_ARMFILTER_ARMTHUMBFILTER_POWERPCFILTER_SPARCFORMAT_AUTO FORMAT_XZFORMAT_ALONE
FORMAT_RAWMF_HC3MF_HC4MF_BT2MF_BT3MF_BT4 MODE_FASTMODE_NORMALPRESET_DEFAULTPRESET_EXTREMELZMACompressorLZMADecompressorLZMAFile LZMAErroropencompress
decompressis_check_supported N)*)_encode_filter_properties_decode_filter_properties c @ s e Zd ZdZd"dddddddZdd Zed
d Zdd
Zdd Z dd Z
dd Zd#ddZd#ddZ
d#ddZd#ddZdd ZejfddZd d! ZdS )$r a@ 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.
Nrformatcheckpresetfiltersc C s( d| _ d| _t| _|dv r&|dkrtd|durtd|du r#t}t}n |dv r?|du r0t}t}t ||||d| _
d | _ntd
|t
|tttjfred|vrW|d7 }t||| _ d| _|| _nt|d
sot|drv|| _ || _ntd| jtkrtj| j tt||d}t|| _dS dS )a Open an LZMA-compressed file in binary mode.
filename can be either an actual file name (given as a str,
bytes, or PathLike 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,
"x" for creating exclusively, or "a" for appending. These can
equivalently be given as "rb", "wb", "xb" 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.
NF)r+ rbr, zACannot specify an integrity check when opening a file for readingzICannot specify a preset compression level when opening a file for reading)wwbaabxxbr- r% zInvalid mode: {!r}bTreadwritez6filename must be a str, bytes, file or PathLike object)trailing_errorr. r1 )_fp_closefp_MODE_CLOSED_mode
ValueErrorr
_MODE_READr _MODE_WRITEr _compressor_posr.
isinstancestrbytesosPathLikebuiltinsr! hasattr TypeError_compressionDecompressReaderr r ioBufferedReader_buffer) selffilenamemoder. r/ r0 r1 mode_coderaw rX /usr/lib/python3.10/lzma.py__init__1 sH ,
zLZMAFile.__init__c C s | j tkrdS zK| j tkr| j d| _n| j tkr'| j| j d| _W z | j
r=| j W d| _d| _
t| _ dS W d| _d| _
t| _ dS d| _d| _
t| _ w z| j
rg| j W d| _d| _
t| _ w W d| _d| _
t| _ w d| _d| _
t| _ w )zFlush 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)r@ r? rB rR closerC r= r; rD flushr> rS rX rX rY r[ sH
zLZMAFile.closec C s
| j tkS )zTrue if this file is closed.)r@ r? r] rX rX rY closed s
zLZMAFile.closedc C s | | j S )z3Return the file descriptor for the underlying file.)_check_not_closedr= filenor] rX rX rY r`
zLZMAFile.filenoc C s | o| j S )z)Return whether the file supports seeking.)readablerR seekabler] rX rX rY rc s zLZMAFile.seekablec C | | jtkS )z/Return whether the file was opened for reading.)r_ r@ rB r] rX rX rY rb ra zLZMAFile.readablec C rd )z/Return whether the file was opened for writing.)r_ r@ rC r] rX rX rY writable ra zLZMAFile.writablec C | | j|S )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.
)_check_can_readrR peekrS sizerX rX rY rh s z
LZMAFile.peekc C rf )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.
)rg rR r: ri rX rX rY r: s z
LZMAFile.readc C s" | |dk rtj}| j|S )zRead up to size uncompressed bytes, while trying to avoid
making multiple reads from the underlying stream. Reads up to a
buffer's worth of data if size is negative.
Returns b"" if the file is at EOF.
r% )rg rP DEFAULT_BUFFER_SIZErR read1ri rX rX rY rl s zLZMAFile.read1c C rf )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.
)rg rR readlineri rX rX rY rm s zLZMAFile.readlinec C sX | t|ttfrt|}nt|}|j}| j|}| j
| | j|7 _|S )a Write a bytes object to the file.
Returns the number of uncompressed bytes written, which is
always the length of data in bytes. Note that due to buffering,
the file on disk may not reflect the data written until close()
is called.
)_check_can_writerF rH bytearraylen
memoryviewnbytesrD r" r= r; rE )rS datalength
compressedrX rX rY r; s
zLZMAFile.writec C s | | j||S )a Change 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, so depending on the parameters,
this operation may be extremely slow.
)_check_can_seekrR seek)rS offsetwhencerX rX rY rw s z
LZMAFile.seekc C s" | | jtkr| j S | jS )z!Return the current file position.)r_ r@ rB rR tellrE r] rX rX rY rz s
z
LZMAFile.tell)Nr+ )r, )__name__
__module____qualname____doc__rZ r[ propertyr^ r` rc rb re rh r: rl rm r; rP SEEK_SETrw rz rX rX rX rY r &