From df2966a3eca78c90da447442d0c9c15c6864de50 Mon Sep 17 00:00:00 2001 From: db0 Date: Mon, 20 May 2024 13:07:46 +0200 Subject: [PATCH] chore: linting: --- horde/apis/models/stable_v2.py | 7 ++++++- horde/apis/v2/stable.py | 4 ++-- horde/consts.py | 4 +--- horde/utils.py | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/horde/apis/models/stable_v2.py b/horde/apis/models/stable_v2.py index 4f2f2ef1..c2bba38e 100644 --- a/horde/apis/models/stable_v2.py +++ b/horde/apis/models/stable_v2.py @@ -391,7 +391,12 @@ def __init__(self, api): "tis": fields.List(fields.Nested(self.input_model_tis, skip_none=True)), "special": fields.Nested(self.input_model_special_payload, skip_none=True), "extra_texts": fields.List(fields.Nested(self.model_extra_texts)), - "workflow": fields.String(required=False, default=None, enum=list(KNOWN_WORKFLOWS), description="Explicitly specify the horde-engine workflow to use."), + "workflow": fields.String( + required=False, + default=None, + enum=list(KNOWN_WORKFLOWS), + description="Explicitly specify the horde-engine workflow to use.", + ), }, ) self.response_model_generation_payload = api.inherit( diff --git a/horde/apis/v2/stable.py b/horde/apis/v2/stable.py index f8527fb3..289d3603 100644 --- a/horde/apis/v2/stable.py +++ b/horde/apis/v2/stable.py @@ -29,7 +29,7 @@ from horde.logger import logger from horde.model_reference import model_reference from horde.patreon import patrons -from horde.utils import hash_dictionary, does_extra_text_reference_exist +from horde.utils import does_extra_text_reference_exist, hash_dictionary from horde.vars import horde_title models = ImageModels(api) @@ -195,7 +195,7 @@ def validate(self): raise e.BadRequest("QR Code controlnet only works with SD 1.5 models currently", rc="ControlNetMismatch.") if self.params.get("extra_texts") is None or len(self.params.get("extra_texts")) == 0: raise e.BadRequest("This request requires you pass the required extra texts for this workflow.", rc="MissingExtraTexts.") - if not does_extra_text_reference_exist(self.params.get("extra_texts"), 'qr_code'): + if not does_extra_text_reference_exist(self.params.get("extra_texts"), "qr_code"): raise e.BadRequest("This request requires you pass the required extra texts for this workflow.", rc="MissingExtraTexts.") if self.params.get("init_as_image") and self.params.get("return_control_map"): raise e.UnsupportedModel( diff --git a/horde/consts.py b/horde/consts.py index 68e32242..5e979d3c 100644 --- a/horde/consts.py +++ b/horde/consts.py @@ -52,9 +52,7 @@ "lcm", } -KNOWN_WORKFLOWS = { - "qr_code" -} +KNOWN_WORKFLOWS = {"qr_code"} # These samplers perform double the steps per image # As such we need to take it into account for the upfront kudos requirements diff --git a/horde/utils.py b/horde/utils.py index b42be77e..c9814610 100644 --- a/horde/utils.py +++ b/horde/utils.py @@ -121,8 +121,9 @@ def validate_regex(regex_string): return False return True + def does_extra_text_reference_exist(extra_texts, reference): for et in extra_texts: - if et['reference'] == reference: + if et["reference"] == reference: return True - return False \ No newline at end of file + return False