1
0
forked from VimPlug/jedi

Fix compiled docstrings for stubs

This commit is contained in:
Dave Halter
2018-09-04 10:08:09 +02:00
parent 5d24bc7625
commit e086c433ff
3 changed files with 36 additions and 12 deletions

View File

@@ -167,19 +167,23 @@ def get_call_signature(funcdef, width=72, call_string=None):
return '\n'.join(textwrap.wrap(code, width))
def get_call_signature_for_any(any_node):
call_signature = None
if any_node.type == 'classdef':
for funcdef in any_node.iter_funcdefs():
if funcdef.name.value == '__init__':
call_signature = \
get_call_signature(funcdef, call_string=any_node.name.value)
elif any_node.type in ('funcdef', 'lambdef'):
call_signature = get_call_signature(any_node)
return call_signature
def get_doc_with_call_signature(scope_node):
"""
Return a document string including call signature.
"""
call_signature = None
if scope_node.type == 'classdef':
for funcdef in scope_node.iter_funcdefs():
if funcdef.name.value == '__init__':
call_signature = \
get_call_signature(funcdef, call_string=scope_node.name.value)
elif scope_node.type in ('funcdef', 'lambdef'):
call_signature = get_call_signature(scope_node)
call_signature = get_call_signature_for_any(scope_node)
doc = clean_scope_docstring(scope_node)
if call_signature is None:
return doc