� !A?h ^��r�dZddlZddlZddlZddlZddlZddlZddlZddlZgd�Z d\Z Z Z Z Zd\ZZdZdZdZd edddfd �Zd �ZGd �d ��ZGd�de��ZGd�dej��Zd�Zd�ZGd�dej��Z ddede fd�Z!efdd�d�Z"d�Z#d�Z$e%dkr e$��dSdS)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�� �rbc�"�d|vrd|vrtd|�����n3|�td���|�td���|�td���|�dd��}t|ttt jf��rt|||��}nBt|d ��st|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 �1/opt/alt/python-internal/lib64/python3.11/gzip.pyrrs2��( �d�{�{� �$�;�;��*�4�4�9�:�:� :� � � ��O�P�P� P� � ��M�N�N� N� � ��N�O�O� O��l�l�3��#�#�G��(�S�%���5�6�6�M��x��-�@�@� � � ��6� "� "�M�g�h��&@�&@�M��t�W�m�X�F�F� � ��K�L�L�L� �d�{�{��#�H�-�-���� �X�v�w�G�G�G���c�V�|�tjd|����dS)Nz�>�$�'�'� '� �:�� �� � ,� ,��:�D� �J�J�$� �J�J��<��T�Z��0� 0��:�D��D�J��<����&��9�>�>�$�t�|�"3�D�"8�9�9�:� :r+c��|j�||_n|xjt|��zc_dSt|j��|_d|_dSr5)r:r6r7r8)r;r=s r*r=z_PaddedFile.prependcsJ�� �:� �"�D�L�L� �J�J�#�g�,�,� &�J�J� �F��4�<�(�(�� ��� � � r+c�R�d|_d|_|j�|��Sr@)r:r6r9�seek)r;�offs r*rDz_PaddedFile.seekls$���� ��� ��y�~�~�c�"�"�"r+c��dS�NT��r;s r*�seekablez_PaddedFile.seekableq����tr+N)r+) �__name__� __module__� __qualname__�__doc__r>rr=rDrJrHr+r*r3r3Kss������ � ����� :� :� :�����#�#�#� ����r+r3c��eZdZdZdS)rz6Exception raised in some cases for invalid gzip files.N)rLrMrNrOrHr+r*rrus������@�@�@�@r+rc���eZdZdZdZddeddfd�Zed���Zed���Z d�Z d�Z d�Z d �Z dd �Zdd �Zd �Zed���Zd�Zejfd�Zd�Zd�Zd�Zd�Zd�Zejfd�Zdd�ZdS)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|vr"td�|�����|r d|vr|dz }|�tj||pd��x}|_|�0t |dd��}t |ttf��sd}ntj |��}|}|�t |d d��}|� d ��rzGzipFile.__init__�s��F � @�S�D�[�[�C�4�K�K��1�8�8��>�>�?�?� ?� � �C�t�O�O� �C�K�D� �?�'/�}�X�t�|�t�'L�'L� L�G�d�n� � ��w���3�3�H��h��e� �5�5� �����y��*�*�H��� �<��7�F�D�1�1�D� �?�?�3� � � @��D�I��g�&�&�C��,�S�1�1�D�L� �D�I�I� �_�_�_� -� -� @�������� � �L�"�1� &�&�&� �D�I� � � �X� &� &� &� �,�]�-1�]�.2�n�_�-1�-?�-.� 0�0�D�M� !&�D� � ��1�8�8��>�>�?�?� ?��� � �9�� � � � #� #�M� 2� 2� 2� 2� 2� � r+c��ddl}|�dtd��|jtkr|jdd�dkr |jdzS|jS)Nrzuse the name attributer ������.gz)rbrc�DeprecationWarningr#rerT)r;rbs r*r"zGzipFile.filename�sY������� � �.�0B�A�F�F�F� �9�� � �$�)�B�C�C�.�E�"9�"9��9�u�$� $��y�r+c�$�|jjjS)z0Last modification time read from stream, or None)r6rq� _last_mtimerIs r*rozGzipFile.mtime�s���|��+�+r+c��t|j��}d|dd�zdztt|����zdzS)Nz)�reprrm�hex�id)r;�ss r*�__repr__zGzipFile.__repr__�s?�� ��� � ���!�A�b�D�'�!�C�'�#�b��h�h�-�-�7�#�=�=r+c�~�||_tjd��|_d|_g|_d|_d|_dS�Nr+r)rTrg�crc32�crcrA�writebuf�bufsize�offset)r;r"s r*rfzGzipFile._init_write�s8���� ��:�c�?�?����� ��� ��� ��� � � r+c�\�|j�d��|j�d�� tj�|j��}t |t��s|�d��}|� d��r |dd�}n#t$rd}YnwxYwd}|rt}|j�t|���d����|j }|�tj��}t|jt!|����|t"krd}n|t$krd }nd }|j�|��|j�d ��|r|j�|d z��dSdS) N���zlatin-1s.gzrsr+r�����)rmrr�path�basenamerTrr�encode�endswith�UnicodeEncodeError�FNAME�chrrl�timer1�int�_COMPRESS_LEVEL_BEST�_COMPRESS_LEVEL_FAST)r;r$�fname�flagsro�xfls r*rnzGzipFile._write_gzip_header�s��� � ���;�'�'�'� � ���7�#�#�#� ��G�$�$�T�Y�/�/�E��e�U�+�+� 0�� � �Y�/�/���~�~�f�%�%� #��c�r�c� ����!� � � ��E�E�E� ������ � ��E� � ���3�u�:�:�,�,�Y�7�7�8�8�8��!�� �=��I�K�K�E����s�5�z�z�*�*�*� �0� 0� 0��C�C� �2� 2� 2��C�C��C� � ���3���� � ���7�#�#�#� � 0� �L� � �u�w�� /� /� /� /� /� 0� 0s�A-B$�$ B3�2B3c��|���|jtkrddl}t |jd���|j�td���t|ttf��rt|��}nt|��}|j }|dkrq|j�|j�|����|xj|z c_t#j||j��|_|xj|z c_|S)Nrz$write() on read-only GzipFile objectz!write() on closed GzipFile object)�_check_not_closedr#re�errno�OSError�EBADFrmrrr� bytearrayr7� memoryview�nbytesrrrArgr�r�r�)r;�datar��lengths r*rzGzipFile.writes��� ��� � � � �9�� � � �L�L�L��%�+�'M�N�N� N� �<� ��@�A�A� A� �d�U�I�.� /� /� !���Y�Y�F�F��d�#�#�D��[�F� �A�:�:� �L� � �t�}�5�5�d�;�;� <� <� <� �I�I�� �I�I��z�$���1�1�D�H� �K�K�6� !�K�K�� r+ryc��|���|jtkrddl}t |jd���|j�|��S)Nrz$read() on write-only GzipFile object)r�r#r_r�r�r�r6r�r;rAr�s r*rz GzipFile.read(sS�� ��� � � � �9�� � � �L�L�L��%�+�'M�N�N� N��|� � ��&�&�&r+c���|���|jtkrddl}t |jd���|dkr t j}|j� |��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#r_r�r�r�r�DEFAULT_BUFFER_SIZEr6�read1r�s r*r�zGzipFile.read1/sf�� ��� � � � �9�� � � �L�L�L��%�+�'N�O�O� O� �!�8�8��)�D��|�!�!�$�'�'�'r+c��|���|jtkrddl}t |jd���|j�|��S)Nrz$peek() on write-only GzipFile object)r�r#r_r�r�r�r6�peek)r;�nr�s r*r�z GzipFile.peek<sS�� ��� � � � �9�� � � �L�L�L��%�+�'M�N�N� N��|� � ��#�#�#r+c��|jduSr@)rmrIs r*�closedzGzipFile.closedCs���|�t�#�#r+c���|j}|�dSd|_ |jtkrZ|�|j�����t ||j��t ||jdz��n)|jtkr|j � ��|j }|rd|_ |� ��dSdS#|j }|rd|_ |� ��wwxYw)N���) rmr#rerr�flushr1r�rAr_r6�closer[)r;rmr[s r*r�zGzipFile.closeGs���,�� �?� �F��� � "��y�E�!�!�� � �d�m�1�1�3�3�4�4�4���$�(�+�+�+���$�)�j�"8�9�9�9�9���d�"�"�� �"�"�$�$�$���I�� "�!%������!�!�!�!�!� "� "����I�� "�!%������!�!�!�!� "���s �BC�'C6c���|���|jtkrM|j�|j�|����|j���dSdSr@)r�r#rermrrr�)r;� zlib_modes r*r�zGzipFile.flushZsi�� ��� � � � �9�� � � �L� � �t�}�2�2�9�=�=� >� >� >� �L� � � � � � � � � r+c�4�|j���S)z�Invoke the underlying file object's fileno() method. This will raise AttributeError if the underlying file object doesn't support fileno(). )rm�filenorIs r*r�zGzipFile.filenoas�� �|�"�"�$�$�$r+c�x�|jtkrtd���|j�d��dS)z[Return the uncompressed stream file position indicator to the beginning of the filezCan't rewind in write moderN)r#r_r�r6rDrIs r*�rewindzGzipFile.rewindis<�� �9�� � ��6�7�7� 7� � ���!�����r+c�"�|jtkSr@)r#r_rIs r*�readablezGzipFile.readableps���y�D� � r+c�"�|jtkSr@)r#rerIs r*�writablezGzipFile.writabless���y�E�!�!r+c��dSrGrHrIs r*rJzGzipFile.seekablevrKr+c���|jtkr�|tjkr*|tjkr |j|z}nt d���||jkrtd���||jz }d}t|dz��D]}|� |���|� d|dzz��n?|jtkr/|� ��|j � ||��S|jS)NzSeek from end not supportedzNegative seek in write modesir�)r#rer�SEEK_SET�SEEK_CURr�rr��rangerr_r�r6rD)r;r��whence�count�chunk�is r*rDz GzipFile.seekys�� �9�� � ����$�$��R�[�(�(�!�[�6�1�F�F�$�%B�C�C�C��� �#�#��;�<�<�<��T�[�(�E� �E��5�D�=�)�)� "� "��� � �5�!�!�!�!� �J�J�u��� �-� .� .� .� .� �Y�$� � � � "� "� $� $� $��<�$�$�V�V�4�4� 4��{�r+c�^�|���|j�|��Sr@)r�r6�readline)r;rAs r*r�zGzipFile.readline�s*�� ��� � � ��|�$�$�T�*�*�*r+�ry)rLrMrNrOr[r�r>�propertyr"ror�rfrnrrr�r�r�r�rg� Z_SYNC_FLUSHr�r�r�r�r�rJrr�rDr�rHr+r*rrys����������I� $�4�3�T��O3�O3�O3�O3�b����X���,�,��X�,�>�>�>����0�0�0�@���0'�'�'�'� (� (� (� (�$�$�$��$�$��X�$�"�"�"�&"�.�!�!�!�!�%�%�%����!�!�!�"�"�"����#%�+�����(+�+�+�+�+�+r+rc���|�|��}t|��|krN|�|t|��z ��}|std���||z }t|��|k�N|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�r�rs r*� _read_exactr��s}�� �7�7�1�:�:�D� �d�)�)�a�-�-� �G�G�A��D� � �M� "� "��� ?��>�?�?� ?� �� �� �d�)�)�a�-�-� �Kr+c�B�|�d��}|dkrdS|dkrtd|z���tjdt |d����\}}}|dkrtd���|t zr5tjd t |d����\}t ||��|t zr |�d ��}|r|d krn�|tzr |�d ��}|r|d krn�|tzrt |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)zr3rg� decompressobjrj� _new_memberrw)r;r�� __class__s �r*r>z_GzipReader.__init__�sP��� ������R���$�*<� $��� � 0� 0� 0� �������r+c�F�tjd��|_d|_dSr�)rgr��_crc� _stream_sizerIs r*� _init_readz_GzipReader._init_read�s���J�s�O�O�� �����r+c�D�t|j��}|�dS||_dS)NFT)r��_fprw)r;r�s r*r�z_GzipReader._read_gzip_header�s)��&�t�x�0�0� � � ��5�%����tr+ryc�8�|dkr|���S|sdS |jjr2|���d|_|jdi|j��|_|jr=|���|���s|j |_ dSd|_|j � tj��}|j�||��}|jjdkr%|j �|jj��n4|jjdkr$|j �|jj��|dkrn|dkrt'd�����H|�|��|xj t+|��z c_ |S)Nrr+TFr�rH)�readall� _decompressor�eof� _read_eofr��_decomp_factory� _decomp_argsr�r��_pos�_sizer�rrr�r�unconsumed_tailr=� unused_datar��_add_read_datar7)r;rA�buf� uncompresss r*rz_GzipReader.read�s��� �!�8�8��<�<�>�>� !�� ��3� # C��!�%� )� ��� � � �#'�� �%9�T�%9�&)�&)��'�&)�&)��"��� )����!�!�!��-�-�/�/��!%��D�J��3�#(�� ��(�-�-�� 6�7�7�C��+�6�6�s�D�A�A�J��!�1�S�8�8��� � ��!3�!C�D�D�D�D��#�/�3�6�6��� � ��!3�!?�@�@�@��S� � ���c�z�z�� B�C�C�C�E# C�J ���Z�)�)�)� � � �S��_�_�$� � ��r+c�|�tj||j��|_|jt |��z|_dSr@)rgr�r�r�r7)r;r�s r*r�z_GzipReader._add_read_data s3���J�t�T�Y�/�/�� � �-��D� � �9����r+c��tjdt|jd����\}}||jkr4t dt |���dt |j�������||jdzkrt d���d}|dkr |j�d��}|dk� |r|j� |��dSdS) N�r�r�rr�r�r� __classcell__)r�s@r*r`r`�s�������� � � � � �������1�1�1�1�f:�:�:� � � �* � � � � � � � � r+r`r$�returnc ��|�tj��}|tkrd}n|tkrd}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. Nr r rz�"�1�"�+=�>�>� ��V� �$�*�\�*�*� *� *��0�1�1� 1� �c�,�'�'�*�4� 5� 5��A�B�B� B��#�#�L�1�1�1��~�a�b�b�!�(�(��1�1��#2r+c��ddlm}|d���}|���}|�ddd���|�d dd ���|�d d dd ���|�dddgd���|���}t }|jrt}n|jrt}|j D�]}|j r�|dkr3tddtjj���}tjj}n�|dd�dkrtjd|����t%|d��}t'j|dd�d��}nb|dkr4tjj}tddtjj|���}n(t'j|d��}t%|dzd��} |�t*j��}|sn|�|���8|tjjur|���|tjjur|������dS)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#rmrsrtzfilename doesn't end in .gz: �wb)r"r#rmr$)�argparser�add_mutually_exclusive_group� add_argument� parse_args�_COMPRESS_LEVEL_TRADEOFF�fastr��bestr�rrr�sys�stdin�buffer�stdout�exitrrZrrr�rr�) r�parser�grouprr$�argr<�gr�s r*�mainr2kss��'�'�'�'�'�'� �^� ,�-�-�-�F� � /� /� 1� 1�E� ���x� �;L��M�M�M� ���x� �;L��M�M�M� ���t�^�L�>��@�@�@� ����c�C�5�&��I�I�I� � � � � �D�,�M� �y�-�,� � � ��-�,� ��y���� �?� ,��c�z�z��b�t�S�Y�=M�N�N�N���J�%����r�s�s�8�u�$�$��H�D�S�D�D�E�E�E���d�O�O���M�#�c�r�c�(�D�1�1����c�z�z��I�$���b�t�S�Z�=N�+8�:�:�:����M�#�t�,�,����u��d�+�+�� ��F�F�2�1�2�2�E�� �� �G�G�E�N�N�N�  � �C�J�%� %� %� �G�G�I�I�I� �C�I�$� $� $� �G�G�I�I�I��5�r+�__main__r@)&rOr-r)r�rrgrZr� _compression�__all__�FTEXTr�r�r�r�r_rer�r&r�rr1r3r�r� BaseStreamrr�r��DecompressReaderr`r�rrrrr2rLrHr+r*�r9sS��%�%����������������� � � � ����� � � � ����� G� G� G��(6�%��u�f�e�X�� ��e��������,@��t�T�+�+�+�+�Z+�+�+� '�'�'�'�'�'�'�'�TA�A�A�A�A�'�A�A�A�V+�V+�V+�V+�V+�|�&�V+�V+�V+�r � � � "�"�"�Ja �a �a �a �a �,�/�a �a �a �J(,�K�K�c�K�05�K�K�K�K�*"6��������$2�2�2�2.�.�.�` �z����D�F�F�F�F�F��r+