
    ug                         d dl mZ d dlmZmZmZmZmZ d dlm	Z	 d dl
Z
 edd      Z G d d	ee         Z G d
 dee         Zy)    )abstractmethod)AnyDictGenericProtocolTypeVar)SelfNTT)	covariantc                   p    e Zd ZdZdefdZededefd       Zde	ee
f   fdZede	ee
f   defd       Zy	)
JSONSerializablez>A generic interface for objects that can be serialized to JSONreturnc                      y)Serializes the object to JSONN selfs    C/var/www/openai/venv/lib/python3.12/site-packages/chromadb/serde.pyto_json_strzJSONSerializable.to_json_str           json_strc                      yz!Deserializes the object from JSONNr   )clsr   s     r   from_json_strzJSONSerializable.from_json_str        	r   c                      y)5Serializes the object to a JSON compatible dictionaryNr   r   s    r   to_jsonzJSONSerializable.to_json   r   r   json_mapc                      yr   r   r   r!   s     r   	from_jsonzJSONSerializable.from_json   r   r   N)__name__
__module____qualname____doc__strr   classmethodr	   r   r   r   r    r$   r   r   r   r   r   	   sq    HS  S T  c3h  c3h D  r   r   c                   v    e Zd ZdZdefdZdeeef   fdZe	defd       Z
ee	deeef   defd              Zy)	BaseModelJSONSerializablezCA mixin for BaseModels that allows a class to be serialized to JSONr   c                 "    | j                         S )r   )model_dump_jsonr   s    r   r   z%BaseModelJSONSerializable.to_json_str"   s    ##%%r   c                 H    t        j                  | j                               S )r   )jsonloadsr.   r   s    r   r    z!BaseModelJSONSerializable.to_json&   s    zz$..011r   c                      y)zDAbstract method that should be implemented to dump the model to JSONNr   r   s    r   r.   z)BaseModelJSONSerializable.model_dump_json*   s     	r   r!   c                      yr   r   r#   s     r   r$   z#BaseModelJSONSerializable.from_json/   s     	r   N)r%   r&   r'   r(   r)   r   r   r   r    r   r.   r*   r
   r$   r   r   r   r,   r,      sr    M&S &2c3h 2    c3h A   r   r,   )abcr   typingr   r   r   r   r   typing_extensionsr	   r0   r
   r   r,   r   r   r   <module>r7      s@     8 8 " C4 x{ ,
 r   