HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/openai/lib/streaming/__pycache__/_deltas.cpython-310.pyc
o

���g�	�@s*ddlmZddlmZmZddd	�Zd
S)�)�annotations�)�is_dict�is_list�acc�dict[object, object]�delta�returnc	Cs�|��D]�\}}||vr|||<q||}|dur|||<q|dks&|dkr+|||<qt|t�r:t|t�r:||7}n�t|ttf�rMt|ttf�rM||7}n�t|�r[t|�r[t||�}nst|�r�t|�r�tdd�|D��rr|�	|�q|D]Y}t|�s�t
d|����z|d}Wnty�}ztd|���|�d}~wwt|t�s�t
d|����z||}Wnt
y�|�||�Yqtwt|�s�t
d��t||�||<qt|||<q|S)	N�index�typecss �|]}t|tttf�VqdS)N)�
isinstance�str�int�float)�.0�x�r�G/usr/local/lib/python3.10/dist-packages/openai/lib/streaming/_deltas.py�	<genexpr>$s�z#accumulate_delta.<locals>.<genexpr>z1Unexpected list delta entry is not a dictionary: z2Expected list delta entry to have an `index` key; z>Unexpected, list delta entry `index` value is not an integer; znot handled yet)�itemsrr
rrr�accumulate_deltar�all�extend�	TypeError�KeyError�RuntimeError�
IndexError�insert)	rr�key�delta_value�	acc_value�delta_entryr
�exc�	acc_entryrrrrsT


��
�
rN)rrrrr	r)�
__future__r�_utilsrrrrrrr�<module>s