python: fix pycodestyle issues

Create a file 'setup.cfg' so that openbmc-build-scripts will
automatically run 'pycodestyle' on the code base.

Fix up any issues already reported by pycodestyle.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I5d98df0b844e5cbdbdb4dc580cb4c406538f3b4f
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..d9fc148
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1 @@
+# Empty config to trigger pycodestyle.
diff --git a/tools/sdbusplus/enum.py b/tools/sdbusplus/enum.py
index a5feda7..55f8dc2 100644
--- a/tools/sdbusplus/enum.py
+++ b/tools/sdbusplus/enum.py
@@ -3,9 +3,10 @@
 
 """ Class for parsing 'enum' definition elements from an interface.
 """
+
+
 class Enum(NamedElement):
     def __init__(self, **kwargs):
-        self.values = \
-            [Property(**v) for v in kwargs.pop('values', [])]
+        self.values = [Property(**v) for v in kwargs.pop("values", [])]
 
         super(Enum, self).__init__(**kwargs)
diff --git a/tools/sdbusplus/interface.py b/tools/sdbusplus/interface.py
index ddc5085..274359f 100644
--- a/tools/sdbusplus/interface.py
+++ b/tools/sdbusplus/interface.py
@@ -10,32 +10,28 @@
 
 class Interface(NamedElement, Renderer):
     @staticmethod
-    def load(name, rootdir='.'):
+    def load(name, rootdir="."):
         filename = os.path.join(rootdir,
-                                name.replace('.', '/') + ".interface.yaml")
+                                name.replace(".", "/") + ".interface.yaml")
 
         with open(filename) as f:
             data = f.read()
             y = yaml.safe_load(data)
-            y['name'] = name
+            y["name"] = name
             return Interface(**y)
 
     def __init__(self, **kwargs):
-        self.properties = \
-            [Property(**p) for p in kwargs.pop('properties', [])]
-        self.methods = \
-            [Method(**m) for m in kwargs.pop('methods', [])]
-        self.signals = \
-            [Signal(**s) for s in kwargs.pop('signals', [])]
-        self.enums = \
-            [Enum(**e) for e in kwargs.pop('enumerations', [])]
+        self.properties = [Property(**p) for p in kwargs.pop("properties", [])]
+        self.methods = [Method(**m) for m in kwargs.pop("methods", [])]
+        self.signals = [Signal(**s) for s in kwargs.pop("signals", [])]
+        self.enums = [Enum(**e) for e in kwargs.pop("enumerations", [])]
 
         super(Interface, self).__init__(**kwargs)
 
-    def enum_includes(self, l):
+    def enum_includes(self, inc_list):
         includes = []
-        for e in l:
-            es = e.enum_namespace(self.name).split('::')
+        for e in inc_list:
+            es = e.enum_namespace(self.name).split("::")
             # Skip empty, non-enum values and self references like '::'
             if len(es) < 2:
                 continue
@@ -45,11 +41,11 @@
             # xyz::openbmc_project::Network::server::IP:: and we need to
             # convert to xyz/openbmc_project/Network/IP/server.hpp
             es.pop()  # Remove trailing empty element
-            e_class = es.pop() # Remove class name
+            e_class = es.pop()  # Remove class name
             e_type = es.pop()  # Remove injected type namespace
             es.append(e_class)
             es.append(e_type)
-            includes.append('/'.join(es) + '.hpp')
+            includes.append("/".join(es) + ".hpp")
         return includes
 
     def markdown(self, loader):
diff --git a/tools/sdbusplus/main.py b/tools/sdbusplus/main.py
index 54812a5..b7c56d0 100644
--- a/tools/sdbusplus/main.py
+++ b/tools/sdbusplus/main.py
@@ -4,32 +4,58 @@
 import sys
 import os
 
+
 def main():
     module_path = os.path.dirname(sdbusplus.__file__)
 
-    valid_types = {'interface': sdbusplus.Interface,
-                   'error': sdbusplus.Error}
-    valid_processes = {'markdown': "markdown",
-                       'server-header': "server_header",
-                       'server-cpp': "server_cpp",
-                       'exception-header': "exception_header",
-                       'exception-cpp': "exception_cpp",
-                       'client-header': "client_header"}
+    valid_types = {"interface": sdbusplus.Interface, "error": sdbusplus.Error}
+    valid_processes = {
+        "markdown": "markdown",
+        "server-header": "server_header",
+        "server-cpp": "server_cpp",
+        "exception-header": "exception_header",
+        "exception-cpp": "exception_cpp",
+        "client-header": "client_header",
+    }
 
