Hacked By AnonymousFox

Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/gzip.cpython-312.opt-1.pyc

�

�Q�fa���dZddlZddlZddlZddlZddlZddlZddlZddlZgd�Z	d\Z
ZZZ
Zd\ZZdZdZdZd	Zd
ej*zZdedddfd�Zd
�ZGd�d�ZGd�de�ZGd�dej8�ZGd�dej<�Zd�Z d�Z!Gd�dejD�Z#	d"de$de%fd�Z&efdd�d�Z'd�Z(d �Z)e*d!k(re)�yy)#z�Functions 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.�N)�BadGzipFile�GzipFile�open�compress�
decompress)�����)rr	r��	ir
�rbc���d|vrd|vr5td|����|�td��|�td��|�td��|jdd�}t|ttt
jf�rt|||�}n2t|d	�st|d
�rtd|||�}ntd��d|vr-tj|�}tj||||�S|S)aOpen 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", "x", "xb", "a" or "ab" for
    binary mode, or "rt", "wt", "xt" 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).

    �t�bzInvalid mode: Nz0Argument 'encoding' not supported in binary modez.Argument 'errors' not supported in binary modez/Argument 'newline' not supported in binary mode��read�writez1filename must be a str or bytes object, or a file)
�
ValueError�replace�
isinstance�str�bytes�os�PathLiker�hasattr�	TypeError�io�
text_encoding�
TextIOWrapper)�filename�mode�
compresslevel�encoding�errors�newline�gz_mode�binary_files        �+/opt/alt/python312/lib64/python3.12/gzip.pyrrs���(�d�{��$�;��4�9�:�:����O�P�P����M�N�N����N�O�O��l�l�3��#�G��(�S�%����5�6��x��-�@��	��6�	"�g�h��&@��t�W�m�X�F���K�L�L�
�d�{��#�#�H�-������X�v�w�G�G���c�N�|jtjd|��y)Nz<L)r�struct�pack)�output�values  r*�write32ur1Is���L�L����T�5�)�*r+c�2�eZdZdZdd�Zd�Zdd�Zd�Zd�Zy)	�_PaddedFilez�Minimal read-only file object that prepends a string to the contents
    of an actual file. Shouldn't be used outside of gzip.py, as it lacks
    essential functionality.c�N�||_t|�|_||_d|_y�Nr)�_buffer�len�_length�file�_read)�self�f�prepends   r*�__init__z_PaddedFile.__init__Ss"������7�|�����	���
r+c��|j�|jj|�S|j|z|jkr:|j}|xj|z
c_|j||jS|j}d|_|j|d|jj||jz
|z�zS�N)r:r9rr8r6)r;�sizers   r*rz_PaddedFile.readYs����:�:���9�9�>�>�$�'�'��:�:������,��:�:�D��J�J�$��J��<�<��T�Z�Z�0�0��:�:�D��D�J��<�<���&��9�9�>�>�$�t�|�|�"3�D�"8�9�:�
:r+c��|j�||_n|xjt|�zc_yt|j�|_d|_yr5)r:r6r7r8)r;r=s  r*r=z_PaddedFile.prependfs?���:�:��"�D�L��J�J�#�g�,�&�J���4�<�<�(�����
r+c�T�d|_d|_|jj|�Sr@)r:r6r9�seek)r;�offs  r*rDz_PaddedFile.seekos#����
�����y�y�~�~�c�"�"r+c��y�NT��r;s r*�seekablez_PaddedFile.seekablet���r+N)r+)	�__name__�
__module__�__qualname__�__doc__r>rr=rDrJrHr+r*r3r3Ns �� ��:��#�
r+r3c��eZdZdZy)rz6Exception raised in some cases for invalid gzip files.N)rLrMrNrOrHr+r*rrxs��@r+rc�(�eZdZdZd�Zd�Zd�Zd�Zy)�_WriteBufferStreamz8Minimal object to pass WriteBuffer flushes into GzipFilec��||_yr@)�	gzip_file)r;rTs  r*r>z_WriteBufferStream.__init__~s	��"��r+c�8�|jj|�Sr@)rT�
_write_raw)r;�datas  r*rz_WriteBufferStream.write�s���~�~�(�(��.�.r+c��y)NFrHrIs r*rJz_WriteBufferStream.seekable�s��r+c��yrGrHrIs r*�writablez_WriteBufferStream.writable�rKr+N)rLrMrNrOr>rrJrZrHr+r*rRrR|s��B�#�/��r+rRc����eZdZdZdZddeddfd�Zed��Zd�Z	d�Z
�fd�Zd�Zd	�Z
d
�Zdd�Zdd�Zd
�Zed��Zd�Zej*fd�Zd�Zd�Zd�Zd�Zd�Zej:fd�Zdd�Z�xZ S)ra
The GzipFile class simulates most of the methods of a file object with
    the exception of the truncate() method.

    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.

    Nc��|r"d|vsd|vrtdj|���|r	d|vr|dz
}|�!tj||xsd�x}|_|�&t|dd�}t
|ttf�sd}ntj|�}|}|�
t|d	d�}|jd
�r8t|_
t|�}tj |�|_||_n�|jd�r�|�ddl}|j)d
t*d�t,|_
|j/|�t1j2|t0j4t0j6t0j8d�|_||_t>|_ tjBtE|�|j@��|_ntdj|���||_#|jt,k(r|jI|�yy)aGConstructor 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 include 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', 'wb', 'x', or
        'xb' 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', 'a' and 'ab', and 'x' and 'xb'.

        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 last modification time field in the stream when compressing.
        If omitted or None, the current time is used.

        r�UzInvalid mode: {!r}rNr�namerr#�r)�w�a�xrz�GzipFile was opened for writing, but this will change in future Python releases.  Specify the mode argument for opening it for writing.r	)�buffer_size)%r�format�builtinsr�	myfileobj�getattrrrrr�fspath�
