diff options
-rwxr-xr-x | scripts/generate_schema_enums.py | 23 | ||||
-rwxr-xr-x | scripts/update_schemas.py | 9 |
2 files changed, 12 insertions, 20 deletions
diff --git a/scripts/generate_schema_enums.py b/scripts/generate_schema_enums.py index 13fbefe40f..3a147ffd82 100755 --- a/scripts/generate_schema_enums.py +++ b/scripts/generate_schema_enums.py @@ -1,24 +1,19 @@ #!/usr/bin/python3 import os +import re +import shutil import xml.etree.ElementTree as ET from collections import defaultdict -import shutil -import re - SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) REDFISH_SCHEMA_DIR = os.path.realpath( os.path.join(SCRIPT_DIR, "..", "static", "redfish", "v1", "schema") ) -OUTFOLDER = os.path.realpath(os.path.join( - SCRIPT_DIR, - "..", - "redfish-core", - "include", - "generated", - "enums" - ) +OUTFOLDER = os.path.realpath( + os.path.join( + SCRIPT_DIR, "..", "redfish-core", "include", "generated", "enums" + ) ) # Odata string types @@ -101,9 +96,7 @@ def write_enum_list(redfish_defs_file, enum_list, snake_case_namespace): # the C arrays are in their code not bmcwebs, so we have to explicitly # ignore the error. redfish_defs_file.write( - "NLOHMANN_JSON_SERIALIZE_ENUM({}, {{\n".format( - element.name - ) + "NLOHMANN_JSON_SERIALIZE_ENUM({}, {{\n".format(element.name) ) for value in values: redfish_defs_file.write( @@ -114,7 +107,7 @@ def write_enum_list(redfish_defs_file, enum_list, snake_case_namespace): print(element.name) - redfish_defs_file.write("}\n" "// clang-format on\n") + redfish_defs_file.write("}\n// clang-format on\n") def generate_enums(flat_list): diff --git a/scripts/update_schemas.py b/scripts/update_schemas.py index b1075d801b..0b66ac6b3f 100755 --- a/scripts/update_schemas.py +++ b/scripts/update_schemas.py @@ -6,8 +6,8 @@ import zipfile from collections import OrderedDict, defaultdict from io import BytesIO -import requests import generate_schema_enums +import requests VERSION = "DSP8010_2022.2" @@ -165,12 +165,12 @@ zip_ref = zipfile.ZipFile(zipBytesIO) class SchemaVersion: - ''' + """ A Python class for sorting Redfish schema versions. Allows sorting Redfish versions in the way humans expect, by comparing version strings as lists (ie 0_2_0 comes before 0_10_0) in the way humans expect. It does case insensitive schema name comparisons - ''' + """ def __init__(self, key): key = str.casefold(key) @@ -184,8 +184,7 @@ class SchemaVersion: if version.startswith("v"): version = version[1:] if any(char.isdigit() for char in version): - self.version_pieces.extend([int(x) - for x in version.split("_")]) + self.version_pieces.extend([int(x) for x in version.split("_")]) def __lt__(self, other): return self.version_pieces < other.version_pieces |