-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathupdateAlerts_rst.py
More file actions
35 lines (32 loc) · 1.19 KB
/
updateAlerts_rst.py
File metadata and controls
35 lines (32 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""Build rst files appropriate for the **currently-installed** psychopy.alerts
"""
from pathlib import Path
from psychopy.alerts import catalog
thisFolder = Path(__file__).parent
alertDocsRoot = thisFolder / "source/alerts"
for ID in catalog.alert:
alert = catalog.alert[ID]
if 'label' in alert:
label = alert['label']
else:
label = alert['synopsis']
with open(alertDocsRoot / (str(ID)+'.rst'), 'w') as f:
titleStr = f"{ID}: {label}\n"
f.write(f"{ID}: {label}\n")
f.write(f"="*len(titleStr) + "\n\n")
if 'synopsis' in alert:
f.write(f"Synopsis\n")
f.write(f"-----------\n\n")
f.write(alert["synopsis"] + "\n\n")
if 'details' in alert:
f.write(f"Details\n")
f.write(f"-----------\n\n")
f.write(alert["details"] + "\n\n")
if 'versions' in alert:
f.write(f"PsychoPy versions affected\n")
f.write(f"---------------------------\n\n")
f.write(alert["versions"] + "\n\n")
if 'solutions' in alert:
f.write(f"Solutions\n")
f.write(f"-----------\n\n")
f.write(alert["solutions"] + "\n\n")