forked from VimPlug/jedi
Merge branch 'values'
This commit is contained in:
@@ -33,6 +33,7 @@ from jedi.evaluate.helpers import get_module_names, evaluate_call_of_leaf
|
||||
from jedi.evaluate.sys_path import get_venv_path, dotted_path_in_sys_path
|
||||
from jedi.evaluate.iterable import unpack_tuple_to_dict
|
||||
from jedi.evaluate.filters import TreeNameDefinition
|
||||
from jedi.evaluate.syntax_tree import tree_name_to_contexts
|
||||
|
||||
# Jedi uses lots and lots of recursion. By setting this a little bit higher, we
|
||||
# can remove some "maximum recursion depth" errors.
|
||||
@@ -319,10 +320,8 @@ class Script(object):
|
||||
for node in get_executable_nodes(module_node):
|
||||
context = self._get_module().create_context(node)
|
||||
if node.type in ('funcdef', 'classdef'):
|
||||
# TODO This is stupid, should be private
|
||||
from jedi.evaluate.finder import _name_to_types
|
||||
# Resolve the decorators.
|
||||
_name_to_types(self._evaluator, context, node.children[1])
|
||||
tree_name_to_contexts(self._evaluator, context, node.children[1])
|
||||
elif isinstance(node, tree.Import):
|
||||
import_names = set(node.get_defined_names())
|
||||
if node.is_nested():
|
||||
|
||||
@@ -10,7 +10,7 @@ from parso.python.tree import search_ancestor
|
||||
|
||||
from jedi._compatibility import u
|
||||
from jedi import settings
|
||||
from jedi import common
|
||||
from jedi.evaluate.utils import ignored, unite
|
||||
from jedi.cache import memoize_method
|
||||
from jedi.evaluate import representation as er
|
||||
from jedi.evaluate import instance
|
||||
@@ -290,7 +290,7 @@ class BaseDefinition(object):
|
||||
if not path:
|
||||
return None # for keywords the path is empty
|
||||
|
||||
with common.ignored(KeyError):
|
||||
with ignored(KeyError):
|
||||
path[0] = self._mapping[path[0]]
|
||||
for key, repl in self._tuple_mapping.items():
|
||||
if tuple(path[:len(key)]) == key:
|
||||
@@ -567,7 +567,7 @@ class Definition(BaseDefinition):
|
||||
"""
|
||||
defs = self._name.infer()
|
||||
return sorted(
|
||||
common.unite(defined_names(self._evaluator, d) for d in defs),
|
||||
unite(defined_names(self._evaluator, d) for d in defs),
|
||||
key=lambda s: s._name.start_pos or (0, 0)
|
||||
)
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ from parso.python import tree
|
||||
from parso import split_lines
|
||||
|
||||
from jedi._compatibility import u
|
||||
from jedi.evaluate.syntax_tree import eval_atom
|
||||
from jedi.evaluate.helpers import evaluate_call_of_leaf
|
||||
from jedi.cache import time_cache
|
||||
|
||||
@@ -206,7 +207,7 @@ def evaluate_goto_definition(evaluator, context, leaf):
|
||||
elif parent.type == 'trailer':
|
||||
return evaluate_call_of_leaf(context, leaf)
|
||||
elif isinstance(leaf, tree.Literal):
|
||||
return context.evaluator.eval_atom(context, leaf)
|
||||
return eval_atom(context, leaf)
|
||||
return []
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import pydoc
|
||||
import keyword
|
||||
|
||||
from jedi._compatibility import is_py3, is_py35
|
||||
from jedi import common
|
||||
from jedi.evaluate.utils import ignored
|
||||
from jedi.evaluate.filters import AbstractNameDefinition
|
||||
from parso.python.tree import Leaf
|
||||
|
||||
@@ -123,7 +123,7 @@ def imitate_pydoc(string):
|
||||
# with unicode strings)
|
||||
string = str(string)
|
||||
h = pydoc.help
|
||||
with common.ignored(KeyError):
|
||||
with ignored(KeyError):
|
||||
# try to access symbols
|
||||
string = h.symbols[string]
|
||||
string, _, related = string.partition(' ')
|
||||
|
||||
Reference in New Issue
Block a user