From 3654de97b0fc9c2ba1a02db4357d2071fa2f7cc8 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sun, 16 Oct 2016 14:57:08 +0200 Subject: [PATCH] Better filter for arrays. --- jedi/evaluate/compiled/fake.py | 2 +- jedi/evaluate/iterable.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/jedi/evaluate/compiled/fake.py b/jedi/evaluate/compiled/fake.py index a979f263..2fa605b8 100644 --- a/jedi/evaluate/compiled/fake.py +++ b/jedi/evaluate/compiled/fake.py @@ -116,7 +116,7 @@ def _faked(module, obj, name): if faked_mod is None: return None, None - # Having the module as a `parser.representation.module`, we need to scan + # Having the module as a `parser.tree.Module`, we need to scan # for methods. if name is None: if inspect.isbuiltin(obj): diff --git a/jedi/evaluate/iterable.py b/jedi/evaluate/iterable.py index b165f1fb..412a8e4f 100644 --- a/jedi/evaluate/iterable.py +++ b/jedi/evaluate/iterable.py @@ -242,9 +242,17 @@ class ArrayMixin(object): # builtins only have one class -> [0] scopes = self._evaluator.execute_evaluated(scope, self) names_dicts = list(scopes)[0].names_dicts(search_global) - #yield names_dicts[0] yield self._get_names_dict(names_dicts[1]) + def get_filters(self, search_global, until_position=None, origin_scope=None): + # `array.type` is a string with the type, e.g. 'list'. + scope = compiled.builtin_from_name(self._evaluator, self.type) + for typ in self._evaluator.execute_evaluated(scope, self): + for filter in scope.get_filters(): + yield filter + # TODO this should be used. + #yield DictFilter(self._get_names_dict(names_dicts[1])) + def py__bool__(self): return None # We don't know the length, because of appends.