mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-28 02:02:18 +08:00
Better filter for arrays.
This commit is contained in:
@@ -116,7 +116,7 @@ def _faked(module, obj, name):
|
|||||||
if faked_mod is None:
|
if faked_mod is None:
|
||||||
return None, 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.
|
# for methods.
|
||||||
if name is None:
|
if name is None:
|
||||||
if inspect.isbuiltin(obj):
|
if inspect.isbuiltin(obj):
|
||||||
|
|||||||
@@ -242,9 +242,17 @@ class ArrayMixin(object):
|
|||||||
# builtins only have one class -> [0]
|
# builtins only have one class -> [0]
|
||||||
scopes = self._evaluator.execute_evaluated(scope, self)
|
scopes = self._evaluator.execute_evaluated(scope, self)
|
||||||
names_dicts = list(scopes)[0].names_dicts(search_global)
|
names_dicts = list(scopes)[0].names_dicts(search_global)
|
||||||
#yield names_dicts[0]
|
|
||||||
yield self._get_names_dict(names_dicts[1])
|
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):
|
def py__bool__(self):
|
||||||
return None # We don't know the length, because of appends.
|
return None # We don't know the length, because of appends.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user