
    [i                        d dl mZ d dlmZmZmZ  G d de      Ze G d de             Z G d de      Z	 	 	 	 dd	Z	 G d
 de      Z
y)    )annotations)AnyProtocolruntime_checkablec                       e Zd ZdZddZddZy)UntypedSerializerProtocolz:Protocol for serialization and deserialization of objects.c                     y N selfobjs     p/var/www/html/userprofiledev.eatanceapp.com/venv/lib/python3.12/site-packages/langgraph/checkpoint/serde/base.pydumpszUntypedSerializerProtocol.dumps	   s        c                     y r
   r   r   datas     r   loadszUntypedSerializerProtocol.loads   s    r   N)r   r   returnbytes)r   r   r   r   )__name__
__module____qualname____doc__r   r   r   r   r   r   r      s    D+,r   r   c                       e Zd ZdZddZddZy)SerializerProtocola  Protocol for serialization and deserialization of objects.

    - `dumps_typed`: Serialize an object to a tuple `(type, bytes)`.
    - `loads_typed`: Deserialize an object from a tuple `(type, bytes)`.

    Valid implementations include the `pickle`, `json` and `orjson` modules.
    c                     y r
   r   r   s     r   dumps_typedzSerializerProtocol.dumps_typed   s    #r   c                     y r
   r   r   s     r   loads_typedzSerializerProtocol.loads_typed   s    3r   Nr   r   r   tuple[str, bytes]r   r#   r   r   )r   r   r   r   r   r!   r   r   r   r   r      s     >>r   r   c                  $    e Zd ZddZddZddZy)SerializerCompatc                    || _         y r
   serde)r   r)   s     r   __init__zSerializerCompat.__init__   s	    
r   c                b    t        |      j                  | j                  j                  |      fS r
   )typer   r)   r   r   s     r   r   zSerializerCompat.dumps_typed!   s&    Cy!!4::#3#3C#888r   c                >    | j                   j                  |d         S )N   )r)   r   r   s     r   r!   zSerializerCompat.loads_typed$   s    zzQ((r   N)r)   r   r   Noner"   r$   )r   r   r   r*   r   r!   r   r   r   r&   r&      s    9)r   r&   c                <    t        | t              st        |       S | S )zmWrap serde old serde implementations in a class with loads_typed and dumps_typed for backwards compatibility.)
isinstancer   r&   r(   s    r   maybe_add_typed_methodsr2   (   s    
 e/0&&Lr   c                       e Zd ZdZddZddZy)CipherProtocolz~Protocol for encryption and decryption of data.

    - `encrypt`: Encrypt plaintext.
    - `decrypt`: Decrypt ciphertext.
    c                     y)z?Encrypt plaintext. Returns a tuple `(cipher name, ciphertext)`.Nr   )r   	plaintexts     r   encryptzCipherProtocol.encrypt:       r   c                     y)z*Decrypt ciphertext. Returns the plaintext.Nr   )r   
ciphername
ciphertexts      r   decryptzCipherProtocol.decrypt>   r8   r   N)r6   r   r   r#   )r:   strr;   r   r   r   )r   r   r   r   r7   r<   r   r   r   r4   r4   3   s    r   r4   N)r)   z.SerializerProtocol | UntypedSerializerProtocolr   r   )
__future__r   typingr   r   r   r   r   r&   r2   r4   r   r   r   <module>r@      sc    " 3 3- - ? ? ?)) )9X r   