From a51b66b72894a00ea31321bc5330719d5fbef103 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 20 Aug 2024 00:08:40 +0200
Subject: [PATCH] Postpone overhead-y import until after validating/parsing
 parameters.

---
 stable.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/stable.py b/stable.py
index cdd6667..634add3 100755
--- a/stable.py
+++ b/stable.py
@@ -3,7 +3,6 @@ from sys import argv, exit as sys_exit
 from os.path import dirname, basename, splitext, join as path_join, exists
 from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
 from random import randint
-from stable.core import ImageMaker
 
 
 DEFAULT_SCHEDULER = 'EulerAncestralDiscreteScheduler'
@@ -15,7 +14,8 @@ def save_path(count: int) -> str:
 
 
 def parse_args():
-    parser = ArgumentParser(add_help=False, formatter_class=ArgumentDefaultsHelpFormatter)
+    parser = ArgumentParser(add_help=False,
+                            formatter_class=ArgumentDefaultsHelpFormatter)
     parser.add_argument('-m', '--model',
                         help='model filename (-P will pre prefixed, but may '
                         'also be full path on its own)')
@@ -88,6 +88,8 @@ def parse_args():
 
 
 args = parse_args()
+# pylint: disable=wrong-import-position
+from stable.core import ImageMaker  # noqa: E402
 model_path = f'{args.model_path_prefix}{args.model}'
 if args.list_schedulers:
     maker = ImageMaker(model_path)
-- 
2.30.2