o
    h                     @  s   d dl mZ d dlmZ d dlmZmZ d dlmZm	Z	 d dl
mZ ddlmZ ddlmZ d	d
lmZ edZdddZdddZdddZdS )    )annotations)Iterable)AnyLiteral)TypeAdapterValidationError)TypeVar   )ModelBehaviorError)	SpanError   )attach_error_to_current_spanTjson_strstrtype_adapterTypeAdapter[T]partialboolreturnc              
   C  sf   |rdnd}z
|j | |d}|W S  ty2 } zttdi d td|  d| d| |d }~ww )	Nztrailing-stringsF)experimental_allow_partialzInvalid JSON provided)messagedatazInvalid JSON when parsing z for z; )validate_jsonr   r   r   r
   )r   r   r   partial_setting	validatede r   R/var/www/html/openai_agents/venv/lib/python3.10/site-packages/agents/util/_json.pyr      s&   
r   objr   c                 C  s   t | S )N_to_dump_compatible_internalr   r   r   r   _to_dump_compatible#   s   r#   c                 C  sd   t | trdd |  D S t | ttfrdd | D S t | tr0t | tttfs0dd | D S | S )Nc                 S  s   i | ]	\}}|t |qS r   r    ).0kvr   r   r   
<dictcomp>)   s    z0_to_dump_compatible_internal.<locals>.<dictcomp>c                 S     g | ]}t |qS r   r    r$   xr   r   r   
<listcomp>,       z0_to_dump_compatible_internal.<locals>.<listcomp>c                 S  r(   r   r    r)   r   r   r   r+   /   r,   )	
isinstancedictitemslisttupler   r   bytes	bytearrayr"   r   r   r   r!   '   s   
r!   N)r   r   r   r   r   r   r   r   )r   r   r   r   )
__future__r   collections.abcr   typingr   r   pydanticr   r   typing_extensionsr   
exceptionsr
   tracingr   _error_tracingr   r   r   r#   r!   r   r   r   r   <module>   s    

