
    Ǆg                     d    d dl Z d dlmZmZmZmZmZ dgZdeegef   deeedf      dee   fdZ	y)	    N)AnyCallableIterableListTupletrace_dependenciescallableinputs.returnc                     t               fd}	 t        j                  |       |D ]  } | |  	 	 t        j                  d       t              S # t        j                  d       w xY w)a  Trace the execution of a callable in order to determine which modules it uses.

    Args:
        callable: The callable to execute and trace.
        inputs: The input to use during tracing. The modules used by 'callable' when invoked by each set of inputs
            are union-ed to determine all modules used by the callable for the purpooses of packaging.

    Returns: A list of the names of all modules used during callable execution.
    c                 z   |dk7  ry | j                   j                  }d }|| j                  v r| j                  |   j                  }n`|| j                  v r| j                  |   j                  }n8d| j                  v r*t        | j                  d   |d       }|r|j                  nd }|rj                  |       y y )Ncallself)f_codeco_name	f_globals
__module__f_localsgetattradd)frameeventargnamemodulemethodmodules_useds         p/home/mcse/projects/flask_80/flask-venv/lib/python3.12/site-packages/torch/package/analyze/trace_dependencies.pyrecord_used_modulesz/trace_dependencies.<locals>.record_used_modules   s     F? ||## 5??"__T*55FU^^#^^D)44Fu~~%U^^F3T4@F*0V&&dF V$     N)setsys
setprofilelist)r	   r
   r   inpr   s       @r   r   r   	   sd     5L%:
*+  	CcN	
 	t 	ts   !A A+)
r"   typingr   r   r   r   r   __all__strr    r    r   <module>r*      sQ    
 7 7  
 7ucz"7,4U38_,E7	#Y7r    