Skip to content

docs: fix regression with incorrect args order in docs #1141

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

Merged
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
14 changes: 10 additions & 4 deletions describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def method_params(doc):
args = doclines[begin + 1 :]

parameters = []
sorted_parameters = []
pname = None
desc = ""

Expand All @@ -223,7 +224,11 @@ def add_param(pname, desc):
return
if "(required)" not in desc:
pname = pname + "=None"
parameters.append(pname)
parameters.append(pname)
else:
# required params should be put straight into sorted_parameters
# to maintain order for positional args
sorted_parameters.append(pname)

for line in args:
m = re.search(r"^\s+([a-zA-Z0-9_]+): (.*)", line)
Expand All @@ -234,10 +239,11 @@ def add_param(pname, desc):
pname = m.group(1)
desc = m.group(2)
add_param(pname, desc)
parameters = ", ".join(sorted(parameters))
sorted_parameters.extend(sorted(parameters))
sorted_parameters = ", ".join(sorted_parameters)
else:
parameters = ""
return parameters
sorted_parameters = ""
return sorted_parameters


def method(name, doc):
Expand Down