From b39a0d519871844f74be12cbeff31e4a6edb6e41 Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Mon, 29 Oct 2018 18:33:38 +1100
Subject: [PATCH] Cleanup: style

---
 system_demo_mode/__init__.py  | 26 ++++++++++++++++-------
 system_demo_mode/config.py    |  2 +-
 system_demo_mode/demo_mode.py | 40 +++++++++++++++++++----------------
 3 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/system_demo_mode/__init__.py b/system_demo_mode/__init__.py
index 75eb38ba0..b07da919a 100644
--- a/system_demo_mode/__init__.py
+++ b/system_demo_mode/__init__.py
@@ -28,7 +28,8 @@ bl_info = {
     "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
                 "Scripts/System/Demo_Mode#Running_Demo_Mode",
     "support": 'OFFICIAL',
-    "category": "System"}
+    "category": "System",
+}
 
 # To support reload properly, try to access a package var, if it's there, reload everything
 if "bpy" in locals():
@@ -70,9 +71,11 @@ class DemoModeSetup(bpy.types.Operator):
     )
     mode: EnumProperty(
         name="Method",
-        items=(('AUTO', "Auto", ""),
-               ('PLAY', "Play", ""),
-               ('RENDER', "Render", ""))
+        items=(
+            ('AUTO', "Auto", ""),
+            ('PLAY', "Play", ""),
+            ('RENDER', "Render", ""),
+        )
     )
 
     run: BoolProperty(
@@ -243,9 +246,15 @@ def menu_func(self, context):
     layout.separator()
 
 
+classes = (
+    DemoModeSetup,
+    DemoModeRun,
+)
+
 def register():
-    bpy.utils.register_class(DemoModeSetup)
-    bpy.utils.register_class(DemoModeRun)
+    from bpy.utils import register_class
+    for cls in classes:
+        register_class(cls)
 
     bpy.types.TOPBAR_MT_file.prepend(menu_func)
 
@@ -253,8 +262,9 @@ def register():
 
 
 def unregister():
-    bpy.utils.unregister_class(DemoModeSetup)
-    bpy.utils.unregister_class(DemoModeRun)
+    from bpy.utils import unregister_class
+    for cls in classes:
+        unregister_class(cls)
 
     bpy.types.TOPBAR_MT_file.remove(menu_func)
 
diff --git a/system_demo_mode/config.py b/system_demo_mode/config.py
index 24e25be5f..b3a7aad42 100644
--- a/system_demo_mode/config.py
+++ b/system_demo_mode/config.py
@@ -65,7 +65,7 @@ def as_string(dirpath, random_order, exit, **kwargs):
         "\n",
         "exit = %r\n" % exit,
         "\n",
-        ]
+    ]
 
     # All these work but use nicest formatting!
     if 0:  # works but not nice to edit.
diff --git a/system_demo_mode/demo_mode.py b/system_demo_mode/demo_mode.py
index 1a717a5e3..b365fdfcc 100644
--- a/system_demo_mode/demo_mode.py
+++ b/system_demo_mode/demo_mode.py
@@ -44,23 +44,26 @@ DEMO_CFG = "demo.py"
 # populate from script
 global_config_files = []
 
-global_config = dict(anim_cycles=1,
-                     anim_render=False,
-                     anim_screen_switch=0.0,
-                     anim_time_max=60.0,
-                     anim_time_min=4.0,
-                     mode='AUTO',
-                     display_render=4.0)
+global_config = dict(
+    anim_cycles=1,
+    anim_render=False,
+    anim_screen_switch=0.0,
+    anim_time_max=60.0,
+    anim_time_min=4.0,
+    mode='AUTO',
+    display_render=4.0,
+)
 
 # switch to the next file in 2 sec.
-global_config_fallback = dict(anim_cycles=1,
-                              anim_render=False,
-                              anim_screen_switch=0.0,
-                              anim_time_max=60.0,
-                              anim_time_min=4.0,
-                              mode='AUTO',
-                              display_render=4.0)
-
+global_config_fallback = dict(
+    anim_cycles=1,
+    anim_render=False,
+    anim_screen_switch=0.0,
+    anim_time_max=60.0,
+    anim_time_min=4.0,
+    mode='AUTO',
+    display_render=4.0,
+)
 
 global_state = {
     "init_time": 0.0,
@@ -253,9 +256,10 @@ def demo_mode_update():
             demo_mode_next_file()
             return
         # above cycles and minimum display time
-        if  (time_total > global_config["anim_time_min"]) and \
-            (global_state["anim_cycles"] > global_config["anim_cycles"]):
-
+        if (
+                (time_total > global_config["anim_time_min"]) and
+                (global_state["anim_cycles"] > global_config["anim_cycles"])
+        ):
             # looped enough now.
             demo_mode_next_file()
             return
-- 
GitLab