##// END OF EJS Templates
Enforce some more types since we are Py3only
Matthias Bussonnier -
Show More
@@ -12,7 +12,7 b' from IPython.utils.path import ('
12 ensure_dir_exists, fs_encoding)
12 ensure_dir_exists, fs_encoding)
13 from IPython.utils import py3compat
13 from IPython.utils import py3compat
14
14
15 def get_ipython_dir():
15 def get_ipython_dir() -> str:
16 """Get the IPython directory for this platform and user.
16 """Get the IPython directory for this platform and user.
17
17
18 This uses the logic in `get_home_dir` to find the home directory
18 This uses the logic in `get_home_dir` to find the home directory
@@ -28,10 +28,9 b' def get_ipython_dir():'
28 home_dir = get_home_dir()
28 home_dir = get_home_dir()
29 xdg_dir = get_xdg_dir()
29 xdg_dir = get_xdg_dir()
30
30
31 # import pdb; pdb.set_trace() # dbg
32 if 'IPYTHON_DIR' in env:
31 if 'IPYTHON_DIR' in env:
33 warn('The environment variable IPYTHON_DIR is deprecated. '
32 warn('The environment variable IPYTHON_DIR is deprecated since IPython 3.0. '
34 'Please use IPYTHONDIR instead.')
33 'Please use IPYTHONDIR instead.', DeprecationWarning)
35 ipdir = env.get('IPYTHONDIR', env.get('IPYTHON_DIR', None))
34 ipdir = env.get('IPYTHONDIR', env.get('IPYTHON_DIR', None))
36 if ipdir is None:
35 if ipdir is None:
37 # not set explicitly, use ~/.ipython
36 # not set explicitly, use ~/.ipython
@@ -67,8 +66,8 b' def get_ipython_dir():'
67 warn("IPython parent '{0}' is not a writable location,"
66 warn("IPython parent '{0}' is not a writable location,"
68 " using a temp directory.".format(parent))
67 " using a temp directory.".format(parent))
69 ipdir = tempfile.mkdtemp()
68 ipdir = tempfile.mkdtemp()
70
69 assert isinstance(ipdir, str), "all path manipulation should be str(unicode), but are not."
71 return py3compat.cast_unicode(ipdir, fs_encoding)
70 return ipdir
72
71
73
72
74 def get_ipython_cache_dir():
73 def get_ipython_cache_dir():
General Comments 0
You need to be logged in to leave comments. Login now