o
    i                     @   s^   d dl Z d dlmZ d dlmZmZ dgZdeegef deeedf  dee	 fd	dZ
dS )
    N)Iterable)AnyCallabletrace_dependenciescallableinputs.returnc              	      sP   t    fdd}zt| |D ]}| |  qW td t S td 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                    s   |dkrd S | j j}d }|| jv r| j| j}n!|| jv r$| j| j}nd| jv r9t| jd |d }|r7|jnd }|rB | d S d S )Ncallself)f_codeco_name	f_globals
__module__f_localsgetattradd)frameeventargnamemodulemethodmodules_used e/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/torch/package/analyze/trace_dependencies.pyrecord_used_modules   s   
	

z/trace_dependencies.<locals>.record_used_modulesN)setsys
setprofilelist)r   r   r   inpr   r   r   r   
   s   


)r   collections.abcr   typingr   r   __all__tupler    strr   r   r   r   r   <module>   s   