U
    5Ç-e‘  ã                   @   sZ   d dl Z d dlmZmZmZmZmZ dgZeegef eeedf  ee dœdd„Z	dS )é    N)ÚAnyÚCallableÚIterableÚListÚTupleÚtrace_dependencies.)ÚcallableÚinputsÚreturnc              	      sH   t ƒ ‰ ‡ fdd„}z t |¡ |D ]}| |Ž  q"W 5 t d¡ X tˆ ƒS )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kr0| j| j}nB|| jkrH| j| j}n*d| jkrrt| jd |d ƒ}|rn|jnd }|r€ˆ  |¡ d S )NÚcallÚself)Úf_codeÚco_nameÚ	f_globalsÚ
__module__Úf_localsÚgetattrÚadd)ÚframeÚeventÚargÚnameÚmoduleÚmethod©Zmodules_used© úi/var/www/html/Darija-Ai-Train/env/lib/python3.8/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   Zinpr   r   r   r      s    
)
r   Útypingr   r   r   r   r   Ú__all__Ústrr   r   r   r   r   Ú<module>   s    þ