mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-30 17:35:22 +08:00
Move the evaluate package to inference
This commit is contained in:
@@ -24,7 +24,7 @@ next(gen_ret(1))
|
||||
#? []
|
||||
next(gen_ret()).
|
||||
|
||||
# generators evaluate to true if cast by bool.
|
||||
# generators infer to true if cast by bool.
|
||||
a = ''
|
||||
if gen_ret():
|
||||
a = 3
|
||||
|
||||
@@ -10,11 +10,11 @@ sys.path.append(dirname(os.path.abspath('thirdparty' + os.path.sep + 'asdf')))
|
||||
# syntax err
|
||||
sys.path.append('a' +* '/thirdparty')
|
||||
|
||||
#? ['evaluate']
|
||||
import evaluate
|
||||
#? ['inference']
|
||||
import inference
|
||||
|
||||
#? ['evaluator_function_cache']
|
||||
evaluate.Evaluator_fu
|
||||
inference.Evaluator_fu
|
||||
|
||||
# Those don't work because dirname and abspath are not properly understood.
|
||||
##? ['jedi_']
|
||||
|
||||
22
test/completion/thirdparty/jedi_.py
vendored
22
test/completion/thirdparty/jedi_.py
vendored
@@ -1,5 +1,5 @@
|
||||
|
||||
from jedi import functions, evaluate, parsing
|
||||
from jedi import functions, inference, parsing
|
||||
|
||||
el = functions.completions()[0]
|
||||
#? ['description']
|
||||
@@ -18,17 +18,17 @@ el = scopes
|
||||
|
||||
# get_names_for_scope is also recursion stuff
|
||||
#? tuple()
|
||||
el = list(evaluate.get_names_for_scope())[0]
|
||||
el = list(inference.get_names_for_scope())[0]
|
||||
|
||||
#? int() parsing.Module()
|
||||
el = list(evaluate.get_names_for_scope(1))[0][0]
|
||||
el = list(inference.get_names_for_scope(1))[0][0]
|
||||
#? parsing.Module()
|
||||
el = list(evaluate.get_names_for_scope())[0][0]
|
||||
el = list(inference.get_names_for_scope())[0][0]
|
||||
|
||||
#? list()
|
||||
el = list(evaluate.get_names_for_scope(1))[0][1]
|
||||
el = list(inference.get_names_for_scope(1))[0][1]
|
||||
#? list()
|
||||
el = list(evaluate.get_names_for_scope())[0][1]
|
||||
el = list(inference.get_names_for_scope())[0][1]
|
||||
|
||||
#? list()
|
||||
parsing.Scope((0,0)).get_set_vars()
|
||||
@@ -39,14 +39,14 @@ parsing.Scope((0,0)).get_set_vars()[0]
|
||||
parsing.Scope((0,0)).get_set_vars()[0].parent
|
||||
|
||||
#? parsing.Import() parsing.Name()
|
||||
el = list(evaluate.get_names_for_scope())[0][1][0]
|
||||
el = list(inference.get_names_for_scope())[0][1][0]
|
||||
|
||||
#? evaluate.Array() evaluate.Class() evaluate.Function() evaluate.Instance()
|
||||
list(evaluate.follow_call())[0]
|
||||
#? inference.Array() inference.Class() inference.Function() inference.Instance()
|
||||
list(inference.follow_call())[0]
|
||||
|
||||
# With the right recursion settings, this should be possible (and maybe more):
|
||||
# Array Class Function Generator Instance Module
|
||||
# However, this was produced with the recursion settings 10/350/10000, and
|
||||
# lasted 18.5 seconds. So we just have to be content with the results.
|
||||
#? evaluate.Class() evaluate.Function()
|
||||
evaluate.get_scopes_for_name()[0]
|
||||
#? inference.Class() inference.Function()
|
||||
inference.get_scopes_for_name()[0]
|
||||
|
||||
@@ -10,7 +10,7 @@ from . import refactor
|
||||
|
||||
import jedi
|
||||
from jedi.api.environment import InterpreterEnvironment
|
||||
from jedi.evaluate.analysis import Warning
|
||||
from jedi.inference.analysis import Warning
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
|
||||
@@ -126,7 +126,7 @@ from jedi.api.classes import Definition
|
||||
from jedi.api.completion import get_user_scope
|
||||
from jedi import parser_utils
|
||||
from jedi.api.environment import get_default_environment, get_system_environment
|
||||
from jedi.evaluate.gradual.conversion import convert_contexts
|
||||
from jedi.inference.gradual.conversion import convert_contexts
|
||||
|
||||
|
||||
TEST_COMPLETIONS = 0
|
||||
|
||||
@@ -9,7 +9,7 @@ from pytest import raises
|
||||
from parso import cache
|
||||
|
||||
from jedi import preload_module
|
||||
from jedi.evaluate.gradual import typeshed
|
||||
from jedi.inference.gradual import typeshed
|
||||
|
||||
|
||||
def test_preload_modules():
|
||||
|
||||
@@ -8,7 +8,7 @@ import pytest
|
||||
|
||||
import jedi
|
||||
from jedi import __doc__ as jedi_doc
|
||||
from jedi.evaluate.compiled import CompiledContextName
|
||||
from jedi.inference.compiled import CompiledContextName
|
||||
|
||||
|
||||
def test_is_keyword(Script):
|
||||
|
||||
@@ -89,7 +89,7 @@ def test_fake_subnodes(Script):
|
||||
Test the number of subnodes of a fake object.
|
||||
|
||||
There was a bug where the number of child nodes would grow on every
|
||||
call to :func:``jedi.evaluate.compiled.fake.get_faked``.
|
||||
call to :func:``jedi.inference.compiled.fake.get_faked``.
|
||||
|
||||
See Github PR#649 and isseu #591.
|
||||
"""
|
||||
|
||||
@@ -7,7 +7,7 @@ import pytest
|
||||
|
||||
import jedi
|
||||
from jedi._compatibility import is_py3, py_version
|
||||
from jedi.evaluate.compiled import mixed, context
|
||||
from jedi.inference.compiled import mixed, context
|
||||
from importlib import import_module
|
||||
|
||||
if py_version > 30:
|
||||
|
||||
@@ -3,7 +3,7 @@ import os
|
||||
import pytest
|
||||
|
||||
from jedi import api
|
||||
from jedi.evaluate import imports
|
||||
from jedi.inference import imports
|
||||
from ..helpers import cwd_at
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import os
|
||||
from textwrap import dedent
|
||||
|
||||
from jedi._compatibility import force_unicode
|
||||
from jedi.evaluate.sys_path import (_get_parent_dir_with_file,
|
||||
from jedi.inference.sys_path import (_get_parent_dir_with_file,
|
||||
_get_buildout_script_paths,
|
||||
check_sys_path_modifications)
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ from datetime import datetime
|
||||
|
||||
import pytest
|
||||
|
||||
from jedi.evaluate import compiled
|
||||
from jedi.evaluate.compiled.access import DirectObjectAccess
|
||||
from jedi.evaluate.gradual.conversion import _stub_to_python_context_set
|
||||
from jedi.inference import compiled
|
||||
from jedi.inference.compiled.access import DirectObjectAccess
|
||||
from jedi.inference.gradual.conversion import _stub_to_python_context_set
|
||||
|
||||
|
||||
def test_simple(evaluator, environment):
|
||||
|
||||
@@ -3,8 +3,8 @@ import os
|
||||
import pytest
|
||||
from parso.utils import PythonVersionInfo
|
||||
|
||||
from jedi.evaluate.gradual import typeshed, stub_context
|
||||
from jedi.evaluate.context import TreeInstance, BoundMethod, FunctionContext, \
|
||||
from jedi.inference.gradual import typeshed, stub_context
|
||||
from jedi.inference.context import TreeInstance, BoundMethod, FunctionContext, \
|
||||
MethodContext, ClassContext
|
||||
|
||||
TYPESHED_PYTHON3 = os.path.join(typeshed.TYPESHED_PATH, 'stdlib', '3')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from textwrap import dedent
|
||||
|
||||
from jedi import names
|
||||
from jedi.evaluate import helpers
|
||||
from jedi.inference import helpers
|
||||
|
||||
|
||||
def test_call_of_leaf_in_brackets(environment):
|
||||
|
||||
@@ -9,10 +9,10 @@ import pytest
|
||||
from jedi.file_io import FileIO, KnownContentFileIO
|
||||
|
||||
from jedi._compatibility import find_module_py33, find_module
|
||||
from jedi.evaluate import compiled
|
||||
from jedi.evaluate import imports
|
||||
from jedi.inference import compiled
|
||||
from jedi.inference import imports
|
||||
from jedi.api.project import Project
|
||||
from jedi.evaluate.gradual.conversion import _stub_to_python_context_set
|
||||
from jedi.inference.gradual.conversion import _stub_to_python_context_set
|
||||
from ..helpers import cwd_at, get_example_dir, test_dir, root_dir
|
||||
|
||||
THIS_DIR = os.path.dirname(__file__)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
from jedi.evaluate.context import TreeInstance
|
||||
from jedi.inference.context import TreeInstance
|
||||
|
||||
|
||||
def _eval_literal(Script, code, is_fstring=False):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from jedi.evaluate.compiled import CompiledObject
|
||||
from jedi.inference.compiled import CompiledObject
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import re
|
||||
|
||||
import pytest
|
||||
|
||||
from jedi.evaluate.gradual.conversion import _stub_to_python_context_set
|
||||
from jedi.inference.gradual.conversion import _stub_to_python_context_set
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -6,7 +6,7 @@ import shutil
|
||||
import pytest
|
||||
from ..helpers import skip_if_windows, skip_if_not_windows
|
||||
|
||||
from jedi.evaluate import sys_path
|
||||
from jedi.inference import sys_path
|
||||
from jedi.api.environment import create_environment
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import pytest
|
||||
|
||||
from jedi import settings
|
||||
from jedi.evaluate.names import ContextName
|
||||
from jedi.evaluate.compiled import CompiledContextName
|
||||
from jedi.evaluate.gradual.typeshed import StubModuleContext
|
||||
from jedi.inference.names import ContextName
|
||||
from jedi.inference.compiled import CompiledContextName
|
||||
from jedi.inference.gradual.typeshed import StubModuleContext
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
||||
Reference in New Issue
Block a user