startswith�READr#�_GzipReaderr�BufferedReaderr6r^�warnings�warn�
FutureWarning�WRITE�_init_write�zlib�compressobj�DEFLATED�	MAX_WBITS�
DEF_MEM_LEVELr�_write_mtime�_WRITE_BUFFER_SIZE�_buffer_size�BufferedWriterrR�fileobj�_write_gzip_header)	r;r"r#r$r{�mtime�origmode�rawrms	         r*r>zGzipFile.__init__�s���F�S�D�[�C�4�K��1�8�8��>�?�?��C�t�O��C�K�D��?�'/�}�}�X�t�|�t�'L�L�G�d�n����w���3�H��h��e��5����y�y��*�H����<��7�F�D�1�D��?�?�3���D�I��g�&�C��,�,�S�1�D�L� �D�I�
�_�_�_�
-�����
�
�L�"�1�	&�
�D�I����X�&� �,�,�]�-1�]�]�.2�n�n�_�-1�-?�-?�-.�	0�D�M�
!&�D�� 2�D���,�,�-?��-E�9=�9J�9J�L�D�L��1�8�8��>�?�?�����9�9����#�#�M�2�r+c�B�|jjjS)z0Last modification time read from stream, or None)r6r�_last_mtimerIs r*r}zGzipFile.mtime�s���|�|���+�+�+r+c�r�t|j�}d|ddzdztt|��zdzS)Nz<gzip r���� �>)�reprr{�hex�id)r;�ss  r*�__repr__zGzipFile.__repr__�s8���������!�A�b�'�!�C�'�#�b��h�-�7�#�=�=r+c�~�||_tjd�|_d|_g|_d|_d|_y�Nr+r)r^rr�crc32�crcrA�writebuf�bufsize�offset)r;r"s  r*rqzGzipFile._init_write�s4����	��:�:�c�?�����	���
������r+c�t��|j�|jj�t�|��Sr@)�_check_not_closedr6�flush�super�tell�r;�	__class__s �r*r�z
GzipFile.tell�s+������ ��������w�|�~�r+c�2�|jjd�|jjd�	tjj	|j
�}t
|t�s|jd�}|jd�r|dd}d}|rt}|jjt|�jd��|j}|�tj�}t|jt!|��|t"k(rd}n|t$k(rd	}nd
}|jj|�|jjd�|r|jj|d
z�yy#t$rd}Y��wxYw)N���zlatin-1s.gz���r+r�����)r{rr�path�basenamer^rr�encode�endswith�UnicodeEncodeError�FNAME�chrrw�timer1�int�_COMPRESS_LEVEL_BEST�_COMPRESS_LEVEL_FAST)r;r$�fname�flagsr}�xfls      r*r|zGzipFile._write_gzip_headersJ�������;�'������7�#�		��G�G�$�$�T�Y�Y�/�E��e�U�+����Y�/���~�~�f�%��c�r�
������E������3�u�:�,�,�Y�7�8��!�!���=��I�I�K�E�����s�5�z�*��0�0��C�
�2�
2��C��C������3�������7�#���L�L���u�w��/���%"�	��E�	�s�A F�F�Fc���|j�|jtk7rddl}t	|j
d��|j�td��|jj|�S)Nrz$write() on read-only GzipFile objectz!write() on closed GzipFile object)
r�r#rp�errno�OSError�EBADFr{rr6r)r;rWr�s   r*rzGzipFile.write#sZ����� ��9�9�����%�+�+�'M�N�N��<�<���@�A�A��|�|�!�!�$�'�'r+c��t|ttf�rt|�}nt	|�}|j
}|dkDr�|jj|jj|��|xj|z
c_	tj||j�|_|xj|z
c_
|Sr5)rr�	bytearrayr7�
memoryview�nbytesr{rrrArrr�r�r�)r;rW�lengths   r*rVzGzipFile._write_raw.s����d�U�I�.�/���Y�F��d�#�D��[�[�F��A�:��L�L���t�}�}�5�5�d�;�<��I�I���I��z�z�$����1�D�H��K�K�6�!�K��
r+c��|j�|jtk7rddl}t	|j
d��|jj|�S)Nrz$read() on write-only GzipFile object)r�r#rjr�r�r�r6r�r;rAr�s   r*rz
GzipFile.read?sD����� ��9�9�����%�+�+�'M�N�N��|�|� � ��&�&r+c���|j�|jtk7rddl}t	|j
d��|dkrtj}|jj|�S)zdImplements BufferedIOBase.read1()

        Reads up to a buffer's worth of data if size is negative.rNz%read1() on write-only GzipFile object)