-    parser = argparse.ArgumentParser(description='Process sdbus++ YAML files.')
+    parser = argparse.ArgumentParser(description="Process sdbus++ YAML files.")
 
-    parser.add_argument('-r', '--rootdir', dest='rootdir', default='.',
-                        type=str, help='Location of files to process.')
-    parser.add_argument('-t', '--templatedir', dest='templatedir',
-                        default=os.path.join(module_path, 'templates'),
-                        type=str, help='Location of templates files.')
-    parser.add_argument('typeName', metavar='TYPE', type=str,
-                        choices=valid_types.keys(), help='Type to operate on.')
-    parser.add_argument('process', metavar='PROCESS', type=str,
-                        choices=valid_processes.keys(),
-                        help='Process to apply.')
-    parser.add_argument('item', metavar='ITEM', type=str,
-                        help='Item to process.')
+    parser.add_argument(
+        "-r",
+        "--rootdir",
+        dest="rootdir",
+        default=".",
+        type=str,
+        help="Location of files to process.",
+    )
+    parser.add_argument(
+        "-t",
+        "--templatedir",
+        dest="templatedir",
+        default=os.path.join(module_path, "templates"),
+        type=str,
+        help="Location of templates files.",
+    )
+    parser.add_argument(
+        "typeName",
+        metavar="TYPE",
+        type=str,
+        choices=valid_types.keys(),
+        help="Type to operate on.",
+    )
+    parser.add_argument(
+        "process",
+        metavar="PROCESS",
+        type=str,
+        choices=valid_processes.keys(),
+        help="Process to apply.",
+    )
+    parser.add_argument(
+        "item",
+        metavar="ITEM",
+        type=str,
+        help="Item to process.",
+    )
 
     args = parser.parse_args()
 
diff --git a/tools/sdbusplus/namedelement.py b/tools/sdbusplus/namedelement.py
index 1548ef0..4c2ee2a 100644
--- a/tools/sdbusplus/namedelement.py
+++ b/tools/sdbusplus/namedelement.py
@@ -8,16 +8,16 @@
         self.description = kwargs.pop('description', "")
 
     def __getattribute__(self, name):
-        l = {'CamelCase': lambda: inflection.camelize(self.name),
-             'camelCase': lambda: inflection.camelize(self.name, False),
-             'snake_case': lambda: inflection.underscore(self.name)}\
+        lam = {'CamelCase': lambda: inflection.camelize(self.name),
+               'camelCase': lambda: inflection.camelize(self.name, False),
+               'snake_case': lambda: inflection.underscore(self.name)}\
             .get(name)
 
-        if l:
-            return NamedElement.__fixup_name(l())
+        if lam:
+            return NamedElement.__fixup_name(lam())
         try:
             return super(NamedElement, self).__getattribute__(name)
-        except:
+        except e:
             raise AttributeError("Attribute '%s' not found in %s.NamedElement"
                                  % (name, self.__module__))
 
diff --git a/tools/sdbusplus/property.py b/tools/sdbusplus/property.py
index e412b60..e62dc90 100644
--- a/tools/sdbusplus/property.py
+++ b/tools/sdbusplus/property.py
@@ -59,9 +59,9 @@
     def enum_namespace(self, interface):
         if not self.is_enum():
             return ""
-        l = self.cppTypeParam(interface).split("::")[0:-1]
-        if len(l) != 0:
-            return "::".join(l) + "::"
+        ns = self.cppTypeParam(interface).split("::")[0:-1]
+        if len(ns) != 0:
+            return "::".join(ns) + "::"
         return ""
 
     def enum_name(self, interface):
@@ -189,8 +189,9 @@
                            post=str.strip)
 
     def cpp_prototype(self, loader, interface, ptype):
-        return self.render(loader, "property.prototype.hpp.mako", property=self,
-                           interface=interface, ptype=ptype, post=str.rstrip)
+        return self.render(loader, "property.prototype.hpp.mako",
+                           property=self, interface=interface, ptype=ptype,
+                           post=str.rstrip)
 
     def or_cpp_flags(self, flags):
         """Return the corresponding ORed cpp flags."""