def py__call__(self, params): if inspect.isclass(self.obj): from jedi.evaluate.instance import CompiledInstance return set([ CompiledInstance(self.evaluator, self.parent_context, self, params) ]) else: return set(self._execute_function(params))
def builtins_reversed(evaluator, sequences, obj, arguments): # While we could do without this variable (just by using sequences), we # want static analysis to work well. Therefore we need to generated the # values again. key, lazy_context = next(arguments.unpack()) ordered = list(iterable.py__iter__(evaluator, sequences, lazy_context.data)) rev = list(reversed(ordered)) # Repack iterator values and then run it the normal way. This is # necessary, because `reversed` is a function and autocompletion # would fail in certain cases like `reversed(x).__iter__` if we # just returned the result directly. seq = iterable.FakeSequence(evaluator, 'list', rev) arguments = param.ValuesArguments([[seq]]) return set( [CompiledInstance(evaluator, evaluator.BUILTINS, obj, arguments)])