forked from VimPlug/jedi
settings should not be affected by exceptions.
This commit is contained in:
@@ -511,31 +511,35 @@ class Script(object):
|
|||||||
"""
|
"""
|
||||||
temp, settings.dynamic_flow_information = \
|
temp, settings.dynamic_flow_information = \
|
||||||
settings.dynamic_flow_information, False
|
settings.dynamic_flow_information, False
|
||||||
user_stmt = self._parser.user_stmt()
|
try:
|
||||||
definitions, search_name = self._goto(add_import_name=True)
|
user_stmt = self._parser.user_stmt()
|
||||||
if isinstance(user_stmt, pr.Statement):
|
definitions, search_name = self._goto(add_import_name=True)
|
||||||
c = user_stmt.expression_list()[0]
|
if isinstance(user_stmt, pr.Statement):
|
||||||
if not isinstance(c, unicode) and self._pos < c.start_pos:
|
c = user_stmt.expression_list()[0]
|
||||||
# the search_name might be before `=`
|
if not isinstance(c, unicode) and self._pos < c.start_pos:
|
||||||
definitions = [v for v in user_stmt.get_defined_names()
|
# the search_name might be before `=`
|
||||||
if unicode(v.names[-1]) == search_name]
|
definitions = [v for v in user_stmt.get_defined_names()
|
||||||
if not isinstance(user_stmt, pr.Import):
|
if unicode(v.names[-1]) == search_name]
|
||||||
# import case is looked at with add_import_name option
|
if not isinstance(user_stmt, pr.Import):
|
||||||
definitions = usages.usages_add_import_modules(self._evaluator, definitions, search_name)
|
# import case is looked at with add_import_name option
|
||||||
|
definitions = usages.usages_add_import_modules(self._evaluator,
|
||||||
|
definitions,
|
||||||
|
search_name)
|
||||||
|
|
||||||
module = set([d.get_parent_until() for d in definitions])
|
module = set([d.get_parent_until() for d in definitions])
|
||||||
module.add(self._parser.module())
|
module.add(self._parser.module())
|
||||||
names = usages.usages(self._evaluator, definitions, search_name, module)
|
names = usages.usages(self._evaluator, definitions, search_name, module)
|
||||||
|
|
||||||
for d in set(definitions):
|
for d in set(definitions):
|
||||||
try:
|
try:
|
||||||
name_part = d.names[-1]
|
name_part = d.names[-1]
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
names.append(classes.Definition(self._evaluator, d))
|
names.append(classes.Definition(self._evaluator, d))
|
||||||
else:
|
else:
|
||||||
names.append(classes.Definition(self._evaluator, name_part))
|
names.append(classes.Definition(self._evaluator, name_part))
|
||||||
|
finally:
|
||||||
|
settings.dynamic_flow_information = temp
|
||||||
|
|
||||||
settings.dynamic_flow_information = temp
|
|
||||||
return helpers.sorted_definitions(set(names))
|
return helpers.sorted_definitions(set(names))
|
||||||
|
|
||||||
def call_signatures(self):
|
def call_signatures(self):
|
||||||
|
|||||||
@@ -92,9 +92,11 @@ def scale_speed_settings(factor):
|
|||||||
b = settings.max_until_execution_unique
|
b = settings.max_until_execution_unique
|
||||||
settings.max_executions *= factor
|
settings.max_executions *= factor
|
||||||
settings.max_until_execution_unique *= factor
|
settings.max_until_execution_unique *= factor
|
||||||
yield
|
try:
|
||||||
settings.max_executions = a
|
yield
|
||||||
settings.max_until_execution_unique = b
|
finally:
|
||||||
|
settings.max_executions = a
|
||||||
|
settings.max_until_execution_unique = b
|
||||||
|
|
||||||
|
|
||||||
def indent_block(text, indention=' '):
|
def indent_block(text, indention=' '):
|
||||||
|
|||||||
Reference in New Issue
Block a user