diff --git a/pyflashbmc/bmc_update.py b/pyflashbmc/bmc_update.py
index 98c3ca6..c2046e4 100644
--- a/pyflashbmc/bmc_update.py
+++ b/pyflashbmc/bmc_update.py
@@ -15,14 +15,14 @@
 import os
 from obmc.dbuslib.bindings import get_dbus, DbusProperties, DbusObjectManager
 
-DBUS_NAME = 'org.openbmc.control.BmcFlash'
-OBJ_NAME = '/org/openbmc/control/flash/bmc'
-DOWNLOAD_INTF = 'org.openbmc.managers.Download'
+DBUS_NAME = "org.openbmc.control.BmcFlash"
+OBJ_NAME = "/org/openbmc/control/flash/bmc"
+DOWNLOAD_INTF = "org.openbmc.managers.Download"
 
-BMC_DBUS_NAME = 'xyz.openbmc_project.State.BMC'
-BMC_OBJ_NAME = '/xyz/openbmc_project/state/bmc0'
+BMC_DBUS_NAME = "xyz.openbmc_project.State.BMC"
+BMC_OBJ_NAME = "/xyz/openbmc_project/state/bmc0"
 
-UPDATE_PATH = '/run/initramfs'
+UPDATE_PATH = "/run/initramfs"
 
 
 def doExtract(members, files):
@@ -35,29 +35,27 @@
     fw_env = "/etc/fw_env.config"
     lines = 0
     files = []
-    envcfg = open(fw_env, 'r')
+    envcfg = open(fw_env, "r")
     try:
         for line in envcfg.readlines():
             # ignore lines that are blank or start with #
-            if (line.startswith("#")):
+            if line.startswith("#"):
                 continue
-            if (not len(line.strip())):
+            if not len(line.strip()):
                 continue
             fn = line.partition("\t")[0]
             files.append(fn)
             lines += 1
     finally:
         envcfg.close()
-    if (lines < 1 or lines > 2 or (lines == 2 and files[0] != files[1])):
-            raise Exception("Error parsing %s\n" % fw_env)
+    if lines < 1 or lines > 2 or (lines == 2 and files[0] != files[1]):
+        raise Exception("Error parsing %s\n" % fw_env)
     shutil.copyfile(files[0], os.path.join(UPDATE_PATH, "image-u-boot-env"))
 
 
 class BmcFlashControl(DbusProperties, DbusObjectManager):
     def __init__(self, bus, name):
-        super(BmcFlashControl, self).__init__(
-            conn=bus,
-            object_path=name)
+        super(BmcFlashControl, self).__init__(conn=bus, object_path=name)
 
         self.Set(DBUS_NAME, "status", "Idle")
         self.Set(DBUS_NAME, "filename", "")
@@ -68,38 +66,38 @@
         self.Set(DBUS_NAME, "auto_apply", False)
 
         bus.add_signal_receiver(
-            self.download_error_handler, signal_name="DownloadError")
+            self.download_error_handler, signal_name="DownloadError"
+        )
         bus.add_signal_receiver(
-            self.download_complete_handler, signal_name="DownloadComplete")
+            self.download_complete_handler, signal_name="DownloadComplete"
+        )
 
         self.update_process = None
         self.progress_name = None
 
-    @dbus.service.method(
-        DBUS_NAME, in_signature='ss', out_signature='')
+    @dbus.service.method(DBUS_NAME, in_signature="ss", out_signature="")
     def updateViaTftp(self, ip, filename):
         self.Set(DBUS_NAME, "status", "Downloading")
         self.TftpDownload(ip, filename)
 
-    @dbus.service.method(
-        DBUS_NAME, in_signature='s', out_signature='')
+    @dbus.service.method(DBUS_NAME, in_signature="s", out_signature="")
     def update(self, filename):
         self.Set(DBUS_NAME, "filename", filename)
         self.download_complete_handler(filename, filename)
 
-    @dbus.service.signal(DOWNLOAD_INTF, signature='ss')
+    @dbus.service.signal(DOWNLOAD_INTF, signature="ss")
     def TftpDownload(self, ip, filename):
         self.Set(DBUS_NAME, "filename", filename)
         pass
 
     # Signal handler
     def download_error_handler(self, filename):
-        if (filename == self.Get(DBUS_NAME, "filename")):
+        if filename == self.Get(DBUS_NAME, "filename"):
             self.Set(DBUS_NAME, "status", "Download Error")
 
     def download_complete_handler(self, outfile, filename):
         # do update
