o
    êÜÓh‘  ã                   @   s^   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d„Z	dS )	é    N)ÚAnyÚCallableÚIterableÚListÚTupleÚ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© ú^/var/www/html/ai/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    Útypingr   r   r   r   r   Ú__all__Ústrr   r   r   r   r   Ú<module>   s    ÿÿþ