Format: application/x-python-code
1 o
2
3 ��h� � @ s� d Z ddlZddlZddlmZ ddlZddlmZ ddl m
4 Z
5 mZmZm
6 Z
7 mZmZ defdd�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 C s\ t j} t jj}d}t� }t� }d| v rtdt� | �d| �dd��}|du r`|||�}|r`||d�}t |�r`t
13 }t j�|�rKtd�||�||��� nt j�
14 |�r^td�||�||��� n|}t j�t j�|��}t j�|�r�t |�s�td �|�� t�� }n#t j�|�s�t j�|�}t |�s�td
15 �|�� t�� }nt j|dd� t|t�s�J d
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�joinr r r �DeprecationWarning�getr r �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_dir sR �
24
25 ���
26 �
27 r% c C sT t � } | du r
28 t� S tj�| d�}tj�|�s!t| �r!t|� |S t| �s(t� S |S )z;Get the cache directory it is created if it does not exist.Nr )r r% r
29 r r r r r )Zxdgdirr r# r# r$ �get_ipython_cache_dirN s �r&