HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: sport3497 (1034)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib64/python3.10/site-packages/botocore/__pycache__/response.cpython-310.pyc
o

�h;�@s�ddlZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
mZmZddlmZdd	l
mZdd
lmZe�e�ZGdd�de�Zd
d�ZdS)�N)�IOBase)�
ProtocolError)�ReadTimeoutError)�parsers)�set_socket_timeout)�IncompleteReadErrorr�ResponseStreamingError)�ScalarTypes)�
XMLParseError)�first_non_none_responsec@s�eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zd#dd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZeZedfdd�Zefdd�Zdd�Zdd �Zd!d"�ZdS)$�
StreamingBodyaeWrapper class for an http response body.

    This provides a few additional conveniences that do not exist
    in the urllib3 model:

        * Set the timeout on the socket (i.e read() timeouts)
        * Auto validation of content length, if the amount of bytes
          we read does not match the content length, an exception
          is raised.

    icCs||_||_d|_dS)Nr)�_raw_stream�_content_length�_amount_read)�self�
raw_stream�content_length�r�D/usr/local/CyberCP/lib/python3.10/site-packages/botocore/response.py�__init__5s
zStreamingBody.__init__cCsdS�Nr�rrrr�__del__:szStreamingBody.__del__cCs2z	t|j|�WdStytjddd��w)z&Set the timeout seconds on the socket.zbCannot access the socket object of a streaming response.  It's possible the interface has changed.T)�exc_infoN)rr
�AttributeError�logger�error)r�timeoutrrrr@s��z StreamingBody.set_socket_timeoutcCs"z|j��WStyYdSw)NF)r
�readablerrrrrrWs
�zStreamingBody.readableNc
Cs�z|j�|�}Wn#ty}zt|j|d��d}~wty+}zt|d��d}~ww|jt|�7_|dus?|sC|dkrC|�	�|S)zhRead at most amt bytes from the stream.

        If the amt argument is omitted, read all data.
        )�endpoint_urlrN)rr)
r
�read�URLLib3ReadTimeoutErrorr�url�URLLib3ProtocolErrorrr�len�_verify_content_length)r�amt�chunk�errrr ]s�
��zStreamingBody.readcC�
|j��Sr)r
�	readlinesrrrrr*q�
zStreamingBody.readlinescCs|�|j�S)z:Return an iterator to yield 1k chunks from the raw stream.)�iter_chunks�_DEFAULT_CHUNK_SIZErrrr�__iter__tszStreamingBody.__iter__cCs|�|j�}|r
|St��)z-Return the next 1k chunk from the raw stream.)r r-�
StopIteration)r�
current_chunkrrr�__next__xszStreamingBody.__next__cCs|jSr)r
rrrr�	__enter__szStreamingBody.__enter__cCs|j��dSr�r
�close)r�type�value�	tracebackrrr�__exit__�szStreamingBody.__exit__Fccsj�d}|�|�D]}||�d�}|dd�D]
}|�|�dVq|d}q|r3|�|�dVdSdS)z�Return an iterator to yield lines from the raw stream.

        This is achieved by reading chunk of bytes (of size chunk_size) at a
        time from the raw stream, and then yielding lines from there.
        �TN���r)r,�
splitlines)r�
chunk_size�keepends�pendingr'�lines�linerrr�
iter_lines�s�
�zStreamingBody.iter_linesccs"�	|�|�}|dkr
dS|Vq)z\Return an iterator to yield chunks of chunk_size bytes from the raw
        stream.
        Tr9N)r )rr<r0rrrr,�s�
�zStreamingBody.iter_chunkscCs6|jdur|jt|j�krt|jt|j�d��dSdS)N)�actual_bytes�expected_bytes)rr�intrrrrrr%�s���z$StreamingBody._verify_content_lengthcCr)r)r
�tellrrrrrE�r+zStreamingBody.tellcCs|j��dS)z*Close the underlying http response stream.Nr3rrrrr4�szStreamingBody.closer)�__name__�
__module__�__qualname__�__doc__r-rrrrr r*r.r1r2r8�nextrAr,r%rEr4rrrrr&s&

rcCsx|jd}|j|jd�}|ddkr|j|d<n|jr)t|j|d�d��|d<n|j|d<t�	|�}||�
||j�fS)N�protocol)�headers�status_coderMi,�bodyrLzcontent-length)�metadatarLrM�content�has_streaming_outputr�raw�getr�
create_parser�parse�output_shape)�operation_model�
http_responserK�
response_dict�parserrrr�get_response�s
�
�

�r[)�logging�ior�urllib3.exceptionsrr#rr!�botocorer�botocore.compatr�botocore.exceptionsrrr	r
�botocore.hooksr�	getLoggerrFrrr[rrrr�<module>s