-        if (filename != self.Get(DBUS_NAME, "filename")):
+        if filename != self.Get(DBUS_NAME, "filename"):
             return
 
         print("Download complete. Updating...")
@@ -127,7 +125,8 @@
             for f in list(copy_files.keys()):
                 if f not in files:
                     raise Exception(
-                        "ERROR: File not found in update archive: "+f)
+                        "ERROR: File not found in update archive: " + f
+                    )
 
         except Exception as e:
             print(str(e))
@@ -142,11 +141,11 @@
             if self.Get(DBUS_NAME, "clear_persistent_files"):
                 print("Removing persistent files")
                 try:
-                    os.unlink(UPDATE_PATH+"/whitelist")
+                    os.unlink(UPDATE_PATH + "/whitelist")
                 except OSError as e:
-                    if (e.errno == errno.EISDIR):
+                    if e.errno == errno.EISDIR:
                         pass
-                    elif (e.errno == errno.ENOENT):
+                    elif e.errno == errno.ENOENT:
                         pass
                     else:
                         raise
@@ -157,7 +156,7 @@
                     for file in os.listdir(wldir):
                         os.unlink(os.path.join(wldir, file))
                 except OSError as e:
-                    if (e.errno == errno.EISDIR):
+                    if e.errno == errno.EISDIR:
                         pass
                     else:
                         raise
@@ -175,37 +174,46 @@
     def Verify(self):
         self.Set(DBUS_NAME, "status", "Checking Image")
         try:
-            subprocess.check_call([
-                "/run/initramfs/update",
-                "--no-flash",
-                "--no-save-files",
-                "--no-restore-files",
-                "--no-clean-saved-files"])
+            subprocess.check_call(
+                [
+                    "/run/initramfs/update",
+                    "--no-flash",
+                    "--no-save-files",
+                    "--no-restore-files",
+                    "--no-clean-saved-files",
+                ]
+            )
 
             self.Set(DBUS_NAME, "status", "Image ready to apply.")
-            if (self.Get(DBUS_NAME, "auto_apply")):
+            if self.Get(DBUS_NAME, "auto_apply"):
                 self.Apply()
         except Exception:
             self.Set(DBUS_NAME, "auto_apply", False)
             try:
-                subprocess.check_output([
-                    "/run/initramfs/update",
-                    "--no-flash",
-                    "--ignore-mount",
-                    "--no-save-files",
-                    "--no-restore-files",
-                    "--no-clean-saved-files"],
-                    stderr=subprocess.STDOUT)
+                subprocess.check_output(
+                    [
+                        "/run/initramfs/update",
+                        "--no-flash",
+                        "--ignore-mount",
+                        "--no-save-files",
+                        "--no-restore-files",
+                        "--no-clean-saved-files",
+                    ],
+                    stderr=subprocess.STDOUT,
+                )
                 self.Set(
-                    DBUS_NAME, "status",
-                    "Deferred for mounted filesystem. reboot BMC to apply.")
+                    DBUS_NAME,
+                    "status",
+                    "Deferred for mounted filesystem. reboot BMC to apply.",
+                )
             except subprocess.CalledProcessError as e:
-                self.Set(
-                    DBUS_NAME, "status", "Verify error: %s" % e.output)
+                self.Set(DBUS_NAME, "status", "Verify error: %s" % e.output)
             except OSError as e:
                 self.Set(
-                    DBUS_NAME, "status",
-                    "Verify error: problem calling update: %s" % e.strerror)
+                    DBUS_NAME,
+                    "status",
+                    "Verify error: problem calling update: %s" % e.strerror,
+                )
 
     def Cleanup(self):
         if self.progress_name:
@@ -219,8 +227,7 @@
         self.update_process = None
         self.Set(DBUS_NAME, "status", "Idle")
 
-    @dbus.service.method(
-        DBUS_NAME, in_signature='', out_signature='')
+    @dbus.service.method(DBUS_NAME, in_signature="", out_signature="")
     def Abort(self):
         if self.update_process:
             try:
@@ -228,29 +235,28 @@
             except Exception:
                 pass
         for file in os.listdir(UPDATE_PATH):
-            if file.startswith('image-'):
+            if file.startswith("image-"):
                 os.unlink(os.path.join(UPDATE_PATH, file))
 
         self.Cleanup()
 
-    @dbus.service.method(
-        DBUS_NAME, in_signature='', out_signature='s')
+    @dbus.service.method(DBUS_NAME, in_signature="", out_signature="s")
     def GetUpdateProgress(self):
         msg = ""
 
         if self.update_process and self.update_process.returncode is None:
             self.update_process.poll()
 
