python: fix flake8 warnings and format with black
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ic5b4e7ca7f2abf9b12aaa21cea29caf5617ae9f6
diff --git a/writefru.py b/writefru.py
index b77f830..d623eb7 100755
--- a/writefru.py
+++ b/writefru.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 FRU VPD parser and code generator")
+ description="OpenPOWER FRU VPD parser and code generator"
+ )
parser.add_argument(
- '-i', '--inventory_yaml', dest='inventory_yaml',
- default='writefru.yaml', help='input inventory yaml file to parse')
+ "-i",
+ "--inventory_yaml",
+ dest="inventory_yaml",
+ default="writefru.yaml",
+ help="input inventory yaml file to parse",
+ )
args = parser.parse_args()
- with open(os.path.join(script_dir, args.inventory_yaml), 'r') as fd:
+ with open(os.path.join(script_dir, args.inventory_yaml), "r") as fd:
yamlDict = yaml.safe_load(fd)
# Render the mako template
- template = os.path.join(script_dir, 'writefru.mako.hpp')
+ template = os.path.join(script_dir, "writefru.mako.hpp")
t = Template(filename=template)
- with open('writefru.hpp', 'w') as fd:
- fd.write(
- t.render(
- fruDict=yamlDict))
+ with open("writefru.hpp", "w") as fd:
+ fd.write(t.render(fruDict=yamlDict))
-if __name__ == '__main__':
+if __name__ == "__main__":
script_dir = os.path.dirname(os.path.realpath(__file__))
main()