3
I4W^D  ã               @   s®   d dl mZmZmZmZ d dlZd dlZejjejj	e
ƒƒdkr^ejj	ejj	ejj	e
ƒƒƒZnejj	ejj	e
ƒƒZdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Zdd„ ZdZdZdS )é    )Úabsolute_importÚdivisionÚprint_functionÚunicode_literalsNZsharedc              G   s   t jjtf| žŽ S )N)ÚosÚpathÚjoinÚtorch_parent)Úpath_components© r   ú6/tmp/pip-build-e66j97b2/torch/torch/_utils_internal.pyÚget_file_path   s    r   c              G   s   t jj| Ž S )N)r   r   r   )r
   r   r   r   Úget_file_path_2   s    r   c             C   s   | S )Nr   )r   r   r   r   Úget_writable_path   s    r   c             C   s   d S )Nr   )r   r   r   r   Ú#prepare_multiprocessing_environment   s    r   c             C   s   t jj| ƒS )N)r   r   Úrealpath)r   r   r   r   Úresolve_library_path!   s    r   c             C   s^   d}yt j| ƒ}t j| ƒ\}}W n2 tk
rR } ztdj||ƒƒ‚W Y dd}~X nX |||fS )z{
    Wrapper around inspect.getsourcelines and inspect.getsourcefile.

    Returns: (sourcelines, file_lino, filename)
    Nz_Can't get source for {}. TorchScript requires source access in order to carry out compilation. z>Make sure original .py files are available. Original error: {}z�Can't get source for {}. TorchScript requires source access in order to carry out compilation. Make sure original .py files are available. Original error: {})ÚinspectÚgetsourcefileÚgetsourcelinesÚOSErrorÚformat)ÚobjÚfilenameÚsourcelinesZfile_linenoÚer   r   r   Úget_source_lines_and_file%   s    
  r   z	127.0.0.1i<s  )Ú
__future__r   r   r   r   r   r   r   ÚbasenameÚdirnameÚ__file__r	   r   r   r   r   r   r   ZTEST_MASTER_ADDRZTEST_MASTER_PORTr   r   r   r   Ú<module>   s   