Skip to content

Commit

Permalink
docs: fix regression with incorrect args order in docs (#1141)
Browse files Browse the repository at this point in the history
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/google-api-python-client/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [x] Appropriate docs were updated (if necessary)

Fixes #1140  馃
  • Loading branch information
parthea committed Dec 16, 2020
1 parent b1b0c83 commit 4249a7b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions describe.py
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

0 comments on commit 4249a7b

Please sign in to comment.