diff --git a/jedi/evaluate/dynamic.py b/jedi/evaluate/dynamic.py index 49dbea1c..b57118b8 100644 --- a/jedi/evaluate/dynamic.py +++ b/jedi/evaluate/dynamic.py @@ -78,7 +78,7 @@ def search_params(evaluator, param): pos = c.start_pos scope = stmt.parent - # this whole stuff is just to not execute certain parts + # This whole stuff is just to not execute certain parts # (speed improvement), basically we could just call # ``eval_call_path`` on the call_path and it would # also work. diff --git a/jedi/evaluate/representation.py b/jedi/evaluate/representation.py index b6bffa68..ba4afb0d 100644 --- a/jedi/evaluate/representation.py +++ b/jedi/evaluate/representation.py @@ -58,7 +58,7 @@ class Instance(use_metaclass(CachedMetaClass, Executed)): # compare the module path with the builtin name. self.var_args = iterable.check_array_instances(evaluator, self) else: - # need to execute the __init__ function, because the dynamic param + # Need to execute the __init__ function, because the dynamic param # searching needs it. with common.ignored(KeyError): self.execute_subscope_by_name('__init__', self.var_args) @@ -251,9 +251,14 @@ class InstanceElement(use_metaclass(CachedMetaClass, pr.Base)): return isinstance(self.var, cls) def py__call__(self, evaluator, params): - # TODO Why are CompiledObject and Instance even InstanceObjects? + # TODO Why is CompiledObject even an InstanceObject? if isinstance(self.var, (compiled.CompiledObject, Instance)): - return self.var.py__call__(evaluator, params) + try: + func = self.var.py__call__ + except AttributeError: + return [] + else: + return func(evaluator, params) else: return Function.py__call__(self, evaluator, params) diff --git a/test/completion/decorators.py b/test/completion/decorators.py index 1d055544..4165b22e 100644 --- a/test/completion/decorators.py +++ b/test/completion/decorators.py @@ -191,6 +191,18 @@ f() #? int() g() + +class X(): + @str + def x(self): + pass + + def y(self): + #? str() + self.x + #? + self.x() + # ----------------- # method decorators # -----------------