-        if (self.update_process is None):
+        if self.update_process is None:
             pass
-        elif (self.update_process.returncode > 0):
+        elif self.update_process.returncode > 0:
             self.Set(DBUS_NAME, "status", "Apply failed")
-        elif (self.update_process.returncode is None):
+        elif self.update_process.returncode is None:
             pass
-        else:            # (self.update_process.returncode == 0)
+        else:  # (self.update_process.returncode == 0)
             files = ""
             for file in os.listdir(UPDATE_PATH):
-                if file.startswith('image-'):
+                if file.startswith("image-"):
                     files = files + file
             if files == "":
                 msg = "Apply Complete.  Reboot to take effect."
@@ -261,32 +267,33 @@
         msg = self.Get(DBUS_NAME, "status") + "\n"
         if self.progress_name:
             try:
-                prog = open(self.progress_name, 'r')
+                prog = open(self.progress_name, "r")
                 for line in prog:
                     # strip off initial sets of xxx\r here
                     # ignore crlf at the end
                     # cr will be -1 if no '\r' is found
                     cr = line.rfind("\r", 0, -2)
-                    msg = msg + line[cr + 1:]
+                    msg = msg + line[(cr + 1):]
             except OSError as e:
-                if (e.error == EEXIST):
+                if e.error == EEXIST:
                     pass
                 raise
         return msg
 
-    @dbus.service.method(
-        DBUS_NAME, in_signature='', out_signature='')
+    @dbus.service.method(DBUS_NAME, in_signature="", out_signature="")
     def Apply(self):
         progress = None
         self.Set(DBUS_NAME, "status", "Writing images to flash")
         try:
             progress = tempfile.NamedTemporaryFile(
-                delete=False, prefix="progress.")
+                delete=False, prefix="progress."
+            )
             self.progress_name = progress.name
-            self.update_process = subprocess.Popen([
-                "/run/initramfs/update"],
+            self.update_process = subprocess.Popen(
+                ["/run/initramfs/update"],
                 stdout=progress.file,
-                stderr=subprocess.STDOUT)
+                stderr=subprocess.STDOUT,
+            )
         except Exception as e:
             try:
                 progress.close()
@@ -301,29 +308,36 @@
         except Exception:
             pass
 
-    @dbus.service.method(
-        DBUS_NAME, in_signature='', out_signature='')
+    @dbus.service.method(DBUS_NAME, in_signature="", out_signature="")
     def PrepareForUpdate(self):
-        subprocess.call([
-            "fw_setenv",
-            "openbmconce",
-            "copy-files-to-ram copy-base-filesystem-to-ram"])
+        subprocess.call(
+            [
+                "fw_setenv",
+                "openbmconce",
+                "copy-files-to-ram copy-base-filesystem-to-ram",
+            ]
+        )
         # Set the variable twice so that it is written to both environments of
         # the u-boot redundant environment variables since initramfs can only
         # read one of the environments.
-        subprocess.call([
-            "fw_setenv",
-            "openbmconce",
-            "copy-files-to-ram copy-base-filesystem-to-ram"])
+        subprocess.call(
+            [
+                "fw_setenv",
+                "openbmconce",
+                "copy-files-to-ram copy-base-filesystem-to-ram",
+            ]
+        )
         self.Set(DBUS_NAME, "status", "Switch to update mode in progress")
         o = bus.get_object(BMC_DBUS_NAME, BMC_OBJ_NAME)
         intf = dbus.Interface(o, "org.freedesktop.DBus.Properties")
-        intf.Set(BMC_DBUS_NAME,
-                 "RequestedBMCTransition",
-                 "xyz.openbmc_project.State.BMC.Transition.Reboot")
+        intf.Set(
+            BMC_DBUS_NAME,
+            "RequestedBMCTransition",
+            "xyz.openbmc_project.State.BMC.Transition.Reboot",
+        )
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
     bus = get_dbus()
diff --git a/pyflashbmc/setup.py b/pyflashbmc/setup.py
index ed86cbb..9aeaf71 100644
--- a/pyflashbmc/setup.py
+++ b/pyflashbmc/setup.py
@@ -1,6 +1,7 @@
 from distutils.core import setup
 
-setup(name='pyflashbmc',
-      version='1.0',
-      scripts=['bmc_update.py'],
-      )
+setup(
+    name="pyflashbmc",
+    version="1.0",
+    scripts=["bmc_update.py"],
+)
