[SEBA-412] Automated reformat of Python code

Passes of modernize, autopep8, black, then check with flake8

flake8 + manual fixes:
  lib/xos-config
  lib/xos-kafka
  lib/xos-util
  xos/coreapi
  xos/api
  xos/xos_client

Change-Id: Ib23cf84cb13beb3c6381fa0d79594dc9131dc815
diff --git a/lib/xos-util/setup.py b/lib/xos-util/setup.py
index b60435d..a3707ef 100644
--- a/lib/xos-util/setup.py
+++ b/lib/xos-util/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python 
+#!/usr/bin/env python
 
 # Copyright 2017-present Open Networking Foundation
 #
@@ -15,18 +15,15 @@
 # limitations under the License.
 
 
-import os
-
-from setuptools import setup
-
 from xosutil.autoversion_setup import setup_with_auto_version
 from xosutil.version import __version__
 
-setup_with_auto_version(name='XosUtil',
-      version=__version__,
-      description='XOS Utility Library',
-      author='Scott Baker',
-      author_email='scottb@opennetworking.org',
-      packages=['xosutil'],
-      include_package_data=True
-     )
+setup_with_auto_version(
+    name="XosUtil",
+    version=__version__,
+    description="XOS Utility Library",
+    author="Scott Baker",
+    author_email="scottb@opennetworking.org",
+    packages=["xosutil"],
+    include_package_data=True,
+)
diff --git a/lib/xos-util/tests/test_util.py b/lib/xos-util/tests/test_util.py
index ff1ce58..2b5be07 100644
--- a/lib/xos-util/tests/test_util.py
+++ b/lib/xos-util/tests/test_util.py
@@ -1,4 +1,3 @@
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,6 +19,7 @@
 
 test_path = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
 
+
 class XOSUtilTest(unittest.TestCase):
     """
     Testing the XOS Util Module
@@ -40,9 +40,15 @@
         test_save_fn = os.path.join(test_path, "test_version.py")
         if os.path.exists(test_save_fn):
             os.remove(test_save_fn)
-        self.assertEqual(version, autodiscover_version.autodiscover_version_of_caller(save_to="test_version.py"))
+        self.assertEqual(
+            version,
+            autodiscover_version.autodiscover_version_of_caller(
+                save_to="test_version.py"
+            ),
+        )
         self.assertTrue(os.path.exists(test_save_fn))
         self.assertTrue(version in open(test_save_fn).read())
 
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/lib/xos-util/xosutil/__init__.py b/lib/xos-util/xosutil/__init__.py
index 42722a8..b0fb0b2 100644
--- a/lib/xos-util/xosutil/__init__.py
+++ b/lib/xos-util/xosutil/__init__.py
@@ -1,4 +1,3 @@
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/lib/xos-util/xosutil/autodiscover_version.py b/lib/xos-util/xosutil/autodiscover_version.py
index 2e606e1..8f4ea47 100644
--- a/lib/xos-util/xosutil/autodiscover_version.py
+++ b/lib/xos-util/xosutil/autodiscover_version.py
@@ -1,4 +1,3 @@
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,6 +23,7 @@
 import inspect
 import os
 
+
 def autodiscover_version(caller_filename=None, save_to=None, max_parent_depth=None):
     """ walk back along the path to the current module, searching for a VERSION file """
     if not caller_filename:
@@ -42,8 +42,8 @@
             return version
 
         # limit_parent_depth can be used to limit how far back we search the tree for a VERSION file.
-        if (max_parent_depth is not None):
-            if (max_parent_depth <= 0):
+        if max_parent_depth is not None:
+            if max_parent_depth <= 0:
                 return None
             max_parent_depth -= 1
 
@@ -51,13 +51,16 @@
         if not remainder:
             return None
 
+
 def autodiscover_version_of_caller(*args, **kwargs):
     frame = inspect.stack()[1]
     module = inspect.getmodule(frame[0])
     return autodiscover_version(module.__file__, *args, **kwargs)
 
+
 def autodiscover_version_of_main(*args, **kwargs):
     import __main__
+
     if hasattr(__main__, "__file__"):
         return autodiscover_version(__main__.__file__, *args, **kwargs)
     else:
diff --git a/lib/xos-util/xosutil/autoversion_setup.py b/lib/xos-util/xosutil/autoversion_setup.py
index 5a7ea44..e027d5c 100644
--- a/lib/xos-util/xosutil/autoversion_setup.py
+++ b/lib/xos-util/xosutil/autoversion_setup.py
@@ -1,4 +1,3 @@
-
 # Copyright 2017-present Open Networking Foundation
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,42 +32,47 @@
 import inspect
 from autodiscover_version import autodiscover_version
 
+
 class SdistCommand(sdist):
     def copy_file(self, infile, outfile, *args, **kwargs):
         if kwargs.get("dry_run"):
             return (outfile, 1)
-        if (os.path.split(outfile)[1] == "version.py"):
-            open(outfile, "w").write("# do not edit. Autogenerated file.\n" \
-                                     "__version__ = '%s'\n" % self.distribution.metadata.version)
+        if os.path.split(outfile)[1] == "version.py":
+            open(outfile, "w").write(
+                "# do not edit. Autogenerated file.\n"
+                "__version__ = '%s'\n" % self.distribution.metadata.version
+            )
             return (outfile, 1)
         else:
             return sdist.copy_file(self, infile, outfile, *args, **kwargs)
 
+
 class BuildPyCommand(build_py):
     def copy_file(self, infile, outfile, *args, **kwargs):
         if kwargs.get("dry_run"):
             return (outfile, 1)
-        if (os.path.split(outfile)[1] == "version.py"):
-            open(outfile, "w").write("# do not edit. Autogenerated file.\n" \
-                                     "__version__ = '%s'\n" % self.distribution.metadata.version)
+        if os.path.split(outfile)[1] == "version.py":
+            open(outfile, "w").write(
+                "# do not edit. Autogenerated file.\n"
+                "__version__ = '%s'\n" % self.distribution.metadata.version
+            )
             return (outfile, 1)
         else:
             return build_py.copy_file(self, infile, outfile, *args, **kwargs)
 
+
 def setup_with_auto_version(*args, **kwargs):
     # Learn the module that called this function, so we can search for any VERSION files in it.
     frame = inspect.stack()[1]
     caller_module = inspect.getmodule(frame[0])
 
     # Search for a VERSION file and extract the version number from it.
-    version = autodiscover_version(caller_filename = caller_module.__file__)
+    version = autodiscover_version(caller_filename=caller_module.__file__)
     if version:
         kwargs["version"] = version
 
     cmdclass = kwargs.get("cmdclass", {}).copy()
-    cmdclass.update( {"sdist": SdistCommand,
-                "build_py": BuildPyCommand} )
+    cmdclass.update({"sdist": SdistCommand, "build_py": BuildPyCommand})
     kwargs["cmdclass"] = cmdclass
 
     return setup(*args, **kwargs)
-
diff --git a/lib/xos-util/xosutil/version.py b/lib/xos-util/xosutil/version.py
index 57833b8..8456fc5 100644
--- a/lib/xos-util/xosutil/version.py
+++ b/lib/xos-util/xosutil/version.py
@@ -13,4 +13,4 @@
 # limitations under the License.
 
 # This file is autogenerated. Do not edit.
-__version__ = 'unknown'
+__version__ = "unknown"