
    +j                         U d dl Z d dlmZmZ  G d de          Z e j        dd          Ze j        ee                  ed<   dee         fdZ G d	 d
          Z	dS )    N)Optional
NamedTuplec                   >    e Zd ZU dZeed<   eed<   ee         ed<   dS )ExecutionContextz
    Context information about the currently executing node.

    Attributes:
        node_id: The ID of the currently executing node
        list_index: The index in a list being processed (for operations on batches/lists)
    	prompt_idnode_id
list_indexN)__name__
__module____qualname____doc__str__annotations__r   int     5/home/wildlama/comfy/ComfyUI/comfy_execution/utils.pyr   r      s@           NNNLLLr   r   current_executing_context)defaultreturnc                  6    t                               d           S N)r   getr   r   r   get_executing_contextr      s    $((...r   c                   @    e Zd ZdZd	dededee         fdZd Zd Z	dS )
CurrentNodeContexta>  
    Context manager for setting the current executing node context.

    Sets the current_executing_context on enter and resets it on exit.

    Example:
        with CurrentNodeContext(node_id="123", list_index=0):
            # Code that should run with the current node context set
            process_image()
    Nr   r   r	   c                 B    t          |||          | _        d | _        d S )N)r   r   r	   )r   contexttoken)selfr   r   r	   s       r   __init__zCurrentNodeContext.__init__    s.    ' "
 
 

 


r   c                 N    t                               | j                  | _        | S r   )r   setr   r   )r    s    r   	__enter__zCurrentNodeContext.__enter__(   s    .224<@@
r   c                 V    | j         !t                              | j                    d S d S r   )r   r   reset)r    exc_typeexc_valexc_tbs       r   __exit__zCurrentNodeContext.__exit__,   s.    :!%++DJ77777 "!r   r   )
r
   r   r   r   r   r   r   r!   r$   r*   r   r   r   r   r      sn        	 	 #  #      8 8 8 8 8r   r   )
contextvarstypingr   r   r   
ContextVarr   r   r   r   r   r   r   <module>r.      s         ' ' ' ' ' ' ' '
 
 
 
 
z 
 
 
 QgP[Pf  hC  MQ  QR  QR  QR ;1(;K2LM  R  R  R/x(89 / / / /8 8 8 8 8 8 8 8 8 8r   