Skip to content

Commit

Permalink
ENH: modified parse_pyrad_processes.py for better display of arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfidan committed Sep 30, 2024
1 parent 0cb3317 commit c437e00
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions ci/parse_pyrad_processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,16 @@ def dict_to_restructured_text(yaml_data):
params = value2['parameters']
for key3, value3 in params.items():
rst_output.append(' ' + key3)
rst_output.append(' ' + value3)
for ele in value3:
rst_output.append(' | ' + ele)
rst_output.append('')
rst_output.append('returns')
rst_output.append(' ' + value2['returns'] +'\n')
returns = value2['returns']
for key3, value3 in returns.items():
rst_output.append(' ' + key3)
for ele in value3:
rst_output.append(' | ' + ele)
rst_output.append('')
# rst_output.append(f"\n\n{value2['parameters']}\n\n")
return '\n'.join(rst_output)

Expand All @@ -57,9 +63,7 @@ def parse_string_to_dict(input_string):
if current_key not in result_dict:
result_dict[current_key] = ''
for k in result_dict:
result_dict[k] = result_dict[k].strip().strip('\n')
result_dict[k] = " ".join(result_dict[k].split())

result_dict[k] = result_dict[k].strip().split('\n')
return result_dict


Expand Down Expand Up @@ -99,9 +103,12 @@ def process_docstring(docstr):
if start_reading_attr:
attributes += line + '\n'

header = returns.split('\n')[0]
returns_dict = {}
returns_dict[header] = list(returns.strip().split('\n'))[1:]
dic = {'description': " ".join(description.split()),
'parameters': parse_string_to_dict(attributes),
'returns': returns.strip()}
'returns': returns_dict}
return dic


Expand Down

0 comments on commit c437e00

Please sign in to comment.