Skip to content

Commit

Permalink
Merge pull request #28 from peterprescott/issue#27-FIX-black-compatib…
Browse files Browse the repository at this point in the history
…ility-issue

Issue#27 fix black compatibility issue
  • Loading branch information
simon-ritchie committed Jun 1, 2022
2 parents ab9aad0 + 6305f2a commit 47b8091
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion numdoclint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
check_python_module,
check_python_module_recursively)

__version__: str = '0.1.8'
__version__: str = '0.1.9'
32 changes: 30 additions & 2 deletions numdoclint/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ def get_func_overall_docstring(
is_docstring_last_line = True
line_indent_num = get_line_indent_num(line_str=line_str)
if (line_indent_num < indent_num and line_str != ''
and line_str.strip() != '):'
and not is_end_of_signature(line_str)
and not is_docstring_line
and not is_docstring_last_line):
break
Expand Down Expand Up @@ -445,6 +445,34 @@ def get_func_overall_docstring(
return docstring


def is_end_of_signature(line_str: str) -> bool:
"""
Get a boolean value as to whether line_str represents the end of a
function signature or not.
Parameters
----------
line_str : str
The target line string.
Returns
-------
bool
"""

try:
line_str = line_str.strip()
assert line_str[0] == ')'
assert line_str[-1] == ':'

if len(line_str)>2:
line_str = line_str.replace(' ','')
assert line_str[1:3] == '->'
return True
except Exception as e:
return False


def _type_anotation_comment_exists(line_str: str) -> bool:
"""
Get a boolean value whether type annotation comment exists
Expand Down Expand Up @@ -1309,7 +1337,7 @@ def get_func_str(module_str: str, func_name: str) -> str:
line_str = line_str.strip()
if line_str == '':
continue
if line_str.strip() == '):':
if is_end_of_signature(line_str):
continue
last_line_idx = i
break
Expand Down

0 comments on commit 47b8091

Please sign in to comment.