HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/site-packages/botocore/__pycache__/response.cpython-38.pyc
U

KD�g;�@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)�selfZ
raw_stream�content_length�r�>/opt/cppython/lib/python3.8/site-packages/botocore/response.py�__init__5szStreamingBody.__init__cCsdS�Nr�rrrr�__del__:szStreamingBody.__del__cCs:zt|j|�Wn$tk
r4tjddd��YnXdS)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��WStk
r"YdSXdS)NF)r
�readablerrrrrrWszStreamingBody.readableNc
Cs�z|j�|�}WnZtk
r@}zt|j|d��W5d}~XYn,tk
rj}zt|d��W5d}~XYnX|jt|�7_|dks�|s�|dkr�|�	�|S)zhRead at most amt bytes from the stream.

        If the amt argument is omitted, read all data.
        )Zendpoint_urlrN)rr)
r
�read�URLLib3ReadTimeoutErrorr�url�URLLib3ProtocolErrorrr�len�_verify_content_length)r�amt�chunk�errrr]szStreamingBody.readcCs
|j��Sr)r
�	readlinesrrrrr'qszStreamingBody.readlinescCs|�|j�S)z:Return an iterator to yield 1k chunks from the raw stream.)�iter_chunks�_DEFAULT_CHUNK_SIZErrrr�__iter__tszStreamingBody.__iter__cCs|�|j�}|r|St��dS)z-Return the next 1k chunk from the raw stream.N)rr)�
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__Fccsdd}|�|�D]<}||�d�}|dd�D]}|�|�dVq,|d}q|r`|�|�dVdS)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 |�|�}|dkrq|VqdS)z\Return an iterator to yield chunks of chunk_size bytes from the raw
        stream.
        r5N)r)rr8r,rrrr(�s
zStreamingBody.iter_chunkscCs2|jdk	r.|jt|j�kr.t|jt|j�d��dS)N)Zactual_bytesZexpected_bytes)rr�intrrrrrr#�s��z$StreamingBody._verify_content_lengthcCs
|j��Sr)r
�tellrrrrr?�szStreamingBody.tellcCs|j��dS)z*Close the underlying http response stream.Nr/rrrrr0�szStreamingBody.close)N)�__name__�
__module__�__qualname__�__doc__r)rrrrrr'r*r-r.r4�nextr=r(r#r?r0rrrrr&s$

rcCsx|jd}|j|jd�}|ddkr0|j|d<n,|jrRt|j|d�d��|d<n
|j|d<t�	|�}||�
||j�fS)N�protocol)�headers�status_coderGi,�bodyrFzcontent-length)�metadatarFrG�contentZhas_streaming_outputr�raw�getrZ
create_parser�parseZoutput_shape)Zoperation_model�
http_responserEZ
response_dict�parserrrr�get_response�s"
��


�rP)�logging�iorZurllib3.exceptionsrr!rrZbotocorerZbotocore.compatrZbotocore.exceptionsrrr	r
Zbotocore.hooksr�	getLoggerr@rrrPrrrr�<module>s