Skip to content

Commit 7a4e8b0

Browse files
author
takuya_sekiguchi
committed
#18 Fix incorrect argument name extraction pattern.
1 parent d42ca61 commit 7a4e8b0

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
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__ = '0.1.2'
20+
__version__ = '0.1.3'

numdoclint/helper.py

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def get_arg_name_list(
143143
"""
144144
args_str = _get_args_str(
145145
code_str=py_module_str, func_name=func_name)
146+
args_str = _remove_type_bracket_block_from_args_str(args_str=args_str)
146147
splitted_arg_name_list = args_str.split(',')
147148
arg_name_list = []
148149
for arg_name in splitted_arg_name_list:

tests/test_helper.py

+8
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ def sample_func_6(self, cls, price, name, *args, **kwargs):
8585
8686
def sample_func_7(price: int = 100, name: str = 'apple'):
8787
pass
88+
89+
90+
def sample_func_8(dict_val: Optional[Dict[str, int]] = None):
91+
pass
8892
"""
8993

9094
arg_name_list = helper.get_arg_name_list(
@@ -121,6 +125,10 @@ def sample_func_7(price: int = 100, name: str = 'apple'):
121125
py_module_str=py_module_str, func_name='sample_func_7')
122126
assert arg_name_list == ['price', 'name']
123127

128+
arg_name_list = helper.get_arg_name_list(
129+
py_module_str=py_module_str, func_name='sample_func_8')
130+
assert arg_name_list == ['dict_val']
131+
124132

125133
def test_get_func_indent_num():
126134
py_module_str = """

0 commit comments

Comments
 (0)