Skip to content

Commit 47b8091

Browse files
Merge pull request #28 from peterprescott/issue#27-FIX-black-compatibility-issue
Issue#27 fix black compatibility issue
2 parents ab9aad0 + 6305f2a commit 47b8091

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

numdoclint/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
check_python_module,
1818
check_python_module_recursively)
1919

20-
__version__: str = '0.1.8'
20+
__version__: str = '0.1.9'

numdoclint/helper.py

+30-2
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def get_func_overall_docstring(
404404
is_docstring_last_line = True
405405
line_indent_num = get_line_indent_num(line_str=line_str)
406406
if (line_indent_num < indent_num and line_str != ''
407-
and line_str.strip() != '):'
407+
and not is_end_of_signature(line_str)
408408
and not is_docstring_line
409409
and not is_docstring_last_line):
410410
break
@@ -445,6 +445,34 @@ def get_func_overall_docstring(
445445
return docstring
446446

447447

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+
448476
def _type_anotation_comment_exists(line_str: str) -> bool:
449477
"""
450478
Get a boolean value whether type annotation comment exists
@@ -1309,7 +1337,7 @@ def get_func_str(module_str: str, func_name: str) -> str:
13091337
line_str = line_str.strip()
13101338
if line_str == '':
13111339
continue
1312-
if line_str.strip() == '):':
1340+
if is_end_of_signature(line_str):
13131341
continue
13141342
last_line_idx = i
13151343
break

0 commit comments

Comments
 (0)