black: re-format

black and isort are enabled in the openbmc-build-scripts on Python files
to have a consistent formatting.  Re-run the formatter on the whole
repository.

Change-Id: If1010ead857d41364c024bf8145a979a9377d382
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/lib/pldm_utils.py b/lib/pldm_utils.py
index 35fe929..81e53fe 100755
--- a/lib/pldm_utils.py
+++ b/lib/pldm_utils.py
@@ -4,18 +4,18 @@
 PLDM functions.
 """
 
-import re
-import var_funcs as vf
-import func_args as fa
-import bmc_ssh_utils as bsu
 import json
 import random
+import re
 import string
+
+import bmc_ssh_utils as bsu
+import func_args as fa
+import var_funcs as vf
 from robot.api import logger
 
 
 def pldmtool(option_string, **bsu_options):
-
     r"""
     Run pldmtool on the BMC with the caller's option string and return the result.
 
@@ -41,7 +41,9 @@
     # This allows callers to specify arguments in python style (e.g. print_out=1 vs. print_out=${1}).
     bsu_options = fa.args_to_objects(bsu_options)
 
-    stdout, stderr, rc = bsu.bmc_execute_command('pldmtool ' + option_string, **bsu_options)
+    stdout, stderr, rc = bsu.bmc_execute_command(
+        "pldmtool " + option_string, **bsu_options
+    )
     if stderr:
         return stderr
     try:
@@ -51,7 +53,6 @@
 
 
 def GetBIOSEnumAttributeOptionalValues(attr_val_table_data):
-
     """
     From pldmtool GetBIOSTable of type AttributeValueTable get the dict of
     attribute handle and its optional values for BIOS Enumeration type.
@@ -77,27 +78,30 @@
     attr_val_data_dict = {}
     for item in attr_val_table_data:
         for attr in item:
-            if (attr == "NumberOfPossibleValues"):
+            if attr == "NumberOfPossibleValues":
                 value_list = []
                 for i in range(0, int(item[attr])):
-                    attr_values = item["PossibleValueStringHandle[" + str(i) + "]"]
-                    value = re.search(r'\((.*?)\)', attr_values).group(1)
+                    attr_values = item[
+                        "PossibleValueStringHandle[" + str(i) + "]"
+                    ]
+                    value = re.search(r"\((.*?)\)", attr_values).group(1)
                     if value:
                         # Example:
                         # value = '"Power Off"'
-                        if ' ' in value:
+                        if " " in value:
                             value = '"' + value + '"'
                         value_list.append(value)
                     else:
-                        value_list.append('')
+                        value_list.append("")
 
-                attr_handle = re.findall(r'\(.*?\)', item["AttributeNameHandle"])
+                attr_handle = re.findall(
+                    r"\(.*?\)", item["AttributeNameHandle"]
+                )
                 attr_val_data_dict[attr_handle[0][1:-1]] = value_list
     return attr_val_data_dict
 
 
 def GetBIOSStrAndIntAttributeHandles(attr_type, attr_val_table_data):
-
     """
     From pldmtool GetBIOSTable of type AttributeValueTable get the dict of
     attribute handle and its values based on the attribute type.
@@ -113,28 +117,27 @@
     attr_val_str_dict = {}
     for item in attr_val_table_data:
         value_dict = {}
-        attr_handle = re.findall(r'\(.*?\)', item["AttributeNameHandle"])
+        attr_handle = re.findall(r"\(.*?\)", item["AttributeNameHandle"])
         # Example:
         # {'vmi_if0_ipv4_prefix_length': {'UpperBound': 32, 'LowerBound': 0}
-        if (item["AttributeType"] == "BIOSInteger"):
+        if item["AttributeType"] == "BIOSInteger":
             value_dict["LowerBound"] = item["LowerBound"]
             value_dict["UpperBound"] = item["UpperBound"]
             attr_val_int_dict[attr_handle[0][1:-1]] = value_dict
         # Example:
         # {'vmi_if1_ipv4_ipaddr': {'MaximumStringLength': 15, 'MinimumStringLength': 7}}
-        elif (item["AttributeType"] == "BIOSString"):
+        elif item["AttributeType"] == "BIOSString":
             value_dict["MinimumStringLength"] = item["MinimumStringLength"]
             value_dict["MaximumStringLength"] = item["MaximumStringLength"]
             attr_val_str_dict[attr_handle[0][1:-1]] = value_dict
 
-    if (attr_type == "BIOSInteger"):
+    if attr_type == "BIOSInteger":
         return attr_val_int_dict
-    elif (attr_type == "BIOSString"):
+    elif attr_type == "BIOSString":
         return attr_val_str_dict
 
 
 def GetRandomBIOSIntAndStrValues(attr_name, count):
-
     """
     Get random integer or string values for BIOS attribute values based on the count.
 
@@ -146,27 +149,35 @@
                             or string.
 
     """
-    attr_random_value = ''
+    attr_random_value = ""
 
     # Example
     # 12.13.14.15
-    if 'gateway' in attr_name:
-        attr_random_value = ".".join(map(str, (random.randint(0, 255) for _ in range(4))))
+    if "gateway" in attr_name:
+        attr_random_value = ".".join(
+            map(str, (random.randint(0, 255) for _ in range(4)))
+        )
     # Example
     # 11.11.11.11
-    elif 'ipaddr' in attr_name:
-        attr_random_value = ".".join(map(str, (random.randint(0, 255) for _ in range(4))))
+    elif "ipaddr" in attr_name:
+        attr_random_value = ".".join(
+            map(str, (random.randint(0, 255) for _ in range(4)))
+        )
     # Example
     # E5YWEDWJJ
-    elif 'name' in attr_name:
+    elif "name" in attr_name:
         data = string.ascii_uppercase + string.digits
