HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //proc/3407176/root/lib/python3/dist-packages/httplib2/__pycache__/decode.cpython-311.pyc
�

�+�jX���ddlmZddlZGd�de��ZGd�de��ZGd�de��ZGd	�d
e��Zdefd�ZGd
�de��Z	dS)�)�ProtocolNc��eZdZdZdS)�DecodeRatioErrorzBOutput-to-input amplification ratio exceeded the configured limit.N��__name__�
__module__�__qualname__�__doc__���1/usr/lib/python3/dist-packages/httplib2/decode.pyrrs������L�L�L�Lrrc��eZdZdZdS)�DecodeLimitErrorz,Total output length exceeded the hard limit.Nrrrr
rr	s������6�6�6�6rrc�\�eZdZedefd���Zdedefd�Zdefd�Zddede	defd	�Z
d
S)�DecoderProtocol�returnc��dS�Nr��selfs r
�needs_inputzDecoderProtocol.needs_inputs���r�bc��dSrr�rrs  r
�decodezDecoderProtocol.decode����rc��dSrrrs r
�flushzDecoderProtocol.flushrr��data�
chunk_sizec�`�t��}|dkrt|��}tdt|��|��D]7}||||z�}|�|�|�����8|�|�����t
|��S)Nr)�	bytearray�len�range�extendrr�bytes)rr r!�out�i�chunks      r
�
consume_byteszDecoderProtocol.consume_bytess����k�k����?�?��T���J��q�#�d�)�)�Z�0�0�	+�	+�A���Q��^�+�,�E��J�J�t�{�{�5�)�)�*�*�*�*��
�
�4�:�:�<�<� � � ��S�z�z�rN)r)rrr	�property�boolrr'rr�intr+rrr
rr
s�������
��T�����X�����%������u�������%��S��������rrc�n�eZdZdZdZdZdZdZdZefde	fd�Z
ed	efd
���Z
ded	efd�Zd	efd
�ZdS)�ZlibDecodera#
    Thin wrapper around zlib.Decompressor conforming to the Decoder interface.

    Note: zlib pushes all available decompressed data immediately upon receiving
    input. It never holds back output requiring `decode(b"")` to extract it.
    Thus, `needs_input` naturally remains True.
    )�_decoderi����/�wbitsc�8�tj|��|_dSr)�zlib�
decompressobjr1)rr5s  r
�__init__zZlibDecoder.__init__3s��15�1C�E�1J�1J��
�
�
rrc�H�|j�td���|jjS�Nzused after flush())r1�RuntimeError�eofrs r
rzZlibDecoder.needs_input6s'���=� ��3�4�4�4��=�$�$�$rrc�b�|j�td���|j�|��Sr;)r1r<�
decompressrs  r
rzZlibDecoder.decode<s/���=� ��3�4�4�4��}�'�'��*�*�*rc�r�|j�td���|j���}d|_|Sr;)r1r<r)r�results  r
rzZlibDecoder.flushAs8���=� ��3�4�4�4���$�$�&�&����
��
rN)rrr	r
�	__slots__�
WBITS_DEFLATE�
WBITS_ZLIB�
WBITS_GZIP�WBITS_AUTO_GZIP_ZLIBr.r9r,r-rr'rrrrr
r0r0#s����������I��M��J��J�"��$8�K�K�c�K�K�K�K��%�T�%�%�%��X�%�
+��+�%�+�+�+�+�
�u������rr0rc�4�ttj��Sr)r0rCrrr
�DeflateDecoderrHIs���{�0�1�1�1rc
��eZdZdZ				ddededed	ed
eddfd
�Zdd�Ze	de
fd���Zdedefd�Z
defd�Zdedefd�ZdS)�LimitDecoder)	r1�_ratio�_chunk_size�_safe_limit�_hard_limit�_consumed_length�_output_length�
_input_buffer�_flushed�dr���
�decoder�ratior!�
safe_limit�
hard_limitrNc�d�|dkrtd|�d����|dkrtd|�d����|dkrtd|�d����|dkrtd|�d����||_||_||_||_||_d|_d|_t��|_	d|_
dS)NrzLimitDecoder() ratio=z expected >= 0zLimitDecoder() chunk_size=zLimitDecoder() safe_limit=F)�
ValueErrorr1rKrLrMrNrOrPr#rQrR)rrVrWr!rXrYs      r
r9zLimitDecoder.__init__Zs����1�9�9��J�U�J�J�J�K�K�K���>�>��T�*�T�T�T�U�U�U���>�>��T�*�T�T�T�U�U�U���>�>��T�*�T�T�T�U�U�U�)0��
�"��� *��� *��� *���%&���#$���(1�����#��
�
�
rc
��|jdkr/|j|jkrtd|j�d|j�����|jdkr|j|jkrdS|jdkrl|j|j|jzkrV|jdkr|j|jznt
d��}td|d�d|j�d|j�d	|j�����dSdS)
NrzOutput length z exceeds hard limit �infzAmplification ratio z.1fz (�/z) exceeds limit )rNrPrrMrKrO�floatr)r�actual_ratios  r
�
_check_limitszLimitDecoder._check_limitsus����q� � �t�':�T�=M�'M�'M�"�#o�D�4G�#o�#o�]a�]m�#o�#o�p�p�p���q� � �t�':�T�=M�'M�'M��F��K�!�O�O�$�"5��8M�PT�P[�8[�"[�"[�JN�J_�bc�Jc�Jc�4�.��1F�F�F�in�ot�iu�iu�L�"�0�|�i�0�0�4�;N�0�0�QU�Qf�0�0�"&�+�0�0���
�
�O�"[�"[rc��|jjSr)r1rrs r
rzLimitDecoder.needs_input�s
���}�(�(rrc�v�|jrtd���|�|��}t|��S)Nzdecode() called after flush())rRr<�_pumpr')rr�outputs   r
rzLimitDecoder.decode�s7���=�	@��>�?�?�?����A�����V�}�}�rc�B�|jrtd���d|_|�d��}|j���}|�|��|xjt|��z
c_|���t|��S)Nzflush() called more than onceTr)
rRr<rdr1rr&rPr$rar')rrer s   r
rzLimitDecoder.flush�s����=�	@��>�?�?�?���
����C�����}�"�"�$�$���
�
�d�������s�4�y�y�(����������V�}�}�rc��|j�|��t��}	|jjsc|j�d��}|rG|�|��|xjt|��z
c_|����p|jr�t|jd|j
���}|jd|j
�=|j�|��}|xjt|��z
c_|rF|�|��|xjt|��z
c_|�����(	|S)NTr)rQr&r#r1rrrPr$rar'rLrO)rrrer r*s     r
rdzLimitDecoder._pump�sQ����!�!�!�$�$�$�����	��=�,�
��}�+�+�C�0�0�����M�M�$�'�'�'��'�'�3�t�9�9�4�'�'��&�&�(�(�(���!�
��d�0�1C�4�3C�1C�D�E�E���&�'9��)9�'9�:��}�+�+�E�2�2���%�%��U���3�%�%��)��M�M�$�'�'�'��'�'�3�t�9�9�4�'�'��&�&�(�(�(��
��
r)rSrrTrU)rN)rrr	rBrr_r.r9rar,r-rr'rrr#rdrrr
rJrJMs������
�I��"�"�"�
$�$� �$��$��	$�
�$��
$�
�$�$�$�$�6
�
�
�
��)�T�)�)�)��X�)����%������u������u��������rrJ)
�typingrr7�	Exceptionrrrr0rHrJrrr
�<module>rjs*������������M�M�M�M�M�y�M�M�M�7�7�7�7�7�y�7�7�7������h����,#�#�#�#�#�/�#�#�#�L2��2�2�2�2�j�j�j�j�j�?�j�j�j�j�jr