
    9i;                        d dl mZ d dlmZmZ d dlmZ d dlmZm	Z	m
Z
 d dlmZ d dlmZ d dlmZ  e
d      Z e
d	      Z e
d
      ZdZ G d de	eeef   e      Zy)    )annotations)ABCabstractmethod)Sequence)AnyGenericTypeVar)Self)MISSING)EmptyChannelErrorValueUpdate
Checkpoint)BaseChannelc                      e Zd ZdZdZdddZeedd              Zeedd              Z	ddZ
ddZedd       Zedd	       Zdd
Zedd       ZddZddZy)r   zBase class for all channels.)keytypc                     || _         || _        y )N)r   r   )selfr   r   s      a/var/www/html/backtest/airagagent/rag_env/lib/python3.12/site-packages/langgraph/channels/base.py__init__zBaseChannel.__init__   s        c                     y)z,The type of the value stored in the channel.N r   s    r   	ValueTypezBaseChannel.ValueType       r   c                     y)z/The type of the update received by the channel.Nr   r   s    r   
UpdateTypezBaseChannel.UpdateType!   r   r   c                @    | j                  | j                               S )zReturn a copy of the channel.

        By default, delegates to `checkpoint()` and `from_checkpoint()`.

        Subclasses can override this method with a more efficient implementation.
        )from_checkpoint
checkpointr   s    r   copyzBaseChannel.copy(   s     ##DOO$566r   c                N    	 | j                         S # t        $ r	 t        cY S w xY w)zReturn a serializable representation of the channel's current state.

        Raises `EmptyChannelError` if the channel is empty (never updated yet),
        or doesn't support checkpoints.
        )getr   r   r   s    r   r"   zBaseChannel.checkpoint1   s'    	88:  	N	s    $$c                     y)zReturn a new identical channel, optionally initialized from a checkpoint.

        If the checkpoint contains complex data structures, they should be copied.
        Nr   )r   r"   s     r   r!   zBaseChannel.from_checkpoint<   r   r   c                     y)zyReturn the current value of the channel.

        Raises `EmptyChannelError` if the channel is empty (never updated yet).Nr   r   s    r   r%   zBaseChannel.getE   r   r   c                D    	 | j                          y# t        $ r Y yw xY w)zReturn `True` if the channel is available (not empty), `False` otherwise.

        Subclasses should override this method to provide a more efficient
        implementation than calling `get()` and catching `EmptyChannelError`.
        TF)r%   r   r   s    r   is_availablezBaseChannel.is_availableK   s%    	HHJ  		s    	c                     y)a  Update the channel's value with the given sequence of updates.
        The order of the updates in the sequence is arbitrary.
        This method is called by Pregel for all channels at the end of each step.

        If there are no updates, it is called with an empty sequence.

        Raises `InvalidUpdateError` if the sequence of updates is invalid.

        Returns `True` if the channel was updated, `False` otherwise.Nr   )r   valuess     r   updatezBaseChannel.updateY   r   r   c                     y)a  Notify the channel that a subscribed task ran.

        By default, no-op.

        A channel can use this method to modify its state, preventing the value from being consumed again.

        Returns `True` if the channel was updated, `False` otherwise.
        Fr   r   s    r   consumezBaseChannel.consumee        r   c                     y)zNotify the channel that the Pregel run is finishing.

        By default, no-op.

        A channel can use this method to modify its state, preventing finish.

        Returns `True` if the channel was updated, `False` otherwise.
        Fr   r   s    r   finishzBaseChannel.finishp   r/   r   N) )r   r   r   strreturnNone)r4   r   )r4   r
   )r4   Checkpoint | Any)r"   r6   r4   r
   )r4   r   )r4   bool)r+   zSequence[Update]r4   r7   )__name__
__module____qualname____doc__	__slots__r   propertyr   r   r   r#   r"   r!   r%   r)   r,   r.   r1   r   r   r   r   r      s    &I ;  ; >  >
7	   S S

 	I 	I		r   r   N)
__future__r   abcr   r   collections.abcr   typingr   r   r	   typing_extensionsr
   langgraph._internal._typingr   langgraph.errorsr   r   r   r   __all__r   r   r   r   <module>rF      s\    " # $ ( ( " / .		\"

f'%34c fr   