-        attr_random_value = ''.join(random.choice(data) for _ in range(int(count)))
+        attr_random_value = "".join(
+            random.choice(data) for _ in range(int(count))
+        )
 
-    elif 'mfg_flags' in attr_name:
+    elif "mfg_flags" in attr_name:
         data = string.ascii_uppercase + string.digits
-        attr_random_value = ''.join(random.choice(data) for _ in range(int(count)))
+        attr_random_value = "".join(
+            random.choice(data) for _ in range(int(count))
+        )
 
-    elif 'hb_lid_ids' in attr_name:
+    elif "hb_lid_ids" in attr_name:
         attr_random_value = str(random.randint(0, int(count)))
 
     else:
@@ -175,7 +186,6 @@
 
 
 def GetBIOSAttrOriginalValues(attr_val_table_data):
-
     """
     From pldmtool GetBIOSTable of type AttributeValueTable get the dict of
     attribute handle and its values.
@@ -188,23 +198,22 @@
     """
     attr_val_data_dict = {}
     for item in attr_val_table_data:
-        attr_handle = re.findall(r'\(.*?\)', item["AttributeNameHandle"])
+        attr_handle = re.findall(r"\(.*?\)", item["AttributeNameHandle"])
         attr_name = attr_handle[0][1:-1]
 
         command = "bios GetBIOSAttributeCurrentValueByHandle -a " + attr_name
         value = pldmtool(command)
         attr_val_data_dict[attr_name] = value["CurrentValue"]
         if not value["CurrentValue"]:
-            if 'name' in attr_name:
+            if "name" in attr_name:
                 attr_val_data_dict[attr_name] = '""'
-            elif 'hb_lid_ids' in attr_name:
+            elif "hb_lid_ids" in attr_name:
                 attr_val_data_dict[attr_name] = '""'
 
     return attr_val_data_dict
 
 
 def GetBIOSAttrDefaultValues(attr_val_table_data):
-
     """
     From pldmtool GetBIOSTable of type AttributeValueTable get the dict of
     attribute handle and its default attribute values.
@@ -217,27 +226,26 @@
     """
     attr_val_data_dict = {}
     for item in attr_val_table_data:
-        attr_handle = re.findall(r'\(.*?\)', item["AttributeNameHandle"])
+        attr_handle = re.findall(r"\(.*?\)", item["AttributeNameHandle"])
         attr_name = attr_handle[0][1:-1]
 
         if "DefaultString" in item:
             attr_val_data_dict[attr_name] = item["DefaultString"]
             if not item["DefaultString"]:
-                if 'name' in attr_name:
+                if "name" in attr_name:
                     attr_val_data_dict[attr_name] = '""'
-                elif 'hb_lid_ids' in attr_name:
+                elif "hb_lid_ids" in attr_name:
                     attr_val_data_dict[attr_name] = '""'
         elif "DefaultValue" in item:
             attr_val_data_dict[attr_name] = item["DefaultValue"]
         elif "StringHandle" in item:
-            attr_default_value = re.findall(r'\(.*?\)', item["StringHandle"])
+            attr_default_value = re.findall(r"\(.*?\)", item["StringHandle"])
             attr_val_data_dict[attr_name] = attr_default_value[0][1:-1]
 
     return attr_val_data_dict
 
 
 def GetNewValuesForAllBIOSAttrs(attr_table_data):
-
     """
     Get a new set of values for all attributes in Attribute Table.
 
@@ -249,9 +257,13 @@
     """
     existing_data = GetBIOSAttrOriginalValues(attr_table_data)
     logger.info(existing_data)
-    string_attr_data = GetBIOSStrAndIntAttributeHandles("BIOSString", attr_table_data)
+    string_attr_data = GetBIOSStrAndIntAttributeHandles(
+        "BIOSString", attr_table_data
+    )
     logger.info(string_attr_data)
-    int_attr_data = GetBIOSStrAndIntAttributeHandles("BIOSInteger", attr_table_data)
+    int_attr_data = GetBIOSStrAndIntAttributeHandles(
+        "BIOSInteger", attr_table_data
+    )
     logger.info(int_attr_data)
     enum_attr_data = GetBIOSEnumAttributeOptionalValues(attr_table_data)
     logger.info(enum_attr_data)
@@ -268,8 +280,12 @@
                 data = '"' + str(existing_data[attr]) + '"'
                 temp_list[attr].remove(data)
             except ValueError:
-                logger.info("Unable to remove the existing value "
-                            + str(data) + " from list " + str(temp_list[attr]))
+                logger.info(
+                    "Unable to remove the existing value "
+                    + str(data)
+                    + " from list "
+                    + str(temp_list[attr])
+                )
         valid_values = temp_list[attr][:]
         value = random.choice(valid_values)
         attr_random_data[attr] = value.strip('"')
@@ -279,7 +295,9 @@
         # Iterating to make sure we have a different value
         # other than the existing value.
         for iter in range(5):
-            random_val = GetRandomBIOSIntAndStrValues(attr, string_attr_data[attr]["MaximumStringLength"])
+            random_val = GetRandomBIOSIntAndStrValues(
+                attr, string_attr_data[attr]["MaximumStringLength"]
+            )
             if random_val != existing_data[attr]:
                 break
         attr_random_data[attr] = random_val.strip('"')
@@ -287,7 +305,9 @@
 
     for attr in int_attr_data:
         for iter in range(5):
-            random_val = GetRandomBIOSIntAndStrValues(attr, int_attr_data[attr]["UpperBound"])
+            random_val = GetRandomBIOSIntAndStrValues(
+                attr, int_attr_data[attr]["UpperBound"]
+            )
             if random_val != existing_data[attr]:
                 break
         attr_random_data[attr] = random_val