1
0
forked from VimPlug/jedi

Most function calls seem to work now.

This commit is contained in:
Dave Halter
2016-11-01 00:44:57 +01:00
parent 4aec9cadd7
commit 9a55c9cf50
2 changed files with 9 additions and 10 deletions

View File

@@ -363,12 +363,12 @@ class ArrayLiteralContext(AbstractSequence, ArrayMixin):
def py__getitem__(self, index): def py__getitem__(self, index):
"""Here the index is an int/str. Raises IndexError/KeyError.""" """Here the index is an int/str. Raises IndexError/KeyError."""
if self.type == 'dict': if self.array_type == 'dict':
for key, value in self._items(): for key, value in self._items():
for k in self._evaluator.eval_element(key): for k in self._defining_context.eval_node(key):
if isinstance(k, compiled.CompiledObject) \ if isinstance(k, compiled.CompiledObject) \
and index == k.obj: and index == k.obj:
return self._evaluator.eval_element(value) return self._defining_context.eval_node(value)
raise KeyError('No key found in dictionary %s.' % self) raise KeyError('No key found in dictionary %s.' % self)
# Can raise an IndexError # Can raise an IndexError
@@ -377,18 +377,16 @@ class ArrayLiteralContext(AbstractSequence, ArrayMixin):
else: else:
return self._defining_context.eval_node(self._items()[index]) return self._defining_context.eval_node(self._items()[index])
# @memoize_default()
def py__iter__(self): def py__iter__(self):
""" """
While values returns the possible values for any array field, this While values returns the possible values for any array field, this
function returns the value for a certain index. function returns the value for a certain index.
""" """
if self.type == 'dict': if self.array_type == 'dict':
raise NotImplementedError
# Get keys. # Get keys.
types = set() types = set()
for k, _ in self._items(): for k, _ in self._items():
types |= self._evaluator.eval_element(k) types |= self._defining_context.eval_node(k)
# We don't know which dict index comes first, therefore always # We don't know which dict index comes first, therefore always
# yield all the types. # yield all the types.
for _ in types: for _ in types:
@@ -524,8 +522,8 @@ class FakeDict(_FakeArray):
self._dct = dct self._dct = dct
def py__iter__(self): def py__iter__(self):
raise NotImplementedError for key in self._dct:
yield set(compiled.create(self._evaluator, key) for key in self._dct) yield context.LazyKnownContext(compiled.create(self._evaluator, key))
def py__getitem__(self, index): def py__getitem__(self, index):
return self._dct[index].infer() return self._dct[index].infer()

View File

@@ -355,7 +355,8 @@ def get_params(evaluator, parent_context, func, var_args):
# Just report an error for the first param that is not needed (like # Just report an error for the first param that is not needed (like
# cPython). # cPython).
first_key, first_values = remaining_params[0] first_key, first_values = remaining_params[0]
for v in first_values: # TODO REENABLE
for v in []:#first_values:
if first_key is not None: if first_key is not None:
# Is a keyword argument, return the whole thing instead of just # Is a keyword argument, return the whole thing instead of just
# the value node. # the value node.