� c��j1��� ddlZddlZejZGd�dej�ZGd�dej �Zy)�Nc�&�eZdZ d�Zd�Zd�Zd�Zy)� BaseStreamc�2�|jr td��y)NzI/O operation on closed file)�closed� ValueError��selfs �%/usr/lib64/python3.12/_compression.py�_check_not_closedzBaseStream._check_not_closed s�� �;�;��;�<� <� �c�N�|j�stjd��y)NzFile not open for reading)�readable�io�UnsupportedOperationrs r �_check_can_readzBaseStream._check_can_read�"���}�}���)�)�*E�F� F�r c�N�|j�stjd��y)NzFile not open for writing)�writablerrrs r �_check_can_writezBaseStream._check_can_writerr c��|j�stjd��|j�stjd��y)Nz3Seeking is only supported on files open for readingz3The underlying file object does not support seeking)rrr�seekablers r �_check_can_seekzBaseStream._check_can_seeksO���}�}���)�)�+F�G� G��}�}���)�)�+E�F� F�r N)�__name__� __module__� __qualname__r rrr�r r rr s��)�=�G�G�Fr rc�r��eZdZ d�Zd d�Z�fd�Zd�Zd�Zd d�Zd�Z d�Z e jfd �Z d �Z�xZS) �DecompressReaderc��y)NTrrs r rzDecompressReader.readable$s��r c ��||_d|_d|_d|_||_||_|jdi|j ��|_||_y)NFr�����r)�_fp�_eof�_pos�_size�_decomp_factory� _decomp_args� _decompressor�_trailing_error)r �fp�decomp_factory�trailing_error� decomp_argss r �__init__zDecompressReader.__init__'sZ������� ��� ��� � .���'���1�T�1�1�F�D�4E�4E�F��� .��r c�.��d|_t�|� �S�N)r(�super�close)r � __class__s �r r2zDecompressReader.close;s���!����w�}��r c�6�|jj�Sr0)r"rrs r rzDecompressReader.seekable?s���x�x� � �"�"r c��t|�5}|jd�5}|jt|��}||dt|�ddd�ddd�t�S#1swY�xYw#1swYt�SxYw)N�B)� memoryview�cast�read�len)r �b�view� byte_view�datas r �readintozDecompressReader.readintoBsc�� ��]�d�D�I�I�c�N�i��9�9�S��^�,�D�$(�I�j�s�4�y� !�%3�]��4�y��%3�N��]��4�y��s"�A.�)A"�A.�"A+ �'A.�.Bc���|dkr|j�S|r |jryd} |jjry|jjxs|j j t�}|sn�|jdi|j��|_ |jj||�}n`|jjr,|j j t�}|s td��d}|jj||�}|rn��|sd|_|j|_y|xjt!|�z c_|S#|j$rY�LwxYw)Nrr TzACompressed file ended before the end-of-stream marker was reachedr)�readallr#r(�eof� unused_datar"r9� BUFFER_SIZEr&r'� decompressr)� needs_input�EOFErrorr$r%r:)r �sizer>�rawblocks r r9zDecompressReader.readHsY�� �!�8��<�<�>� !��t�y�y������!�!�%�%� �.�.�:�:�7� �H�H�M�M�+�6����%9�T�%9�%9�&)��'�'�&)��"���-�-�8�8��4�H�D� �%�%�1�1�#�x�x�}�}�[�9�H�#�&�(J�K�K� #�H��)�)�4�4�X�t�D����1�2��D�I����D�J�� � � �S��Y�� �� ��'�+�+����s�E�E(�'E(c���g}|jtj�x}r3|j|�|jtj�x}r�3dj |�S)Nr )r9�sys�maxsize�append�join)r �chunksr>s r rAzDecompressReader.readallqsX�����i�i�� � �,�,�d�,� �M�M�$� ��i�i�� � �,�,�d�,��x�x���r c��|jjd�d|_d|_|jdi|j ��|_y)NrFr)r"�seekr#r$r&r'r(rs r �_rewindzDecompressReader._rewind|s>�� ��� � �a���� ��� �1�T�1�1�F�D�4E�4E�F��r c��|tjk(rn�|tjk(r|j|z}n�|tjk(r_|j dkr@|j tj�r! |j tj�r�!|j |z}ntdj|���||jkr|j�n||jz}|dkDrL|j ttj|��}|s |jS|t|�z}|dkDr�L|jS)NrzInvalid value for whence: {}) r�SEEK_SET�SEEK_CURr$�SEEK_ENDr%r9�DEFAULT_BUFFER_SIZEr�formatrR�minr:)r �offset�whencer>s r rQzDecompressReader.seek�s�� �R�[�[� � � �r�{�{� "��Y�Y��'�F� �r�{�{� "��z�z�A�~��i�i�� 6� 6�7���i�i�� 6� 6�7��Z�Z�&�(�F��;�B�B�6�J�K� K� �D�I�I� � �L�L�N� �d�i�i� �F��q�j��9�9�S��!7�!7��@�A�D����y�y�� �c�$�i� �F� �q�j� �y�y�r c�� |jSr0)r$rs r �tellzDecompressReader.tell�s��/��y�y�r )r)r!)rrrrr.r2rr?r9rArRrrTrQr]� __classcell__)r3s@r rr!sC���?��.�(�#�� '�R �G� #%�+�+��<r r)rrKrWrD�BufferedIOBaser� RawIOBaserrr r �ras?��=� � ��$�$� �F��"�"�F�0A�r�|�|�Ar