
    +j                         % S SK r S SKJrJr   " S S\5      r\ R
                  " SSS9r\ R
                  \\      \S'   S\\   4S jr " S	 S
5      r	g)    N)Optional
NamedTuplec                   >    \ rS rSr% Sr\\S'   \\S'   \\   \S'   Sr	g)ExecutionContext   z
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_index N)
__name__
__module____qualname____firstlineno____doc__str__annotations__r   int__static_attributes__r       5/home/wildlama/comfy/ComfyUI/comfy_execution/utils.pyr   r      s     NLr   r   current_executing_context)defaultreturnc                  ,    [         R                  S 5      $ N)r   getr   r   r   get_executing_contextr      s    $((..r   c                   D    \ rS rSrSrSS\S\S\\   4S jjrS r	S	 r
S
rg)CurrentNodeContext   a"  
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                 2    [        UUUS9U l        S U l        g )N)r   r	   r
   )r   contexttoken)selfr   r	   r
   s       r   __init__CurrentNodeContext.__init__    s     ' "

 
r   c                 N    [         R                  U R                  5      U l        U $ r   )r   setr"   r#   )r$   s    r   	__enter__CurrentNodeContext.__enter__(   s    .224<<@
r   c                 ^    U R                   b   [        R                  U R                   5        g g r   )r#   r   reset)r$   exc_typeexc_valexc_tbs       r   __exit__CurrentNodeContext.__exit__,   s#    ::!%++DJJ7 "r   )r"   r#   r   )r   r   r   r   r   r   r   r   r%   r)   r0   r   r   r   r   r   r      s/    	#  # 8r   r   )
contextvarstypingr   r   r   
ContextVarr   r   r   r   r   r   r   <module>r5      sq     '
z 
 Q\PfPf  hC  MQ  QR ;11(;K2LM  R/x(89 /8 8r   