r�r#rjr�r�r�r�DEFAULT_BUFFER_SIZEr6�read1r�s   r*r�zGzipFile.read1FsX��	
��� ��9�9�����%�+�+�'N�O�O��!�8��)�)�D��|�|�!�!�$�'�'r+c��|j�|jtk7rddl}t	|j
d��|jj|�S)Nrz$peek() on write-only GzipFile object)r�r#rjr�r�r�r6�peek)r;�nr�s   r*r�z
GzipFile.peekSsD����� ��9�9�����%�+�+�'M�N�N��|�|� � ��#�#r+c��|jduSr@)r{rIs r*�closedzGzipFile.closedZs���|�|�t�#�#r+c�H�|j}|�y	|jtk(rs|jj	�|j|jj	��t||j�t||jdz�n-|jtk(r|jj�d|_|j}|rd|_|j�yy#d|_|j}|rd|_|j�wwxYw)N���)
r{r#rpr6r�rrr1r�rArj�closerf)r;r{rfs   r*r�zGzipFile.close^s����,�,���?��	"��y�y�E�!����"�"�$��
�
�d�m�m�1�1�3�4���$�(�(�+���$�)�)�j�"8�9����d�"����"�"�$��D�L����I��!%������!��� �D�L����I��!%������!��s�B3C2�2/D!c��|j�|jtk(ri|jj	�|j
j
|jj	|��|j
j	�yyr@)r�r#rpr6r�r{rr)r;�	zlib_modes  r*r�zGzipFile.flushrs`����� ��9�9����L�L��� ��L�L���t�}�}�2�2�9�=�>��L�L��� �	r+c�6�|jj�S)z�Invoke the underlying file object's fileno() method.

        This will raise AttributeError if the underlying file object
        doesn't support fileno().
        )r{�filenorIs r*r�zGzipFile.filenozs���|�|�"�"�$�$r+c�v�|jtk7rtd��|jj	d�y)z[Return the uncompressed stream file position indicator to the
        beginning of the filezCan't rewind in write moderN)r#rjr�r6rDrIs r*�rewindzGzipFile.rewind�s.���9�9����6�7�7������!�r+c�(�|jtk(Sr@)r#rjrIs r*�readablezGzipFile.readable�s���y�y�D� � r+c�(�|jtk(Sr@)r#rprIs r*rZzGzipFile.writable�s���y�y�E�!�!r+c��yrGrHrIs r*rJzGzipFile.seekable�rKr+c��|jtk(r�|j�|jj	�|t
jk7r.|t
jk(r|j|z}ntd��||jkrtd��||jz
}d|jz}t||jz�D]}|j|��|jd||jzz�|jS|jtk(r,|j�|jj||�S|jS)NzSeek from end not supportedzNegative seek in write moder�)r#rpr�r6r�r�SEEK_SET�SEEK_CURr�rr�ry�rangerrjrD)r;r��whence�count�chunk�is      r*rDz
GzipFile.seek�s���9�9����"�"�$��L�L��� �����$��R�[�[�(�!�[�[�6�1�F�$�%B�C�C�����#��;�<�<��T�[�[�(�E��D�-�-�-�E��5�D�$5�$5�5�6���
�
�5�!�7��J�J�u���(9�(9� 9�:�;�
�{�{��	�Y�Y�$�
��"�"�$��<�<�$�$�V�V�4�4��{�{�r+c�X�|j�|jj|�Sr@)r�r6�readline)r;rAs  r*r�zGzipFile.readline�s#����� ��|�|�$�$�T�*�*r+�r�)!rLrMrNrOrfr�r>�propertyr}r�rqr�r|rrVrr�r�r�r�rr�Z_SYNC_FLUSHr�r�r�r�rZrJrr�rDr��
__classcell__�r�s@r*rr�s������I� $�4�3�T��S3�j�,��,�>���
0�@	(��"'�(�$��$��$�"�("�.�.�!�%��!�"��#%�+�+��.+r+rc��|j|�}t|�|kr>|j|t|�z
�}|std��||z
}t|�|kr�>|S)z}Read exactly *n* bytes from `fp`

    This method is required because fp may be unbuffered,
    i.e. return short reads.
    �ACompressed file ended before the end-of-stream marker was reached)rr7�EOFError)�fpr�rWrs    r*�_read_exactr��sd���7�7�1�:�D�

�d�)�a�-��G�G�A��D�	�M�"����>�?�
?���	���d�)�a�-��Kr+c���|jd�}|dk(ry|dk7rtd|z��tjdt	|d��\}}}|dk7rtd��|t
zr.tjd	t	|d��\}t	||�|tzr	|jd
�}|r|dk(rn�|tzr	|jd
�}|r|dk(rn�|tzrt	|d�|S)z�Read a gzip header from `fp` and progress to the end of the header.

    Returns last mtime if header was present or None otherwise.
    r	r+Nr�zNot a gzipped file (%r)z<BBIxxrzUnknown compression methodz<Hrr�)	rrr-�unpackr��FEXTRAr��FCOMMENT�FHCRC)r��magic�method�flag�
