§
    `ƒiž	  ã                  óH   — d Z ddlmZ ddlmZ ddlmZ ddd„Zdd„ZddgZ	dS )a  Utilities for serializing and deserializing FFI object graphs.

These helpers produce a stable JSON graph representation that preserves
object identity and references. It is useful for debugging and for
lightweight persistence when pickling is not available.
é    )Úannotations)ÚAnyé   )Ú_ffi_apiNÚobjr   Úmetadataúdict[str, Any] | NoneÚreturnÚstrc                ó,   — t          j        | |¦  «        S )a©  Dump an object to a JSON graph string.

    The JSON graph is a textual representation of the object graph that
    preserves shared references. It can be used for debugging or simple
    persistence.

    Parameters
    ----------
    obj
        The object to save.

    metadata
        Extra metadata to save into the json graph string.

    Returns
    -------
    json_str
        The JSON graph string.

    Examples
    --------
    .. code-block:: python

        import tvm_ffi

        a = tvm_ffi.convert([1, 2, 3])
        s = tvm_ffi.serialization.to_json_graph_str(a)
        b = tvm_ffi.serialization.from_json_graph_str(s)
        assert list(b) == [1, 2, 3]

    )r   ÚToJSONGraphString)r   r   s     úi/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/tvm_ffi/serialization.pyÚto_json_graph_strr      s   € õ@ Ô% c¨8Ñ4Ô4Ð4ó    Újson_strc                ó*   — t          j        | ¦  «        S )aM  Load an object from a JSON graph string.

    The JSON graph string is produced by :py:func:`to_json_graph_str` and
    can be converted back into the corresponding FFI-backed objects.

    Parameters
    ----------
    json_str
        The JSON graph string to load.

    Returns
    -------
    obj
        The loaded object.

    )r   ÚFromJSONGraphString)r   s    r   Úfrom_json_graph_strr   B   s   € õ" Ô'¨Ñ1Ô1Ð1r   r   r   )N)r   r   r   r	   r
   r   )r   r   r
   r   )
Ú__doc__Ú
__future__r   Útypingr   Ú r   r   r   Ú__all__© r   r   ú<module>r      s†   ðð"ð ð #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð à Ð Ð Ð Ð Ð ð 5ð  5ð  5ð  5ð  5ðF2ð 2ð 2ð 2ð( !Ð"5Ð
6€€€r   