format: reformat with latest openbmc-build-scripts

Reformat the repository using the latest from openbmc-build-scripts.
Add the `static/redfish` directory to be ignored by prettier since
these files come from elsewhere and having the ability to do a direct
diff is handy.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I74464d6f97047b4888a591e0d8a4f5ca970ac69e
diff --git a/scripts/check_base_registry.py b/scripts/check_base_registry.py
index 1db533a..663c6e0 100755
--- a/scripts/check_base_registry.py
+++ b/scripts/check_base_registry.py
@@ -4,10 +4,9 @@
 import json
 import re
 
-
 parser = argparse.ArgumentParser()
-parser.add_argument('-b', '--base', default=None, required=True)
-parser.add_argument('-f', '--file', default=None, required=True)
+parser.add_argument("-b", "--base", default=None, required=True)
+parser.add_argument("-f", "--file", default=None, required=True)
 args = parser.parse_args()
 
 with open(args.file) as error_file:
@@ -15,9 +14,14 @@
 
     with open(args.base) as base_file:
         base_json = json.load(base_file)
-        for message_name, message_data in base_json['Messages'].items():
-            message_id = base_json['RegistryPrefix'] + '.' + \
-                base_json['RegistryVersion'] + '.' + message_name
+        for message_name, message_data in base_json["Messages"].items():
+            message_id = (
+                base_json["RegistryPrefix"]
+                + "."
+                + base_json["RegistryVersion"]
+                + "."
+                + message_name
+            )
             message_found = False
             index = 0
             for i, error in enumerate(error_data):
@@ -29,33 +33,38 @@
                 print("{} not found".format(message_id))
                 continue
 
-            error_info = error_data[index:index + 15]
+            error_info = error_data[index : index + 15]
             error_str = " ".join(error_info)
             error_str = re.sub(
-                'std::to_string\\(arg(\\d+)\\)',
-                'arg\\1',
-                error_str)
-            error_str = re.sub('"\n\\s*"', '', error_str, re.MULTILINE)
+                "std::to_string\\(arg(\\d+)\\)", "arg\\1", error_str
+            )
+            error_str = re.sub('"\n\\s*"', "", error_str, re.MULTILINE)
             error_str = re.sub(
                 '"\\s*\\+\\s*arg(\\d+)\\s*\\+\n?\\s*"',
-                '%\\1',
+                "%\\1",
                 error_str,
-                re.MULTILINE)
-            if message_data['Message'] not in error_str:
+                re.MULTILINE,
+            )
+            if message_data["Message"] not in error_str:
                 print(
                     "{}: error in Message: {}".format(
-                        message_id,
-                        message_data['Message']))
+                        message_id, message_data["Message"]
+                    )
+                )
                 print(error_str)
 
-            if message_data['MessageSeverity'] not in error_str:
-                print("{}: error in MessageSeverity: {}".format(
-                    message_id, message_data['MessageSeverity']))
+            if message_data["MessageSeverity"] not in error_str:
+                print(
+                    "{}: error in MessageSeverity: {}".format(
+                        message_id, message_data["MessageSeverity"]
+                    )
+                )
                 print(error_str)
 
-            if message_data['Resolution'] not in error_str:
+            if message_data["Resolution"] not in error_str:
                 print(
                     "{}: error in Resolution: {}".format(
-                        message_id,
-                        message_data['Resolution']))
+                        message_id, message_data["Resolution"]
+                    )
+                )
                 print(error_str)
diff --git a/scripts/parse_registries.py b/scripts/parse_registries.py
index bfe87ef..369bebf 100755
--- a/scripts/parse_registries.py
+++ b/scripts/parse_registries.py
@@ -1,14 +1,14 @@
 #!/usr/bin/env python3
+import argparse
 import json
 import os
 
 import requests
-import argparse
 
-PRAGMA_ONCE = '''#pragma once
-'''
+PRAGMA_ONCE = """#pragma once
+"""
 
-WARNING = '''/****************************************************************
+WARNING = """/****************************************************************
  *                 READ THIS WARNING FIRST
  * This is an auto-generated header which contains definitions
  * for Redfish DMTF defined messages.
@@ -17,9 +17,12 @@
  * this file are owned by DMTF.  Any modifications to these files
  * should be first pushed to the relevant registry in the DMTF
  * github organization.
- ***************************************************************/'''
+ ***************************************************************/"""
 
-REGISTRY_HEADER = PRAGMA_ONCE + WARNING + '''
+REGISTRY_HEADER = (
+    PRAGMA_ONCE
+    + WARNING
+    + """
 #include "registries.hpp"
 
 #include <array>
