
    (GgG                         d dl mZmZ d dlmZmZmZmZ d dlm	Z	 d dl
mZ d dlmZmZ  ed      Z ed      Z ed      Z G d	 d
eeeef   e      Zg dZy)    )ABCabstractmethod)AnyGenericSequenceTypeVar)Self)MISSING)EmptyChannelErrorInvalidUpdateErrorValueUpdateCc                       e Zd ZdZddededdfdZeedefd              Z	eedefd              Z
defd	Zdefd
Zededefd       Zedee   defd       Zedefd       ZdefdZdefdZy)BaseChannel)keytypr   r   returnNc                      || _         || _        y )N)r   r   )selfr   r   s      t/home/kushmeetdev/apache_webroot/langgraph_flaskproject/venv/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.checkpoint'   s'    	88:  	N	s    $$r#   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_checkpoint0   r   r   valuesc                      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   r(   s     r   updatezBaseChannel.update7   r   r   c                      y)zwReturn the current value of the channel.

        Raises EmptyChannelError if the channel is empty (never updated yet).Nr   r   s    r   r&   zBaseChannel.get@   r   r   c                      y)zMark the current value of the channel as consumed. By default, no-op.
        This is called by Pregel before the start of the next step, for all
        channels that triggered a node. If the channel was updated, return True.
        Fr   r   s    r   consumezBaseChannel.consumeF   s    
 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_availableM   s%    
	HHJ  		s    	) )__name__
__module____qualname__	__slots__r   strr   propertyr   r   r    r	   r$   r   r#   r"   r   r   boolr*   r   r&   r-   r/   r   r   r   r   r      s   IC c 4  ;3 ;  ; >C >  >
7d 7A  V! V V V EXf- E$ E E QU Q Q
 	d 	r   r   )r   r   r   N)abcr   r   typingr   r   r   r   typing_extensionsr	   langgraph.constantsr
   langgraph.errorsr   r   r   r   r   r   __all__r   r   r   <module>r>      sX    # 2 2 " ' B		CLH'%*+S HVr   