Format: application/x-python-code
⬇ Download File (3.6 KB)
   1  o
   2  
   3  ��h��@s�dZddlZddlZddlmZddlZddlmZddl	m
   4  Z
   5  mZmZm
   6  Z
   7  mZmZdefdd�Zdefd	d
   8  �Zdefdd�Zd
   9  d�Zddd�ZdS)z/Find files and directories which IPython uses.
  10  �N)�warn)�import_item)�get_home_dir�get_xdg_dir�get_xdg_cache_dir�
  11  compress_user�
  12  _writable_dir�ensure_dir_exists�returnc	Cs\tj}tjj}d}t�}t�}d|vrtdt�|�d|�dd��}|dur`|||�}|r`||d�}t	|�r`t
  13  }tj�|�rKtd�||�||���ntj�
  14  |�r^td�||�||���n|}tj�tj�|��}tj�|�r�t	|�s�td	�|��t��}n#tj�|�s�tj�|�}t	|�s�td
  15  �|��t��}ntj|dd�t|t�s�Jd
  16  ��|S)z�Get the IPython directory for this platform and user.
  17  
  18      This uses the logic in `get_home_dir` to find the home directory
  19      and then adds .ipython to the end of the path.
  20      z.ipythonZIPYTHON_DIRzdThe environment variable IPYTHON_DIR is deprecated since IPython 3.0. Please use IPYTHONDIR instead.Z
  21  IPYTHONDIRN�ipythonzDIgnoring {0} in favour of {1}. Remove {0} to get rid of this messagez>{0} is deprecated. Move link to {1} to get rid of this messagezEIPython dir '{0}' is not a writable location, using a temp directory.zHIPython parent '{0}' is not a writable location, using a temp directory.T)�exist_okz:all path manipulation should be str(unicode), but are not.)�os�environ�path�joinrrr�DeprecationWarning�getrr�exists�format�islink�normpath�
  22  expanduser�tempfile�mkdtemp�dirname�makedirs�
  23  isinstance�str)	�env�pjoinZ	ipdir_defZhome_dirZxdg_dir�ipdirZ	xdg_ipdir�cu�parent�r#�Cc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/paths.py�get_ipython_dirsR�
  24  
  25  ���
  26  �
  27  r%cCsTt�}|dur
  28  t�Stj�|d�}tj�|�s!t|�r!t|�|St|�s(t�S|S)z;Get the cache directory it is created if it does not exist.Nr)rr%r
  29  rrrrr	)Zxdgdirr r#r#r$�get_ipython_cache_dirNs�r&cCs tj�tj�}t|t�sJ�|S)z9Get the base directory where IPython itself is installed.)r
  30  rr�IPython�__file__rr)r r#r#r$�get_ipython_package_dir\sr)cCs>|dkrtj�t�d�St|�}|j�dd�}|�dd�}|S)z�Find the path to an IPython module in this version of IPython.
  31  
  32      This will always find the version of the module that is in this importable
  33      IPython package. This will always return the path to the ``.py``
  34      version of the module.
  35      r'z__init__.pyz.pycz.pyz.pyo)r
  36  rrr)rr(�replace)Z
  37  module_str�modZthe_pathr#r#r$�get_ipython_module_pathcsr,�defaultc
  38  CsNddlm}m}z|�t�|�}W|jS|y&}ztd|�|�d}~ww)znFind the path to the folder associated with a given profile.
  39  
  40      I.e. find $IPYTHONDIR/profile_whatever.
  41      r)�
  42  ProfileDir�ProfileDirErrorzCouldn't find profile %rN)ZIPython.core.profiledirr.r/Zfind_profile_dir_by_namer%�IOError�location)Zprofiler.r/�pd�er#r#r$�locate_profilers���r4)r-)�__doc__Zos.pathr
  43  r�warningsrr'ZIPython.utils.importstringrZIPython.utils.pathrrrrrr	rr%r&r)r,r4r#r#r#r$�<module>s 
  44  ;