last_mtime�	extra_lenr�s       r*�_read_gzip_headerr��s���

�G�G�A�J�E���|������3�e�;�<�<�!'���x��R��9K�!L��V�T�:�
��{��6�7�7��f�}��]�]�4��R��);�<�
�	��B�	�"��e�|������
�A���7�
����h�������
�A���7�
����e�|��B����r+c�B��eZdZ�fd�Zd�Zd�Zdd�Zd�Z�fd�Z�xZ	S)rkc���t�|�t|�tjtj
��d|_d|_y)N��wbitsT)r�r>r3rr�_ZlibDecompressorru�_new_memberr�)r;r�r�s  �r*r>z_GzipReader.__init__�s>���
����R��$�*@�*@� $����	�	0� �����r+c�F�tjd�|_d|_yr�)rrr��_crc�_stream_sizerIs r*�
_init_readz_GzipReader._init_read�s���J�J�s�O��	���r+c�B�t|j�}|�y||_y)NFT)r��_fpr�)r;r�s  r*r�z_GzipReader._read_gzip_header�s$��&�t�x�x�0�
����%���r+c��|dkr|j�S|sy	|jjr8|j�d|_|j
di|j��|_|jr9|j�|j�s|j|_
yd|_|jjr<|jjt�}|jj||�}n|jjd|�}|jj dk7r/|jj#|jj �|dk7rndk(rt%d����at'j(||j*�|_|xj,t/|�z
c_|xjt/|�z
c_	|S)Nrr+TFr�rH)�readall�
_decompressor�eof�	_read_eofr��_decomp_factory�_decomp_argsr�r��_pos�_size�needs_inputr�r�READ_BUFFER_SIZEr�unused_datar=r�rrr�r�r�r7)r;rA�buf�
uncompresss    r*rz_GzipReader.read�s����!�8��<�<�>�!���
��!�!�%�%�
��� �#'�� �%9�T�%9�%9�&)��'�'�&)��"�������!��-�-�/�!%���D�J��#(�� ��!�!�-�-��h�h�m�m�$4�5��!�/�/�:�:�3��E�
�!�/�/�:�:�3��E�
��!�!�-�-��4���� � ��!3�!3�!?�!?�@��S� ���c�z�� B�C�C�G�L�J�J�z�4�9�9�5��	����S��_�,���	�	�S��_�$�	��r+c��tjdt|jd��\}}||jk7r-tdt
|��dt
|j�����||jdzk7rtd��d}|dk(r!|jjd�}|dk(r�!|r|jj|�yy)	N�<IIrzCRC check failed z != r��!Incorrect length of data producedr�r)
r-r�r�r�r�rr�r�rr=)r;r��isize�cs    r*r�z_GzipReader._read_eof+s���
�}�}�U�K����!�,D�E���u��D�I�I���S��Z�=@����^�M�N�
N�
�t�(�(�:�5�
6��A�B�B�

���7�l����
�
�a� �A��7�l���H�H���Q��
r+c�0��t�|��d|_yrG)r��_rewindr�r�s �r*rz_GzipReader._rewind@s���
������r+r�)
rLrMrNr>r�r�rr�rr�r�s@r*rkrk�s'��� ���3�j �* � r+rkr$�returnc
��|�tj�}|tk(rd}n|tk(rd}nd}tjdddddt|�|d�S)	a
    Write a simple gzip header with no extra fields.
    :param compresslevel: Compresslevel used to determine the xfl bytes.
    :param mtime: The mtime (must support conversion to a 32-bit integer).
    :return: A bytes object representing the gzip header.
    r	r
