fix: add workaround for same value in Steps IntEnum (#3153)

This commit is contained in:
Manuel Schmid 2024-06-16 18:44:16 +02:00 committed by GitHub
parent 3e453501f7
commit 9d41c9521b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -131,6 +131,10 @@ class Steps(IntEnum):
LIGHTNING = 4 LIGHTNING = 4
HYPER_SD = 4 HYPER_SD = 4
@classmethod
def keys(cls) -> list:
return list(map(lambda c: c, Steps.__members__))
class StepsUOV(IntEnum): class StepsUOV(IntEnum):
QUALITY = 36 QUALITY = 36

View File

@ -119,8 +119,9 @@ def get_steps(key: str, fallback: str | None, source_dict: dict, results: list,
assert h is not None assert h is not None
h = int(h) h = int(h)
# if not in steps or in steps and performance is not the same # 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(' ', performance_name = source_dict.get('performance', '').replace(' ', '_').replace('-', '_').casefold()
'_').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) results.append(h)
return return
results.append(-1) results.append(-1)