From 0f6fb23d91890afb39b2b55d492d9b8e63582b89 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 14 Dec 2015 22:02:11 +0100 Subject: [PATCH] override annotation() in Lambda, instead of checking in Function on type --- jedi/parser/tree.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jedi/parser/tree.py b/jedi/parser/tree.py index df116820..a20030cb 100644 --- a/jedi/parser/tree.py +++ b/jedi/parser/tree.py @@ -879,9 +879,6 @@ class Function(ClassOrFunc): return bool(self.yields) def annotation(self): - if self.children[0] == "lambda": - # lambda functions have no annotation - return None try: if self.children[3] == "->": return _fix_forward_reference(self.children[4]) @@ -964,6 +961,10 @@ class Lambda(Function): def is_generator(self): return False + def annotation(self): + # lambda functions do not support annotations + return None + @property def yields(self): return []