Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not omit arguments retrieved from docstring #114

Merged
merged 2 commits into from
Aug 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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