Hacked By AnonymousFox

Current Path : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/lzma.cpython-311.opt-1.pyc

�

c��f�3�	��dZgd�ZddlZddlZddlZddlTddlmZmZddlZdZ	dZ
dZGd�d	ej��Z
ddddddddd�d
�Zedddfd�Zeddfd�ZdS)aSInterface 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_NONE�CHECK_CRC32�CHECK_CRC64�CHECK_SHA256�CHECK_ID_MAX�
CHECK_UNKNOWN�FILTER_LZMA1�FILTER_LZMA2�FILTER_DELTA�
FILTER_X86�FILTER_IA64�
FILTER_ARM�FILTER_ARMTHUMB�FILTER_POWERPC�FILTER_SPARC�FORMAT_AUTO�	FORMAT_XZ�FORMAT_ALONE�
FORMAT_RAW�MF_HC3�MF_HC4�MF_BT2�MF_BT3�MF_BT4�	MODE_FAST�MODE_NORMAL�PRESET_DEFAULT�PRESET_EXTREME�LZMACompressor�LZMADecompressor�LZMAFile�	LZMAError�open�compress�
decompress�is_check_supported�N)�*)�_encode_filter_properties�_decode_filter_properties��c��eZdZdZdddddd�d�Zd�Zed���Zd	�Zd
�Z	d�Z
d�Zdd
�Zdd�Z
dd�Zdd�Zd�Zejfd�Zd�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.
    N�r�����format�check�preset�filtersc�0�d|_d|_t|_|dvr7|dkrt	d���|�t	d���|�t
}t}nV|dvr0|�t}t}t||||���|_
d	|_n"t	d
�|�����t|ttt jf��r2d|vr|dz
}t%j||��|_d|_||_n>t)|d
��st)|d��r||_||_nt+d���|jtkrCt-j|jt0t2||���}t5j|��|_dSdS)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)�w�wb�a�ab�x�xbr/r&zInvalid mode: {!r}�bT�read�writez6filename must be a str, bytes, file or PathLike object)�trailing_errorr0r3)�_fp�_closefp�_MODE_CLOSED�_mode�
ValueErrorr�
_MODE_READr�_MODE_WRITEr�_compressor�_posr0�
isinstance�str�bytes�os�PathLike�builtinsr"�hasattr�	TypeError�_compression�DecompressReaderrr!�io�BufferedReader�_buffer)	�self�filename�moder0r1r2r3�	mode_code�raws	         �+/opt/alt/python311/lib64/python3.11/lzma.py�__init__zLZMAFile.__init__1s���X�����
�!��
��;�����{�{� �"C�D�D�D��!� �"I�J�J�J��~�$��"�I�I�
�6�
6�
6��~�"��#�I�-�V�5�5;�W� N� N� N�D���D�I�I��1�8�8��>�>�?�?�?��h��e�R�[� 9�:�:�
	V��$��������}�X�t�4�4�D�H� �D�M�"�D�J�J�
�X�v�
&�
&�	V�'�(�G�*D�*D�	V��D�H�"�D�J�J��T�U�U�U��:��#�#��/���:J�(���J�J�J�C��,�S�1�1�D�L�L�L�$�#�c��|jtkrdS	|jtkr!|j���d|_nH|jt
kr8|j�|j�	����d|_	|j
r|j���d|_d|_
t|_dS#d|_d|_
t|_wxYw#	|j
r|j���d|_d|_
t|_n#d|_d|_
t|_wxYwwxYw)z�Flush 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)rCrBrErU�closerFr@r>rG�flushrA�rVs r[r_zLZMAFile.close�sD���:��%�%��F�	*��z�Z�'�'���"�"�$�$�$�#������{�*�*�����t�/�5�5�7�7�8�8�8�#'�� �
*��=�%��H�N�N�$�$�$���� %��
�)��
�
�
�� ��� %��
�)��
�)�)�)�)��

*��=�%��H�N�N�$�$�$���� %��
�)��
�
�� ��� %��
�)��
�)�)�)�)�)�)�)�)s0�A9C)� C
�
C&�)E�+ D&�E�&E�Ec�"�|jtkS)zTrue if this file is closed.)rCrBras r[�closedzLZMAFile.closed�s���z�\�)�)r]c�\�|���|j���S)z3Return the file descriptor for the underlying file.)�_check_not_closedr@�filenoras r[rfzLZMAFile.fileno�s&����� � � ��x��� � � r]c�\�|���o|j���S)z)Return whether the file supports seeking.)�readablerU�seekableras r[rizLZMAFile.seekable�s#���}�}���:�4�<�#8�#8�#:�#:�:r]c�J�|���|jtkS)z/Return whether the file was opened for reading.)rerCrEras r[rhzLZMAFile.readable�s!����� � � ��z�Z�'�'r]c�J�|���|jtkS)z/Return whether the file was opened for writing.)rerCrFras r[�writablezLZMAFile.writable�s!����� � � ��z�[�(�(r]c�^�|���|j�|��S)z�Return 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_readrU�peek�rV�sizes  r[roz
LZMAFile.peek�s.��	
�������|� � ��&�&�&r]c�^�|���|j�|��S)z�Read 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.
        )rnrUr=rps  r[r=z
LZMAFile.read�s,��	
�������|� � ��&�&�&r]c��|���|dkrtj}|j�|��S)z�Read 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&)rnrS�DEFAULT_BUFFER_SIZErU�read1rps  r[ruzLZMAFile.read1�s=��	
�������!�8�8��)�D��|�!�!�$�'�'�'r]c�^�|���|j�|��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.
        )rnrU�readlinerps  r[rwzLZMAFile.readline�s,��	
�������|�$�$�T�*�*�*r]c�:�|���t|ttf��rt	|��}nt|��}|j}|j�|��}|j	�
|��|xj|z
c_|S)aWrite 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_writerIrK�	bytearray�len�
memoryview�nbytesrGr#r@r>rH)rV�data�length�
compresseds    r[r>zLZMAFile.write�s���	
�������d�U�I�.�/�/�	!���Y�Y�F�F��d�#�#�D��[�F��%�.�.�t�4�4�
�����z�"�"�"��	�	�V��	�	��
r]c�`�|���|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_seekrU�seek)rV�offset�whences   r[r�z
LZMAFile.seek�s.��	
�������|� � ���0�0�0r]c��|���|jtkr|j���S|jS)z!Return the current file position.)rerCrErU�tellrHras r[r�z
LZMAFile.tells=����� � � ��:��#�#��<�$�$�&�&�&��y�r])Nr-)r.)�__name__�
__module__�__qualname__�__doc__r\r_�propertyrcrfrirhrlror=rurwr>rS�SEEK_SETr�r��r]r[r r &s;��������S2��B�t�T�S2�S2�S2�S2�S2�j*�*�*�0�*�*��X�*�!�!�!�
;�;�;�(�(�(�
)�)�)�
	'�	'�	'�	'�'�'�'�'�
(�
(�
(�
(�+�+�+�+����*#%�+�1�1�1�1�$����r]r r5r.)r0r1r2r3�encoding�errors�newlinec�V�d|vrd|vrtd|�����n3|�td���|�td���|�td���|�dd��}	t||	||||�	��}
d|vr+tj|��}tj|
|||��S|
S)
a�Open an LZMA-compressed file in binary or text 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.

    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, an LZMAFile object is created, and wrapped in an
    io.TextIOWrapper instance with the specified encoding, error
    handling behavior, and line ending(s).

    �tr<zInvalid mode: Nz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode�r/)rD�replacer rS�
text_encoding�
TextIOWrapper)rWrXr0r1r2r3r�r�r��lz_mode�binary_files           r[r"r"s���4�d�{�{��$�;�;��*�4�4�9�:�:�:�����O�P�P�P����M�N�N�N����N�O�O�O��l�l�3��#�#�G��8�W�V�5�"(�'�;�;�;�K��d�{�{��#�H�-�-�����X�v�w�G�G�G��r]c�z�t||||��}|�|��|���zS)z�Compress 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.
    )rr#r`)r~r0r1r2r3�comps      r[r#r#?s6���&�%���9�9�D��=�=���������-�-r]c��g}	t|||��}	|�|��}n#t$r|rYn;�wxYw|�|��|jstd���|j}|sn�qd�|��S)z�Decompress 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.
    TzACompressed data ended before the end-of-stream marker was reachedr])rr$r!�append�eof�unused_data�join)r~r0�memlimitr3�results�decomp�ress       r[r$r$Ks����G��!�&�(�G�<�<��	��#�#�D�)�)�C�C���	�	�	��
����		����
	���s�����z�	@��?�@�@�
@��!���	��� �8�8�G���s�,�<�<)r5)r��__all__rNrSrL�_lzmar(r)rQrBrErF�
BaseStreamr r"rr#rr$r�r]r[�<module>r�s)������������	�	�	�	�	�	�	�	�����F�F�F�F�F�F�F�F��������
���f�f�f�f�f�|�&�f�f�f�R-��B�t�T��t�T�-�-�-�-�-�`$�2�d�D�	.�	.�	.�	.�(�$�������r]

Hacked By AnonymousFox1.0, Coded By AnonymousFox