Skip to content

Commit 336087f

Browse files
committed
find_python_environments -> find_system_environments
1 parent 45fb770 commit 336087f

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77

88
import jedi
9-
from jedi.api.environment import get_default_environment, get_python_environment
9+
from jedi.api.environment import get_default_environment, get_system_environment
1010
from jedi._compatibility import py_version
1111

1212
collect_ignore = [
@@ -94,7 +94,7 @@ def environment(request):
9494
if int(version) == py_version:
9595
return get_default_environment()
9696

97-
return get_python_environment('python%s.%s' % tuple(version))
97+
return get_system_environment('python%s.%s' % tuple(version))
9898

9999

100100
@pytest.fixture(scope='session')

jedi/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from jedi.api import Script, Interpreter, set_debug_function, \
4242
preload_module, names
4343
from jedi import settings
44-
from jedi.api.environment import find_virtualenvs, find_python_environments, \
44+
from jedi.api.environment import find_virtualenvs, find_system_environments, \
4545
get_default_environment, InvalidPythonEnvironment, create_environment, \
46-
get_python_environment
46+
get_system_environment
4747
from jedi.api.exceptions import InternalError

jedi/api/environment.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def get_default_environment():
153153
if virtual_env is not None:
154154
return virtual_env
155155

156-
for environment in find_python_environments():
156+
for environment in find_system_environments():
157157
return environment
158158

159159
# If no Python Environment is found, use the environment we're already
@@ -207,7 +207,7 @@ def py27_comp(paths=None, safe=True):
207207
return py27_comp(paths, **kwargs)
208208

209209

210-
def find_python_environments():
210+
def find_system_environments():
211211
"""
212212
Ignores virtualenvs and returns the Python versions that were installed on
213213
your system. This might return nothing, if you're running Python e.g. from
@@ -217,7 +217,7 @@ def find_python_environments():
217217
"""
218218
for version_string in _SUPPORTED_PYTHONS:
219219
try:
220-
yield get_python_environment('python' + version_string)
220+
yield get_system_environment('python' + version_string)
221221
except InvalidPythonEnvironment:
222222
pass
223223

@@ -241,7 +241,7 @@ def _get_python_prefix(executable):
241241

242242
# TODO: this function should probably return a list of environments since
243243
# multiple Python installations can be found on a system for the same version.
244-
def get_python_environment(name):
244+
def get_system_environment(name):
245245
"""
246246
Return the first Python environment found for a given path or for a string
247247
of the form 'pythonX.Y' where X and Y are the major and minor versions of
@@ -328,7 +328,7 @@ def _is_safe(executable_path):
328328
# Just check the list of known Python versions. If it's not in there,
329329
# it's likely an attacker or some Python that was not properly
330330
# installed in the system.
331-
for environment in find_python_environments():
331+
for environment in find_system_environments():
332332
if environment.executable == real_path:
333333
return True
334334

test/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
from jedi.api.classes import Definition
126126
from jedi.api.completion import get_user_scope
127127
from jedi import parser_utils
128-
from jedi.api.environment import get_default_environment, get_python_environment
128+
from jedi.api.environment import get_default_environment, get_system_environment
129129

130130

131131
TEST_COMPLETIONS = 0
@@ -435,7 +435,7 @@ def report(case, actual, desired):
435435
return 1
436436

437437
if arguments['--env']:
438-
environment = get_python_environment('python' + arguments['--env'])
438+
environment = get_system_environment('python' + arguments['--env'])
439439
else:
440440
# Will be 3.6.
441441
environment = get_default_environment()

test/test_api/test_environment.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
import jedi
77
from jedi._compatibility import py_version
88
from jedi.api.environment import get_default_environment, find_virtualenvs, \
9-
InvalidPythonEnvironment, find_python_environments, get_python_environment
9+
InvalidPythonEnvironment, find_system_environments, get_system_environment
1010

1111

1212
def test_sys_path():
1313
assert get_default_environment().get_sys_path()
1414

1515

16-
def test_find_python_environments():
17-
envs = list(find_python_environments())
16+
def test_find_system_environments():
17+
envs = list(find_system_environments())
1818
assert len(envs)
1919
for env in envs:
2020
assert env.version_info
@@ -29,7 +29,7 @@ def test_find_python_environments():
2929
)
3030
def test_versions(version):
3131
try:
32-
env = get_python_environment('python' + version)
32+
env = get_system_environment('python' + version)
3333
except InvalidPythonEnvironment:
3434
if int(version.replace('.', '')) == py_version:
3535
# At least the current version has to work

0 commit comments

Comments
 (0)