A lot of stuff is not needed anymore, because of the recent refactorings.

This commit is contained in:
Dave Halter
2016-06-14 08:31:36 +02:00
parent 6cf8ca03b2
commit 118ba7d833
3 changed files with 8 additions and 105 deletions

View File

@@ -5,7 +5,6 @@ import re
from collections import namedtuple
from jedi import common
from jedi.parser import tree as pt
from jedi.evaluate import imports
from jedi import parser
from jedi.parser import tokenize, token
@@ -42,14 +41,6 @@ def get_on_import_stmt(evaluator, user_context, user_stmt, is_like_search=False)
return i, name
def check_error_statements(module, pos):
for error_statement in module.error_statements:
if error_statement.first_type in ('import_from', 'import_name') \
and error_statement.start_pos < pos <= error_statement.end_pos:
return importer_from_error_statement(error_statement, pos)
return None, 0, False, False
def _get_code(code, start_pos, end_pos):
"""
:param code_start_pos: is where the code starts.
@@ -178,42 +169,6 @@ def get_possible_completion_types(grammar, stack):
return keywords, grammar_labels
def importer_from_error_statement(error_statement, pos):
def check_dotted(children):
for name in children[::2]:
if name.start_pos <= pos:
yield name
names = []
level = 0
only_modules = True
unfinished_dotted = False
for typ, nodes in error_statement.stack:
if typ == 'dotted_name':
names += check_dotted(nodes)
if nodes[-1] == '.':
# An unfinished dotted_name
unfinished_dotted = True
elif typ == 'import_name':
if nodes[0].start_pos <= pos <= nodes[0].end_pos:
# We are on the import.
return None, 0, False, False
elif typ == 'import_from':
for node in nodes:
if node.start_pos >= pos:
break
elif isinstance(node, pt.Node) and node.type == 'dotted_name':
names += check_dotted(node.children)
elif node in ('.', '...'):
level += len(node.value)
elif isinstance(node, pt.Name):
names.append(node)
elif node == 'import':
only_modules = False
return names, level, only_modules, unfinished_dotted
class ContextResults():
def __init__(self, evaluator, source, module, pos):
self._evaluator = evaluator