mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-17 09:25:03 +08:00
Passing Function tests now.
This commit is contained in:
@@ -187,10 +187,10 @@ class Script(object):
|
||||
and n.lower().startswith(like.lower()) \
|
||||
or n.startswith(like):
|
||||
if not filter_private_variable(s, user_stmt or self._parser.user_scope(), n):
|
||||
if isinstance(c.parent.parent, (pr.Function, pr.Class)):
|
||||
if isinstance(c.parent, (pr.Function, pr.Class)):
|
||||
# TODO I think this is a hack. It should be an
|
||||
# er.Function/er.Class before that.
|
||||
c = er.wrap(self._evaluator, c.parent.parent).name
|
||||
c = er.wrap(self._evaluator, c.parent).name
|
||||
new = classes.Completion(self._evaluator, c, needs_dot, len(like), s)
|
||||
k = (new.name, new.complete) # key
|
||||
if k in comp_dct and settings.no_completion_duplicates:
|
||||
@@ -398,7 +398,7 @@ class Script(object):
|
||||
definitions = resolve_import_paths(definitions)
|
||||
names = [s if isinstance(s, pr.Name) else s.name for s in definitions
|
||||
if s is not imports.ImportWrapper.GlobalNamespace]
|
||||
defs = [classes.Definition(self._evaluator, name.names[-1])
|
||||
defs = [classes.Definition(self._evaluator, name.names[-1] if isinstance(name, pr.Name) else name )
|
||||
for name in names]
|
||||
return helpers.sorted_definitions(set(defs))
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ class NameFinder(object):
|
||||
evaluation, so remove them already here!
|
||||
"""
|
||||
for n in names:
|
||||
definition = n.parent.parent
|
||||
definition = n.parent
|
||||
if isinstance(definition, (pr.Function, pr.Class, pr.Module)):
|
||||
yield er.wrap(self._evaluator, definition).name
|
||||
else:
|
||||
|
||||
@@ -193,14 +193,13 @@ class Array(use_metaclass(CachedMetaClass, IterableWrapper)):
|
||||
|
||||
def scope_names_generator(self, position=None):
|
||||
"""
|
||||
This method generates all `ArrayMethod` for one pr.Array.
|
||||
It returns e.g. for a list: append, pop, ...
|
||||
"""
|
||||
# `array.type` is a string with the type, e.g. 'list'.
|
||||
scope = self._evaluator.find_types(compiled.builtin, self._array.type)[0]
|
||||
scope = self._evaluator.execute(scope)[0] # builtins only have one class
|
||||
for _, names in scope.scope_names_generator():
|
||||
yield self, [ArrayMethod(n) for n in names]
|
||||
yield self, [helpers.FakeName(n.get_code(), self) for n in names]
|
||||
|
||||
@common.safe_property
|
||||
def parent(self):
|
||||
|
||||
Reference in New Issue
Block a user