@@ -28,25 +31,20 @@
 
 namespace redfish::registries::{}
 {{
-'''
+"""
+)
 
 SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
 
 include_path = os.path.realpath(
-    os.path.join(
-        SCRIPT_DIR,
-        "..",
-        "redfish-core",
-        "include",
-        "registries"))
+    os.path.join(SCRIPT_DIR, "..", "redfish-core", "include", "registries")
+)
 
-proxies = {
-    'https': os.environ.get("https_proxy", None)
-}
+proxies = {"https": os.environ.get("https_proxy", None)}
 
 
 def make_getter(dmtf_name, header_name, type_name):
-    url = 'https://redfish.dmtf.org/registries/{}'.format(dmtf_name)
+    url = "https://redfish.dmtf.org/registries/{}".format(dmtf_name)
     dmtf = requests.get(url, proxies=proxies)
     dmtf.raise_for_status()
     json_file = json.loads(dmtf.text)
@@ -62,72 +60,68 @@
         except BaseException:
             print("{} not found".format(file))
 
-        with open(file, 'w') as registry:
+        with open(file, "w") as registry:
             registry.write(REGISTRY_HEADER.format(namespace))
             # Parse the Registry header info
             registry.write(
                 "const Header header = {{\n"
-                "    \"{json_dict[@Redfish.Copyright]}\",\n"
-                "    \"{json_dict[@odata.type]}\",\n"
-                "    \"{json_dict[Id]}\",\n"
-                "    \"{json_dict[Name]}\",\n"
-                "    \"{json_dict[Language]}\",\n"
-                "    \"{json_dict[Description]}\",\n"
-                "    \"{json_dict[RegistryPrefix]}\",\n"
-                "    \"{json_dict[RegistryVersion]}\",\n"
-                "    \"{json_dict[OwningEntity]}\",\n"
+                '    "{json_dict[@Redfish.Copyright]}",\n'
+                '    "{json_dict[@odata.type]}",\n'
+                '    "{json_dict[Id]}",\n'
+                '    "{json_dict[Name]}",\n'
+                '    "{json_dict[Language]}",\n'
+                '    "{json_dict[Description]}",\n'
+                '    "{json_dict[RegistryPrefix]}",\n'
+                '    "{json_dict[RegistryVersion]}",\n'
+                '    "{json_dict[OwningEntity]}",\n'
                 "}};\n"
                 "constexpr const char* url =\n"
-                "    \"{url}\";\n"
+                '    "{url}";\n'
                 "\n"
                 "constexpr std::array registry =\n"
                 "{{\n".format(
                     json_dict=json_dict,
                     url=url,
-                ))
+                )
+            )
 
             messages_sorted = sorted(json_dict["Messages"].items())
             for messageId, message in messages_sorted:
                 registry.write(
                     "    MessageEntry{{\n"
-                    "        \"{messageId}\",\n"
+                    '        "{messageId}",\n'
                     "        {{\n"
-                    "            \"{message[Description]}\",\n"
-                    "            \"{message[Message]}\",\n"
-                    "            \"{message[MessageSeverity]}\",\n"
+                    '            "{message[Description]}",\n'
+                    '            "{message[Message]}",\n'
+                    '            "{message[MessageSeverity]}",\n'
                     "            {message[NumberOfArgs]},\n"
                     "            {{".format(
-                        messageId=messageId,
-                        message=message
-                    ))
+                        messageId=messageId, message=message
+                    )
+                )
                 paramTypes = message.get("ParamTypes")
                 if paramTypes:
                     for paramType in paramTypes:
                         registry.write(
-                            "\n"
-                            "                \"{}\",".format(paramType)
+                            '\n                "{}",'.format(paramType)
                         )
                     registry.write("\n            },\n")
                 else:
                     registry.write("},\n")
                 registry.write(
-                    "            \"{message[Resolution]}\",\n"
-                    "        }}}},\n".format(message=message))
+                    '            "{message[Resolution]}",\n'
+                    "        }}}},\n".format(message=message)
+                )
 
-            registry.write(
-                "\n};\n"
-                "\n"
-                "enum class Index\n"
-                "{\n"
-            )
+            registry.write("\n};\n\nenum class Index\n{\n")
             for index, (messageId, message) in enumerate(messages_sorted):
                 messageId = messageId[0].lower() + messageId[1:]
-                registry.write(
-                    "    {} = {},\n".format(messageId, index))
+                registry.write("    {} = {},\n".format(messageId, index))
             registry.write(
-                "}};\n"
-                "}} // namespace redfish::registries::{}\n"
-                .format(namespace))
+                "}};\n}} // namespace redfish::registries::{}\n".format(
+                    namespace
+                )
+            )
 
 
 def get_privilege_string_from_list(privilege_list):
@@ -138,9 +132,9 @@
         for privilege in privileges:
             if privilege == "NoAuth":
                 continue
-            privilege_string += "\""
+            privilege_string += '"'
             privilege_string += privilege
-            privilege_string += "\",\n"
+            privilege_string += '",\n'
         if privilege != "NoAuth":
             privilege_string = privilege_string[:-2]
         privilege_string += "}"
@@ -158,7 +152,10 @@
     return "Or".join(names)
 
 
-PRIVILEGE_HEADER = PRAGMA_ONCE + WARNING + '''
+PRIVILEGE_HEADER = (
+    PRAGMA_ONCE
+    + WARNING
+    + """
 #include "privileges.hpp"
 
 #include <array>
@@ -167,29 +164,34 @@
 
 namespace redfish::privileges
 {
-'''
+"""
+)
 
 
 def make_privilege_registry():
-    path, json_file, type_name, url = \
-        make_getter('Redfish_1.3.0_PrivilegeRegistry.json',
-                    'privilege_registry.hpp', 'privilege')
-    with open(path, 'w') as registry:
+    path, json_file, type_name, url = make_getter(
+        "Redfish_1.3.0_PrivilegeRegistry.json",
+        "privilege_registry.hpp",
+        "privilege",
+    )
+    with open(path, "w") as registry:
         registry.write(PRIVILEGE_HEADER)
 
         privilege_dict = {}
         for mapping in json_file["Mappings"]:
             # first pass, identify all the unique privilege sets
             for operation, privilege_list in mapping["OperationMap"].items():
-                privilege_dict[get_privilege_string_from_list(
-                    privilege_list)] = (privilege_list, )
+                privilege_dict[
+                    get_privilege_string_from_list(privilege_list)
+                ] = (privilege_list,)
         for index, key in enumerate(privilege_dict):
-            (privilege_list, ) = privilege_dict[key]
+            (privilege_list,) = privilege_dict[key]
             name = get_variable_name_for_privilege_set(privilege_list)
             registry.write(
                 "const std::array<Privileges, {length}> "
-                "privilegeSet{name} = {key};\n"
-                .format(length=len(privilege_list), name=name, key=key)
+                "privilegeSet{name} = {key};\n".format(
+                    length=len(privilege_list), name=name, key=key
+                )
             )
             privilege_dict[key] = (privilege_list, name)
 
@@ -198,26 +200,29 @@
             registry.write("// {}\n".format(entity))
             for operation, privilege_list in mapping["OperationMap"].items():
                 privilege_string = get_privilege_string_from_list(
-                    privilege_list)
+                    privilege_list
+                )
                 operation = operation.lower()
 
                 registry.write(
                     "const static auto& {}{} = privilegeSet{};\n".format(
-                        operation,
-                        entity,
-                        privilege_dict[privilege_string][1]))
+                        operation, entity, privilege_dict[privilege_string][1]
+                    )
+                )
             registry.write("\n")
         registry.write(
-            "} // namespace redfish::privileges\n"
-            "// clang-format on\n")
+            "} // namespace redfish::privileges\n// clang-format on\n"
+        )
 
 
 def main():
     parser = argparse.ArgumentParser()
     parser.add_argument(
-        '--registries', type=str,
+        "--registries",
+        type=str,
         default="base,task_event,resource_event,privilege",
-        help="Comma delimited list of registries to update")
+        help="Comma delimited list of registries to update",
+    )
 
     args = parser.parse_args()
 
