diff options
| author | robot-contrib <[email protected]> | 2022-05-18 00:43:36 +0300 |
|---|---|---|
| committer | robot-contrib <[email protected]> | 2022-05-18 00:43:36 +0300 |
| commit | 9e5f436a8b2a27bcc7802e443ea3ef3e41a82a75 (patch) | |
| tree | 78b522cab9f76336e62064d4d8ff7c897659b20e /contrib/python/ipython/py3/IPython/paths.py | |
| parent | 8113a823ffca6451bb5ff8f0334560885a939a24 (diff) | |
Update contrib/python/ipython/py3 to 8.3.0
ref:e84342d4d30476f9148137f37fd0c6405fd36f55
Diffstat (limited to 'contrib/python/ipython/py3/IPython/paths.py')
| -rw-r--r-- | contrib/python/ipython/py3/IPython/paths.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/contrib/python/ipython/py3/IPython/paths.py b/contrib/python/ipython/py3/IPython/paths.py index e19269058af..4fd253cf1e2 100644 --- a/contrib/python/ipython/py3/IPython/paths.py +++ b/contrib/python/ipython/py3/IPython/paths.py @@ -8,9 +8,14 @@ from warnings import warn import IPython from IPython.utils.importstring import import_item from IPython.utils.path import ( - get_home_dir, get_xdg_dir, get_xdg_cache_dir, compress_user, _writable_dir, - ensure_dir_exists, fs_encoding) -from IPython.utils import py3compat + get_home_dir, + get_xdg_dir, + get_xdg_cache_dir, + compress_user, + _writable_dir, + ensure_dir_exists, +) + def get_ipython_dir() -> str: """Get the IPython directory for this platform and user. @@ -49,8 +54,7 @@ def get_ipython_dir() -> str: warn(('{0} is deprecated. Move link to {1} to ' 'get rid of this message').format(cu(xdg_ipdir), cu(ipdir))) else: - warn('Moving {0} to {1}'.format(cu(xdg_ipdir), cu(ipdir))) - shutil.move(xdg_ipdir, ipdir) + ipdir = xdg_ipdir ipdir = os.path.normpath(os.path.expanduser(ipdir)) @@ -105,7 +109,8 @@ def get_ipython_module_path(module_str): mod = import_item(module_str) the_path = mod.__file__.replace('.pyc', '.py') the_path = the_path.replace('.pyo', '.py') - return py3compat.cast_unicode(the_path, fs_encoding) + return the_path + def locate_profile(profile='default'): """Find the path to the folder associated with a given profile. @@ -115,7 +120,7 @@ def locate_profile(profile='default'): from IPython.core.profiledir import ProfileDir, ProfileDirError try: pd = ProfileDir.find_profile_dir_by_name(get_ipython_dir(), profile) - except ProfileDirError: + except ProfileDirError as e: # IOError makes more sense when people are expecting a path - raise IOError("Couldn't find profile %r" % profile) + raise IOError("Couldn't find profile %r" % profile) from e return pd.location |
