Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b70b111

Browse files
committed
Enforce some more types since we are Py3only
1 parent 4352b6b commit b70b111

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

IPython/paths.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
ensure_dir_exists, fs_encoding)
1313
from IPython.utils import py3compat
1414

15-
def get_ipython_dir():
15+
def get_ipython_dir() -> str:
1616
"""Get the IPython directory for this platform and user.
1717
1818
This uses the logic in `get_home_dir` to find the home directory
@@ -28,10 +28,9 @@ def get_ipython_dir():
2828
home_dir = get_home_dir()
2929
xdg_dir = get_xdg_dir()
3030

31-
# import pdb; pdb.set_trace() # dbg
3231
if 'IPYTHON_DIR' in env:
33-
warn('The environment variable IPYTHON_DIR is deprecated. '
34-
'Please use IPYTHONDIR instead.')
32+
warn('The environment variable IPYTHON_DIR is deprecated since IPython 3.0. '
33+
'Please use IPYTHONDIR instead.', DeprecationWarning)
3534
ipdir = env.get('IPYTHONDIR', env.get('IPYTHON_DIR', None))
3635
if ipdir is None:
3736
# not set explicitly, use ~/.ipython
@@ -67,8 +66,8 @@ def get_ipython_dir():
6766
warn("IPython parent '{0}' is not a writable location,"
6867
" using a temp directory.".format(parent))
6968
ipdir = tempfile.mkdtemp()
70-
71-
return py3compat.cast_unicode(ipdir, fs_encoding)
69+
assert isinstance(ipdir, str), "all path manipulation should be str(unicode), but are not."
70+
return ipdir
7271

7372

7473
def get_ipython_cache_dir():

0 commit comments

Comments
 (0)