python: fix flake8 warnings and format with black
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ic22e2599e4b4ba3e466e5b3bf3cb388cea9fa446
diff --git a/errors_map_gen.py b/errors_map_gen.py
index 47f05c6..a7fac0d 100755
--- a/errors_map_gen.py
+++ b/errors_map_gen.py
@@ -1,31 +1,36 @@
#!/usr/bin/env python3
+import argparse
import os
+
import yaml
from mako.template import Template
-import argparse
+
def main():
parser = argparse.ArgumentParser(
- description="OpenPOWER error map code generator")
+ description="OpenPOWER error map code generator"
+ )
parser.add_argument(
- '-i', '--errors_map_yaml', dest='errors_map_yaml',
- default='errors_watch.yaml', help='input errors watch yaml file to parse')
+ "-i",
+ "--errors_map_yaml",
+ dest="errors_map_yaml",
+ default="errors_watch.yaml",
+ help="input errors watch yaml file to parse",
+ )
args = parser.parse_args()
- with open(os.path.join(script_dir, args.errors_map_yaml), 'r') as fd:
+ with open(os.path.join(script_dir, args.errors_map_yaml), "r") as fd:
yamlDict = yaml.safe_load(fd)
# Render the mako template
- template = os.path.join(script_dir, 'errors_map.mako.hpp')
+ template = os.path.join(script_dir, "errors_map.mako.hpp")
t = Template(filename=template)
- with open('errors_map.hpp', 'w') as fd:
- fd.write(
- t.render(
- errDict=yamlDict))
+ with open("errors_map.hpp", "w") as fd:
+ fd.write(t.render(errDict=yamlDict))
-if __name__ == '__main__':
+if __name__ == "__main__":
script_dir = os.path.dirname(os.path.realpath(__file__))
main()