1
0
forked from VimPlug/jedi

Merge branch 'linter' of https://github.com/reinhrst/jedi into pep484

Conflicts:
	AUTHORS.txt
This commit is contained in:
Dave Halter
2015-12-17 23:46:20 +01:00
9 changed files with 285 additions and 13 deletions

View File

@@ -873,7 +873,10 @@ class Function(ClassOrFunc):
def annotation(self):
try:
return self.children[6] # 6th element: def foo(...) -> bar
if self.children[3] == "->":
return self.children[4]
assert self.children[3] == ":"
return None
except IndexError:
return None
@@ -952,6 +955,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 []
@@ -1404,8 +1411,14 @@ class Param(BaseNode):
return None
def annotation(self):
# Generate from tfpdef.
raise NotImplementedError
tfpdef = self._tfpdef()
if is_node(tfpdef, 'tfpdef'):
assert tfpdef.children[1] == ":"
assert len(tfpdef.children) == 3
annotation = tfpdef.children[2]
return annotation
else:
return None
def _tfpdef(self):
"""