diff --git a/jedi/parser/python/tree.py b/jedi/parser/python/tree.py index 43b5e977..5310dbfd 100644 --- a/jedi/parser/python/tree.py +++ b/jedi/parser/python/tree.py @@ -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): diff --git a/jedi/parser_utils.py b/jedi/parser_utils.py index df340f6b..a3d97be9 100644 --- a/jedi/parser_utils.py +++ b/jedi/parser_utils.py @@ -154,7 +154,12 @@ def get_call_signature(funcdef, width=72, call_string=None): call_string = '' 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))