o
    i'                     @   sn   U d dl Z d dlmZmZ G dd deZe jdddZe jee  ed< dee fdd	ZG d
d dZ	dS )    N)Optional
NamedTuplec                   @   s.   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 r   r   3/mnt/c/Users/fbmor/ComfyUI/comfy_execution/utils.pyr      s
   
 r   current_executing_context)defaultreturnc                   C   s
   t d S N)r   getr   r   r   r   get_executing_context   s   
r   c                   @   s<   e Zd ZdZddededee fddZdd	 Zd
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                 C   s   t |||d| _d | _d S )N)r   r   r   )r   contexttoken)selfr   r   r   r   r   r   __init__    s   
zCurrentNodeContext.__init__c                 C   s   t | j| _| S r   )r   setr   r   )r   r   r   r   	__enter__(   s   zCurrentNodeContext.__enter__c                 C   s   | j d urt| j  d S d S r   )r   r   reset)r   exc_typeexc_valexc_tbr   r   r   __exit__,   s   
zCurrentNodeContext.__exit__r   )
r   r	   r
   r   r   r   r   r   r   r"   r   r   r   r   r      s
    
r   )
contextvarstypingr   r   r   
ContextVarr   r   r   r   r   r   r   r   <module>   s   
  