
    ^(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	y)    N)Optional
NamedTuplec                   6    e Zd ZU dZeed<   eed<   ee   ed<   y)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     ?/Users/danicosta/Desktop/Flux2/ComfyUI/comfy_execution/utils.pyr   r      s     NLr   r   current_executing_context)defaultreturnc                  ,    t         j                  d       S N)r   getr   r   r   get_executing_contextr      s    $((..r   c                   8    e Zd ZdZd	dededee   fdZd Zd Z	y)
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                 8    t        |||      | _        d | _        y )N)r   r   r	   )r   contexttoken)selfr   r   r	   s       r   __init__zCurrentNodeContext.__init__    s     ' "

 
r   c                 N    t         j                  | j                        | _        | S r   )r   setr   r   )r    s    r   	__enter__zCurrentNodeContext.__enter__(   s    .224<<@
r   c                 \    | j                    t        j                  | j                          y y r   )r   r   reset)r    exc_typeexc_valexc_tbs       r   __exit__zCurrentNodeContext.__exit__,   s#    ::!%++DJJ7 "r   r   )
r
   r   r   r   r   r   r   r!   r$   r*   r   r   r   r   r      s/    	#  # 8r   r   )
contextvarstypingr   r   r   
ContextVarr   r   r   r   r   r   r   <module>r.      st     '
z 
 QgP[PfPf  hC  MQ  QR ;11(;K2LM  R/x(89 /8 8r   