Skip to content

Commit

Permalink
reformat modified code
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Sep 17, 2020
1 parent 3a31041 commit 410c70c
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions IPython/core/interactiveshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,12 +903,12 @@ def init_virtualenv(self):
if 'VIRTUAL_ENV' not in os.environ:
# Not in a virtualenv
return
elif os.environ['VIRTUAL_ENV'] == '':
elif os.environ["VIRTUAL_ENV"] == "":
warn("Virtual env path set to '', please check if this is intended.")
return

p = Path(sys.executable)
p_venv = Path(os.environ['VIRTUAL_ENV'])
p_venv = Path(os.environ["VIRTUAL_ENV"])

# fallback venv detection:
# stdlib venv may symlink sys.executable, so we can't use realpath.
Expand All @@ -920,9 +920,9 @@ def init_virtualenv(self):
paths.append(p.resolve())

# In Cygwin paths like "c:\..." and '\cygdrive\c\...' are possible
if str(p_venv).startswith('\\cygdrive'):
if str(p_venv).startswith("\\cygdrive"):
p_venv = Path(str(p_venv)[11:])
elif len(str(p_venv)) >= 2 and str(p_venv)[1] == ':':
elif len(str(p_venv)) >= 2 and str(p_venv)[1] == ":":
p_venv = Path(str(p_venv)[2:])

if any(os.fspath(p_venv) in os.fspath(p) for p in paths):
Expand All @@ -932,15 +932,12 @@ def init_virtualenv(self):
warn("Attempting to work in a virtualenv. If you encounter problems, please "
"install IPython inside the virtualenv.")
if sys.platform == "win32":
virtual_env = Path(os.environ['VIRTUAL_ENV']).joinpath(
'Lib',
'site-packages'
virtual_env = Path(os.environ["VIRTUAL_ENV"]).joinpath(
"Lib", "site-packages"
)
else:
virtual_env = Path(os.environ['VIRTUAL_ENV']).joinpath(
'lib',
"python{}.{}".format(*sys.version_info[:2]),
'site-packages'
virtual_env = Path(os.environ["VIRTUAL_ENV"]).joinpath(
"lib", "python{}.{}".format(*sys.version_info[:2]), "site-packages"
)

import site
Expand Down

0 comments on commit 410c70c

Please sign in to comment.