Skip to content

Commit

Permalink
fix: do not omit arguments retrieved from docstring (#114)
Browse files Browse the repository at this point in the history
* fix: do not omit arguments retrieved from docstring

* chore: update comments
  • Loading branch information
dandhlee authored Aug 25, 2021
1 parent 1328c5a commit 18bf0de
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion docfx_yaml/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,8 @@ def _update_friendly_package_name(path):
lines = []
short_name = name.split('.')[-1]
args = []
# Check how many arguments are present in the function.
arg_count = 0
try:
if _type in [METHOD, FUNCTION]:
argspec = inspect.getfullargspec(obj) # noqa
Expand All @@ -568,6 +570,9 @@ def _update_friendly_package_name(path):
print(f"Could not parse argument information for {annotation}.")
continue

# Add up the number of arguments. `argspec.args` contains a list of
# all the arguments from the function.
arg_count += len(argspec.args)
for arg in argspec.args:
arg_map = {}
# Ignore adding in entry for "self"
Expand Down Expand Up @@ -708,7 +713,9 @@ def _update_friendly_package_name(path):
if args or sig or summary_info:
datam['syntax'] = {}

if args:
# If there are well-formatted arguments or a lot of arguments we should look
# into, loop through what we got from the docstring.
if args or arg_count > 0:
variables = summary_info['variables']
arg_id = []
for arg in args:
Expand Down

0 comments on commit 18bf0de

Please sign in to comment.