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