python: enable code formatting
Enable code formatting in CI by creating a dummy Python 'setup.cfg'
and fix up the minor errors reported.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9ddaa263f7407c42fb4f58d478bd2efb1d2fe026
diff --git a/tools/elog-gen.py b/tools/elog-gen.py
index 63b8969..9b9edac 100755
--- a/tools/elog-gen.py
+++ b/tools/elog-gen.py
@@ -176,6 +176,7 @@
metadata_process=metadata_process))
f.close()
+
def get_elog_data(i_elog_yaml,
i_elog_meta_yaml,
i_namespace,
@@ -196,7 +197,7 @@
meta_data, parents, metadata_process) = o_elog_data
ifile = yaml.safe_load(open(i_elog_yaml))
- #for all the errors in error yaml file
+ # for all the errors in error yaml file
for error in ifile:
if 'name' not in error:
print("Error - Did not find name in entry %s in file %s " % (
@@ -208,11 +209,11 @@
if 'description' in error:
error_msg[fullname] = error['description'].strip()
- #set default values
+ # set default values
error_lvl[fullname] = "ERR"
parents[fullname] = None
- #check if meta data yaml file is found
+ # check if meta data yaml file is found
if not os.path.isfile(i_elog_meta_yaml):
continue
mfile = yaml.safe_load(open(i_elog_meta_yaml))
@@ -233,7 +234,7 @@
# Get 0th inherited error (current support - single inheritance)
if 'inherits' in match:
- parents[fullname] = match['inherits'][0]
+ parents[fullname] = match['inherits'][0]
# Put all errors in meta[] even the meta is empty
# so that child errors could inherits such error without meta
@@ -247,7 +248,7 @@
meta_data[str_short]['str'] = i['str']
meta_data[str_short]['str_short'] = str_short
meta_data[str_short]['type'] = get_cpp_type(i['type'])
- if ('process' in i) and (True == i['process']):
+ if ('process' in i) and (i['process'] is True):
metadata_process[str_short] = fullname + "." + str_short
meta[fullname] = tmp_meta
@@ -291,6 +292,7 @@
options.templatedir,
options.elog_mako)
+
# Only run if it's a script
if __name__ == '__main__':
main(sys.argv[1:])