Skip to content

Commit

Permalink
Get the tests passing again
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhalter committed Apr 14, 2019
1 parent 2f56204 commit 3afcfcc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
14 changes: 13 additions & 1 deletion jedi/api/classes.py
Expand Up @@ -340,7 +340,19 @@ def infer(self):
if tree_name is None or parent_context is None or isinstance(self._name, ParamName):
context_set = self._name.infer()
else:
context_set = self._evaluator.goto_definitions(parent_context, tree_name)

# TODO remove this paragraph, it's ugly and shouldn't be needed
inferred = self._name.infer()
if inferred:
inferred = next(iter(inferred))
if isinstance(inferred, MethodContext):
c = inferred.class_context
else:
c = self._name.parent_context
else:
c = self._name.parent_context

context_set = self._evaluator.goto_definitions(c, tree_name)
return [Definition(self._evaluator, d.name) for d in context_set]

@property
Expand Down
8 changes: 8 additions & 0 deletions jedi/evaluate/context/function.py
Expand Up @@ -159,6 +159,14 @@ def __init__(self, evaluator, class_context, *args, **kwargs):
def get_default_param_context(self):
return self.class_context

def get_qualified_names(self):
# Need to implement this, because the parent context of a method
# context is not the class context but the module.
names = self.class_context.get_qualified_names()
if names is None:
return None
return names + [self.py__name__()]


class FunctionExecutionContext(TreeContext):
"""
Expand Down

0 comments on commit 3afcfcc

Please sign in to comment.