rz<BBBBLBB��r�)r�r�r�r-r.r�)r$r}r�s   r*�_create_simple_gzip_headerrEsX��
�}��	�	����,�,���	�.�	.������;�;�z�4��q�!�S��Z��c�J�Jr+)r}c��|dk(rtj||d��St||�}tjdtj
|�t
|�dz�}|tj||d��z|zS)z�Compress data in one shot and return the compressed string.

    compresslevel sets the compression level in range of 0-9.
    mtime can be used to set the modification time. The modification time is
    set to the current time by default.
    rr)�levelr�z<LLr�i�)rrrrr-r.r�r7)rWr$r}�header�trailers     r*rrZsr��
��z��}�}�T��b�A�A�
'�
�u�
=�F��k�k�%����D�!1�C��I�
�4J�L�G��T�]�]�4�}�C�H�H��
�r+c��g}	tj|�}t|��dj|�St	j
tj��}|j||j�d�}|jrt|j�dkrtd��tjd|jdd�\}}|t	j|�k7rt!d��|t|�dzk7rt!d	��|j#|�|jddj%d
�}��=)zYDecompress a gzip compressed string in one shot.
    Return the decompressed string.
    Nr+r�rr�r	zCRC check failedr�r
r�)r�BytesIOr��joinrr�
decompressobjrurr�r�r7rr�r-r�r�r�append�lstrip)rW�decompressed_membersr��do�decompressedr�r�s       r*rrls����
�
�Z�Z��
���R� �(��8�8�0�1�1�
�
�
�t�~�~�o�
6���}�}�T�"�'�'�)�*�%5�6���v�v��R�^�^�,�q�0��0�1�
1��m�m�E�2�>�>�"�1�+=�>���V��$�*�*�\�*�*��0�1�1��c�,�'�*�4�5��A�B�B��#�#�L�1��~�~�a�b�!�(�(��1��#r+c��ddlm}|d��}|j�}|jddd��|jd	dd
��|jdddd
��|jdddgd��|j	�}t
}|jrt}n|jrt}|jD�]�}|jr�|dk(rAtddtjj��}tj j}n�|dddk7rtj"d|���t%|d�}t'j$|ddd�}nl|dk(rBtjj}tddtj j|��}n%t'j$|d�}t%|dzd�}	|j)t*�}|sn|j-|��*|tj jur|j/�|tjjus��}|j/����y)Nr)�ArgumentParserzeA simple command line interface for the gzip module: act like gzip, but do not delete the input file.)�descriptionz--fast�
store_truezcompress faster)�action�helpz--bestzcompress betterz-dz--decompresszact like gunzip instead of gzip�args�*�-r9)�nargs�default�metavarrr)r"r#r{r�z.gzzfilename doesn't end in .gz: �wb)r"r#r{r$)�argparser#�add_mutually_exclusive_group�add_argument�
parse_args�_COMPRESS_LEVEL_TRADEOFF�fastr��bestr�r(rr�sys�stdin�buffer�stdout�exitrrerrrr�)	r#�parser�groupr(r$�argr<�gr�s	         r*�mainr?�s���'�
�	,�-�F�
�/�/�1�E�	���x��;L��M�	���x��;L��M�	���t�^�L�>��@�����c�C�5�&��I�����D�,�M��y�y�,�
�	
���,�
��y�y���?�?��c�z��b�t�S�Y�Y�=M�=M�N���J�J�%�%���r�s�8�u�$��H�H�<�S�G�D�E���d�O���M�M�#�c�r�(�D�1���c�z��I�I�$�$���b�t�S�Z�Z�=N�=N�+8�:���M�M�#�t�,����u��d�+����F�F�+�,�E���
�G�G�E�N�	�

�C�J�J�%�%�%�
�G�G�I��C�I�I�$�$�$�
�G�G�I�5r+�__main__r@)+rOr-r6r�rrrrer�_compression�__all__�FTEXTr�r�r�r�rjrpr�r3r�rr�rxrr1r3r�r�	RawIOBaserR�
BaseStreamrr�r��DecompressReaderrkr�rrrrr?rLrHr+r*�<module>rGs)��%�����	��
G��(6�%��u�f�e�X����e�����������/�/�/���,@��t�T�+�Z+�
'�'�TA�'�A������`+�|�&�&�`+�F	
� "�J_ �,�/�/�_ �F(,�K�c�K�05�K�*"6����$2�2.�`�z���F�r+

Hacked By AnonymousFox1.0, Coded By AnonymousFox