1
0
forked from VimPlug/jedi

get_annotation -> annotation (property).

This commit is contained in:
Dave Halter
2017-04-08 15:28:38 +02:00
parent 545cb26f78
commit ff82763e6b
3 changed files with 11 additions and 8 deletions

View File

@@ -588,7 +588,8 @@ class Function(ClassOrFunc):
def is_generator(self):
return bool(self.yields)
def get_annotation(self):
@property
def annotation(self):
try:
if self.children[3] == "->":
return self.children[4]
@@ -656,7 +657,8 @@ class Lambda(Function):
def is_generator(self):
return False
def get_annotation(self):
@property
def annotation(self):
# lambda functions do not support annotations
return None
@@ -1066,7 +1068,8 @@ class Param(PythonBaseNode):
except IndexError:
return None
def get_annotation(self):
@property
def annotation(self):
tfpdef = self._tfpdef()
if tfpdef.type == 'tfpdef':
assert tfpdef.children[1] == ":"