Skip to content

Commit

Permalink
fix: add workaround for same value in Steps IntEnum
Browse files Browse the repository at this point in the history
  • Loading branch information
mashb1t committed Jun 16, 2024
1 parent 2704c90 commit ea1562d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions modules/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,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
Expand Down
5 changes: 3 additions & 2 deletions modules/meta_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ea1562d

Please sign in to comment.