forked from VimPlug/jedi
Rename py__iter__types to iterate_contexts.
This commit is contained in:
@@ -217,7 +217,7 @@ class Evaluator(object):
|
||||
if type_ == 'for_stmt':
|
||||
container_types = context.eval_node(def_.children[3])
|
||||
cn = ContextualizedNode(context, def_.children[3])
|
||||
for_types = iterable.py__iter__types(self, container_types, cn)
|
||||
for_types = iterable.iterate_contexts(self, container_types, cn)
|
||||
c_node = ContextualizedName(context, name)
|
||||
return check_tuple_assignments(self, c_node, for_types)
|
||||
if type_ in ('import_from', 'import_name'):
|
||||
|
||||
@@ -613,10 +613,10 @@ def unpack_tuple_to_dict(context, types, exprlist):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
def py__iter__types(evaluator, contexts, contextualized_node=None):
|
||||
def iterate_contexts(evaluator, contexts, contextualized_node=None):
|
||||
"""
|
||||
Calls `py__iter__`, but ignores the ordering in the end and just returns
|
||||
all types that it contains.
|
||||
Calls `iterate`, on all contexts but ignores the ordering and just returns
|
||||
all contexts that the iterate functions yield.
|
||||
"""
|
||||
return ContextSet.from_sets(
|
||||
lazy_context.infer()
|
||||
@@ -660,7 +660,7 @@ def py__getitem__(evaluator, context, types, trailer):
|
||||
types.remove(typ)
|
||||
result |= typ.dict_values()
|
||||
cs = ContextSet.from_set(types)
|
||||
return result | py__iter__types(evaluator, cs)
|
||||
return result | iterate_contexts(evaluator, cs)
|
||||
|
||||
for typ in types:
|
||||
# The actual getitem call.
|
||||
@@ -674,7 +674,7 @@ def py__getitem__(evaluator, context, types, trailer):
|
||||
try:
|
||||
result |= getitem(index)
|
||||
except IndexError:
|
||||
result |= py__iter__types(evaluator, ContextSet(typ))
|
||||
result |= iterate_contexts(evaluator, ContextSet(typ))
|
||||
except KeyError:
|
||||
# Must be a dict. Lists don't raise KeyErrors.
|
||||
result |= typ.dict_values()
|
||||
|
||||
@@ -475,7 +475,7 @@ def tree_name_to_contexts(evaluator, context, tree_name):
|
||||
types = context.predefined_names[node][tree_name.value]
|
||||
except KeyError:
|
||||
cn = ContextualizedNode(context, node.children[3])
|
||||
for_types = iterable.py__iter__types(evaluator, cn.infer(), cn)
|
||||
for_types = iterable.iterate_contexts(evaluator, cn.infer(), cn)
|
||||
c_node = ContextualizedName(context, tree_name)
|
||||
types = check_tuple_assignments(evaluator, c_node, for_types)
|
||||
elif typ == 'expr_stmt':
|
||||
|
||||
Reference in New Issue
Block a user