@@ -225,17 +230,27 @@
     files = []
 
     if "base" in registries:
-        files.append(make_getter('Base.1.13.0.json',
-                                 'base_message_registry.hpp',
-                                 'base'))
+        files.append(
+            make_getter(
+                "Base.1.13.0.json", "base_message_registry.hpp", "base"
+            )
+        )
     if "task_event" in registries:
-        files.append(make_getter('TaskEvent.1.0.3.json',
-                                 'task_event_message_registry.hpp',
-                                 'task_event'))
+        files.append(
+            make_getter(
+                "TaskEvent.1.0.3.json",
+                "task_event_message_registry.hpp",
+                "task_event",
+            )
+        )
     if "resource_event" in registries:
-        files.append(make_getter('ResourceEvent.1.0.3.json',
-                                 'resource_event_message_registry.hpp',
-                                 'resource_event'))
+        files.append(
+            make_getter(
+                "ResourceEvent.1.0.3.json",
+                "resource_event_message_registry.hpp",
+                "resource_event",
+            )
+        )
 
     update_registries(files)
 
diff --git a/scripts/update_schemas.py b/scripts/update_schemas.py
index da9c346..459d045 100755
--- a/scripts/update_schemas.py
+++ b/scripts/update_schemas.py
@@ -1,14 +1,13 @@
 #!/usr/bin/env python3
-import requests
-import zipfile
-from io import BytesIO
-from packaging.version import parse
-
 import os
-from collections import OrderedDict, defaultdict
 import shutil
