
    <i                        S SK Jr  S SKJrJrJr   " S S\5      r\ " S S\5      5       r " S S\5      r    SS	 jr	 " S
 S\5      r
g)    )annotations)AnyProtocolruntime_checkablec                  ,    \ rS rSrSrSS jrSS jrSrg)	UntypedSerializerProtocol   z:Protocol for serialization and deserialization of objects.c                    g N selfobjs     o/home/dmtnaga/Documents/work/airagagent/rag_env/lib/python3.13/site-packages/langgraph/checkpoint/serde/base.pydumpsUntypedSerializerProtocol.dumps	   s        c                    g r   r   r   datas     r   loadsUntypedSerializerProtocol.loads   s    r   r   N)r   r   returnbytes)r   r   r   r   )__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes__r   r   r   r   r      s    D+,r   r   c                  ,    \ rS rSrSrSS jrSS jrSrg)	SerializerProtocol   ab  Protocol for serialization and deserialization of objects.

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

Valid implementations include the `pickle`, `json` and `orjson` modules.
c                    g r   r   r   s     r   dumps_typedSerializerProtocol.dumps_typed   s    #r   c                    g r   r   r   s     r   loads_typedSerializerProtocol.loads_typed   s    3r   r   Nr   r   r   tuple[str, bytes]r   r+   r   r   )r   r   r   r   r   r%   r(   r    r   r   r   r"   r"      s     >>r   r"   c                  2    \ rS rSrSS jrSS jrS	S jrSrg)
SerializerCompat   c                    Xl         g r   serde)r   r2   s     r   __init__SerializerCompat.__init__    s    
r   c                b    [        U5      R                  U R                  R                  U5      4$ r   )typer   r2   r   r   s     r   r%   SerializerCompat.dumps_typed#   s&    Cy!!4::#3#3C#888r   c                >    U R                   R                  US   5      $ )N   )r2   r   r   s     r   r(   SerializerCompat.loads_typed&   s    zzQ((r   r1   N)r2   r   r   Noner*   r,   )r   r   r   r   r3   r%   r(   r    r   r   r   r.   r.      s    9)r   r.   c                F    [        U [        5      (       d  [        U 5      $ U $ )zmWrap serde old serde implementations in a class with loads_typed and dumps_typed for backwards compatibility.)
isinstancer"   r.   r1   s    r   maybe_add_typed_methodsr>   *   s"    
 e/00&&Lr   c                  ,    \ rS rSrSrSS jrSS jrSrg)	CipherProtocol5   zqProtocol for encryption and decryption of data.
- `encrypt`: Encrypt plaintext.
- `decrypt`: Decrypt ciphertext.
c                    g)z=Encrypt plaintext. Returns a tuple (cipher name, ciphertext).Nr   )r   	plaintexts     r   encryptCipherProtocol.encrypt;       r   c                    g)z*Decrypt ciphertext. Returns the plaintext.Nr   )r   
ciphername
ciphertexts      r   decryptCipherProtocol.decrypt?   rF   r   r   N)rC   r   r   r+   )rH   strrI   r   r   r   )r   r   r   r   r   rD   rJ   r    r   r   r   r@   r@   5   s    
r   r@   N)r2   z.SerializerProtocol | UntypedSerializerProtocolr   r"   )
__future__r   typingr   r   r   r   r"   r.   r>   r@   r   r   r   <module>rO      sc    " 3 3- - ? ? ? )) )9X r   