@@ -404,7 +404,7 @@ def get_func_overall_docstring(
404
404
is_docstring_last_line = True
405
405
line_indent_num = get_line_indent_num (line_str = line_str )
406
406
if (line_indent_num < indent_num and line_str != ''
407
- and line_str . strip () != '):'
407
+ and not is_end_of_signature ( line_str )
408
408
and not is_docstring_line
409
409
and not is_docstring_last_line ):
410
410
break
@@ -445,6 +445,34 @@ def get_func_overall_docstring(
445
445
return docstring
446
446
447
447
448
+ def is_end_of_signature (line_str : str ) -> bool :
449
+ """
450
+ Get a boolean value as to whether line_str represents the end of a
451
+ function signature or not.
452
+
453
+ Parameters
454
+ ----------
455
+ line_str : str
456
+ The target line string.
457
+
458
+ Returns
459
+ -------
460
+ bool
461
+ """
462
+
463
+ try :
464
+ line_str = line_str .strip ()
465
+ assert line_str [0 ] == ')'
466
+ assert line_str [- 1 ] == ':'
467
+
468
+ if len (line_str )> 2 :
469
+ line_str = line_str .replace (' ' ,'' )
470
+ assert line_str [1 :3 ] == '->'
471
+ return True
472
+ except Exception as e :
473
+ return False
474
+
475
+
448
476
def _type_anotation_comment_exists (line_str : str ) -> bool :
449
477
"""
450
478
Get a boolean value whether type annotation comment exists
@@ -1309,7 +1337,7 @@ def get_func_str(module_str: str, func_name: str) -> str:
1309
1337
line_str = line_str .strip ()
1310
1338
if line_str == '' :
1311
1339
continue
1312
- if line_str . strip () == '):' :
1340
+ if is_end_of_signature ( line_str ) :
1313
1341
continue
1314
1342
last_line_idx = i
1315
1343
break
0 commit comments