summaryrefslogtreecommitdiffstats
path: root/parse_led.py
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2017-05-31 17:12:37 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-06-05 20:09:31 +0000
commitd27c68f40480070a70d17b58af17a9d8a1704ae3 (patch)
treea3a40fd731352599d93942b2954e48d1c799c79e /parse_led.py
parent3eedbe446da22b1339616cd04f56b1da520a4fd9 (diff)
downloadphosphor-led-manager-d27c68f40480070a70d17b58af17a9d8a1704ae3.tar.gz
phosphor-led-manager-d27c68f40480070a70d17b58af17a9d8a1704ae3.zip
parse_led.py: python3 fixes
* iteritems / iterkeys does not exist in python3, use items / keys directly. * Order of dicts cannot be relied on. Change-Id: Ieaf5f58115d4015070d812814d98ca1e58d92ae2 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'parse_led.py')
-rwxr-xr-xparse_led.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/parse_led.py b/parse_led.py
index da23328..5afe4b0 100755
--- a/parse_led.py
+++ b/parse_led.py
@@ -44,7 +44,7 @@ if __name__ == '__main__':
ofile.write('static const std::map<std::string,')
ofile.write(' std::set<phosphor::led::Layout::LedAction>>')
ofile.write(' systemLedMap = {\n\n')
- for group in ifile.iterkeys():
+ for group in ifile.keys():
# This section generates an std::map of LedGroupNames to std::set
# of LEDs containing the name and properties
ledset = ifile[group]
@@ -59,18 +59,13 @@ if __name__ == '__main__':
ofile.write(' }},\n')
continue
- for led_dict, list_dict in ledset.iteritems():
- # Need this to make sure the LED name is printed once
- name_printed = False
- for name, value in list_dict.iteritems():
- if group and led_dict and name:
- if name_printed is False:
- ofile.write(' {\"' + underscore(led_dict) +
- '\",')
- name_printed = True
- if name == 'Action':
- ofile.write('phosphor::led::Layout::')
- ofile.write(str(value) + ',')
+ for led_dict, list_dict in ledset.items():
+ ofile.write(' {\"' + underscore(led_dict) + '\",')
+ ofile.write('phosphor::led::Layout::' +
+ str(list_dict.get('Action', 'Off')) + ',')
+ ofile.write(str(list_dict.get('DutyOn', 0)) + ',')
+ ofile.write(str(list_dict.get('Period', 0)) + ',')
+
ofile.write('},\n')
ofile.write(' }},\n')
ofile.write('};\n')
OpenPOWER on IntegriCloud