Skip to content

Commit c437e00

Browse files
committed
ENH: modified parse_pyrad_processes.py for better display of arguments
1 parent 0cb3317 commit c437e00

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

ci/parse_pyrad_processes.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ def dict_to_restructured_text(yaml_data):
3333
params = value2['parameters']
3434
for key3, value3 in params.items():
3535
rst_output.append(' ' + key3)
36-
rst_output.append(' ' + value3)
36+
for ele in value3:
37+
rst_output.append(' | ' + ele)
3738
rst_output.append('')
3839
rst_output.append('returns')
39-
rst_output.append(' ' + value2['returns'] +'\n')
40+
returns = value2['returns']
41+
for key3, value3 in returns.items():
42+
rst_output.append(' ' + key3)
43+
for ele in value3:
44+
rst_output.append(' | ' + ele)
45+
rst_output.append('')
4046
# rst_output.append(f"\n\n{value2['parameters']}\n\n")
4147
return '\n'.join(rst_output)
4248

@@ -57,9 +63,7 @@ def parse_string_to_dict(input_string):
5763
if current_key not in result_dict:
5864
result_dict[current_key] = ''
5965
for k in result_dict:
60-
result_dict[k] = result_dict[k].strip().strip('\n')
61-
result_dict[k] = " ".join(result_dict[k].split())
62-
66+
result_dict[k] = result_dict[k].strip().split('\n')
6367
return result_dict
6468

6569

@@ -99,9 +103,12 @@ def process_docstring(docstr):
99103
if start_reading_attr:
100104
attributes += line + '\n'
101105

106+
header = returns.split('\n')[0]
107+
returns_dict = {}
108+
returns_dict[header] = list(returns.strip().split('\n'))[1:]
102109
dic = {'description': " ".join(description.split()),
103110
'parameters': parse_string_to_dict(attributes),
104-
'returns': returns.strip()}
111+
'returns': returns_dict}
105112
return dic
106113

107114

0 commit comments

Comments
 (0)