a
    ßñhÙ  ã                   @   s¨   d dl Z d dlZd dlZe j e j e¡¡dkrNe j e j e j e¡¡¡Zne j e j e¡¡Zdd„ Zdd„ Z	dd„ Z
d	d
„ Zdd„ Zddd„ZdZdZdZdZdS )é    NZsharedc                  G   s   t jjtg| ¢R Ž S ©N)ÚosÚpathÚjoinÚtorch_parent©Zpath_components© r   úU/home/yuhw/wc/uboone-dl-vtx/venv/lib/python3.9/site-packages/torch/_utils_internal.pyÚget_file_path   s    r
   c                  G   s   t jj| Ž S r   )r   r   r   r   r   r   r	   Úget_file_path_2   s    r   c                 C   s&   t  | t j¡r| S tjt j | ¡d�S )N)Úsuffix)r   ÚaccessÚW_OKÚtempfileÚmkdtempr   Úbasename©r   r   r   r	   Úget_writable_path   s    r   c                 C   s   d S r   r   r   r   r   r	   Ú#prepare_multiprocessing_environment    s    r   c                 C   s   t j | ¡S r   )r   r   Úrealpathr   r   r   r	   Úresolve_library_path$   s    r   c              
   C   sv   d}zt  | ¡}t  | ¡\}}W nJ tyj } z2d| › d�}|rL|d| 7 }t|ƒ|‚W Y d}~n
d}~0 0 |||fS )z{
    Wrapper around inspect.getsourcelines and inspect.getsourcefile.

    Returns: (sourcelines, file_lino, filename)
    NzCan't get source for zs. TorchScript requires source access in order to carry out compilation, make sure original .py files are available.Ú
)ÚinspectÚgetsourcefileÚgetsourcelinesÚOSError)ÚobjÚ	error_msgÚfilenameÚsourcelinesZfile_linenoÚeÚmsgr   r   r	   Úget_source_lines_and_file(   s    
 r"   z	127.0.0.1i<s  TF)N)r   r   r   r   r   ÚdirnameÚ__file__r   r
   r   r   r   r   r"   ZTEST_MASTER_ADDRZTEST_MASTER_PORTZUSE_GLOBAL_DEPSZUSE_RTLD_GLOBAL_WITH_LIBTORCHr   r   r   r	   Ú<module>   s   