-
 import xml.etree.ElementTree as ET
+import zipfile
+from collections import OrderedDict, defaultdict
+from io import BytesIO
+
+import requests
+from packaging.version import parse
 
 VERSION = "DSP8010_2022.2"
 
@@ -42,7 +41,7 @@
     "ComputerSystemCollection",
     "Drive",
     "DriveCollection",
-    'EnvironmentMetrics',
+    "EnvironmentMetrics",
     "EthernetInterface",
     "EthernetInterfaceCollection",
     "Event",
@@ -254,7 +253,6 @@
 
 csdl_filenames.sort(key=version_sort_key)
 with open(metadata_index_path, "w") as metadata_index:
-
     metadata_index.write('<?xml version="1.0" encoding="UTF-8"?>\n')
     metadata_index.write(
         "<edmx:Edmx xmlns:edmx="
@@ -270,7 +268,6 @@
             continue
 
         with open(os.path.join(schema_path, filename), "wb") as schema_out:
-
             metadata_index.write(
                 '    <edmx:Reference Uri="/redfish/v1/schema/'
                 + filename
@@ -289,16 +286,14 @@
                             namespace = data_child.attrib["Namespace"]
                             if namespace.startswith("RedfishExtensions"):
                                 metadata_index.write(
-                                    "        "
-                                    '<edmx:Include Namespace="'
+                                    '        <edmx:Include Namespace="'
                                     + namespace
                                     + '"  Alias="Redfish"/>\n'
                                 )
 
                             else:
                                 metadata_index.write(
-                                    "        "
-                                    '<edmx:Include Namespace="'
+                                    '        <edmx:Include Namespace="'
                                     + namespace
                                     + '"/>\n'
                                 )
@@ -392,6 +387,6 @@
     for schema_file in json_schema_files:
         hpp_file.write('        "{}",\n'.format(schema_file))
 
-    hpp_file.write("    };\n" "}\n")
+    hpp_file.write("    };\n}\n")
 
 zip_ref.close()
diff --git a/scripts/websocket_test.py b/scripts/websocket_test.py
index 85b2c0d..21c7f16 100755
--- a/scripts/websocket_test.py
+++ b/scripts/websocket_test.py
@@ -3,20 +3,23 @@
 # Example of streaming sensor values from openbmc using the /subscribe api
 # requires websockets package to be installed
 
+import argparse
 import asyncio
-import ssl
-import websockets
 import base64
 import json
-import argparse
+import ssl
+
+import websockets
 
 parser = argparse.ArgumentParser()
 parser.add_argument("--host", help="Host to connect to", required=True)
 parser.add_argument(
-    "--username", help="Username to connect with", default="root")
+    "--username", help="Username to connect with", default="root"
+)
 parser.add_argument("--password", help="Password to use", default="0penBmc")
-parser.add_argument('--ssl', default=True,
-                    action=argparse.BooleanOptionalAction)
+parser.add_argument(
+    "--ssl", default=True, action=argparse.BooleanOptionalAction
+)
 
 args = parser.parse_args()
 
@@ -29,27 +32,30 @@
     "altitude": "Meters",
     "current": "Amps",
     "energy": "Joules",
-    "cfm": "CFM"
+    "cfm": "CFM",
 }
 
 
 async def hello():
-    protocol = 'ws'
+    protocol = "ws"
     if args.ssl:
-        protocol += 's'
-    uri = '{}://{}/subscribe'.format(protocol, args.host)
+        protocol += "s"
+    uri = "{}://{}/subscribe".format(protocol, args.host)
     ssl_context = ssl.SSLContext()
-    authbytes = "{}:{}".format(args.username, args.password).encode('ascii')
-    auth = "Basic {}".format(base64.b64encode(authbytes).decode('ascii'))
+    authbytes = "{}:{}".format(args.username, args.password).encode("ascii")
+    auth = "Basic {}".format(base64.b64encode(authbytes).decode("ascii"))
     headers = {"Authorization": auth}
-    async with \
-        websockets.connect(uri, ssl=ssl_context, extra_headers=headers) \
-            if args.ssl else websockets.connect(uri, extra_headers=headers) \
-            as websocket:
-        request = json.dumps({
-            "paths": ["/xyz/openbmc_project/sensors"],
-            "interfaces": ["xyz.openbmc_project.Sensor.Value"]
-        })
+    async with websockets.connect(
+        uri, ssl=ssl_context, extra_headers=headers
+    ) if args.ssl else websockets.connect(
+        uri, extra_headers=headers
+    ) as websocket:
+        request = json.dumps(
+            {
+                "paths": ["/xyz/openbmc_project/sensors"],
+                "interfaces": ["xyz.openbmc_project.Sensor.Value"],
+            }
+        )
         await websocket.send(request)
 
         while True: