Skip to content

Commit

Permalink
MNT: also ensure description does not produce empty tags, python-ify …
Browse files Browse the repository at this point in the history
…if statements
  • Loading branch information
tangkong committed Feb 28, 2025
1 parent 3efb92b commit 4751ba8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Scripts/alarm_csv2xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ def csvtoxml(infile, outfile, cname):
else:
raise ValueError(f'Got unsupported protocol "{protocol}" in {pv_name}')
pv.set('name', pv_name)
desc = ET.SubElement(pv, 'description')
desc.text = row['Description']
if row.get('Description', False):
desc = ET.SubElement(pv, 'description')
desc.text = row['Description']
latch = ET.SubElement(pv, 'latching')
latch.text = row['Latch'].capitalize() if row['Latch'] else "True"
if "Delay" in row and row['Delay']:
if row.get('Delay', False):
delay = ET.SubElement(pv, 'delay')
delay.text = row['Delay']
if 'Filter' in row and row['Filter']:
if row.get('Filter', False):
filter = ET.SubElement(pv, 'filter')
filter.text = row['Filter']
if 'Guidance' in row and row['Guidance']:
if row.get('Guidance', False):
guidance = ET.SubElement(pv, 'guidance')
guidance.text = row['Guidance']

Expand Down

0 comments on commit 4751ba8

Please sign in to comment.