1
0
forked from VimPlug/jedi

Fix some more stuff because of newer parso changes.

This commit is contained in:
Dave Halter
2017-07-14 18:21:52 +02:00
parent 945a2ba405
commit 2fcd2f8f89
5 changed files with 7 additions and 6 deletions

View File

@@ -7,7 +7,6 @@ from textwrap import dedent
from parso.python.parser import Parser
from parso.python import tree
from parso.python.tokenize import tokenize
from parso.utils import splitlines
from jedi._compatibility import u
@@ -121,7 +120,9 @@ def get_stack_at_position(grammar, code_lines, module_node, pos):
pass
def tokenize_without_endmarker(code):
tokens = tokenize(code)
# TODO This is for now not an official parso API that exists purely
# for Jedi.
tokens = grammar._tokenize(code)
for token_ in tokens:
if token_.string == safeword:
raise EndMarkerReached()

View File

@@ -180,7 +180,7 @@ class ContextualizedName(ContextualizedNode):
node = self._node.parent
compare = self._node
while node is not None:
if node.type in ('testlist_comp', 'testlist_star_expr', 'exprlist'):
if node.type in ('testlist', 'testlist_comp', 'testlist_star_expr', 'exprlist'):
for i, child in enumerate(node.children):
if child == compare:
indexes.insert(0, (int(i / 2), node))

View File

@@ -199,7 +199,7 @@ def find_type_from_comment_hint_assign(context, node, name):
def _find_type_from_comment_hint(context, node, varlist, name):
index = None
if varlist.type in ("testlist_star_expr", "exprlist"):
if varlist.type in ("testlist_star_expr", "exprlist", "testlist"):
# something like "a, b = 1, 2"
index = 0
for child in varlist.children: