1
0
forked from VimPlug/jedi

Small cleanup.

This commit is contained in:
Dave Halter
2017-05-07 15:22:45 +02:00
parent fe49fc9b99
commit 66b28ca840
2 changed files with 6 additions and 9 deletions

View File

@@ -512,10 +512,6 @@ class Function(ClassOrFunc):
except IndexError:
return None
def _get_paramlist_code(self):
return self.children[2].get_code()
class Lambda(Function):
"""
Lambdas are basically trimmed functions, so give it the same interface.
@@ -543,9 +539,6 @@ class Lambda(Function):
"""
raise AttributeError("lambda is not named.")
def _get_paramlist_code(self):
return '(' + ''.join(param.get_code() for param in self.params).strip() + ')'
def _get_param_nodes(self):
return self.children[1:-2]
@@ -554,7 +547,6 @@ class Lambda(Function):
"""
Returns `None`, lambdas don't have annotations.
"""
# lambda functions do not support annotations
return None
def __repr__(self):

View File

@@ -154,7 +154,12 @@ def get_call_signature(funcdef, width=72, call_string=None):
call_string = '<lambda>'
else:
call_string = funcdef.name.value
code = call_string + funcdef._get_paramlist_code()
if funcdef.type == 'lambdef':
p = '(' + ''.join(param.get_code() for param in funcdef.params).strip() + ')'
else:
p = funcdef.children[2].get_code()
code = call_string + p
return '\n'.join(textwrap.wrap(code, width))