From 9d41c9521bcac2aa5d59e423ad576da3922ede07 Mon Sep 17 00:00:00 2001 From: Manuel Schmid <9307310+mashb1t@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:44:16 +0200 Subject: [PATCH] fix: add workaround for same value in Steps IntEnum (#3153) --- modules/flags.py | 4 ++++ modules/meta_parser.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/flags.py b/modules/flags.py index adaea1d19..8b35daea3 100644 --- a/modules/flags.py +++ b/modules/flags.py @@ -131,6 +131,10 @@ class Steps(IntEnum): LIGHTNING = 4 HYPER_SD = 4 + @classmethod + def keys(cls) -> list: + return list(map(lambda c: c, Steps.__members__)) + class StepsUOV(IntEnum): QUALITY = 36 diff --git a/modules/meta_parser.py b/modules/meta_parser.py index 02dfc1809..ff930cc0b 100644 --- a/modules/meta_parser.py +++ b/modules/meta_parser.py @@ -119,8 +119,9 @@ def get_steps(key: str, fallback: str | None, source_dict: dict, results: list, assert h is not None h = int(h) # if not in steps or in steps and performance is not the same - if h not in iter(Steps) or Steps(h).name.casefold() != source_dict.get('performance', '').replace(' ', - '_').casefold(): + performance_name = source_dict.get('performance', '').replace(' ', '_').replace('-', '_').casefold() + performance_candidates = [key for key in Steps.keys() if key.casefold() == performance_name and Steps[key] == h] + if len(performance_candidates) == 0: results.append(h) return results.append(-1)