style: apply new rules

This commit is contained in:
Bingsu
2023-06-15 16:33:22 +09:00
parent 567e0c1eec
commit b88efd6b5d
5 changed files with 11 additions and 10 deletions

View File

@@ -1 +1 @@
__version__ = "23.6.2"
__version__ = "23.6.3.dev0"

View File

@@ -20,7 +20,8 @@ def mediapipe_predict(
if model_type in mapping:
func = mapping[model_type]
return func(image, confidence)
raise RuntimeError(f"[-] ADetailer: Invalid mediapipe model type: {model_type}")
msg = f"[-] ADetailer: Invalid mediapipe model type: {model_type}"
raise RuntimeError(msg)
def mediapipe_face_detection(

View File

@@ -90,7 +90,7 @@ def adui(
infotext_fields.extend(infofields)
# components: [bool, dict, dict, ...]
components = [ad_enable] + states
components = [ad_enable, *states]
return components, infotext_fields
@@ -106,7 +106,7 @@ def one_ui_group(
eid = partial(elem_id, n=n, is_img2img=is_img2img)
with gr.Row():
model_choices = model_list + ["None"] if n == 0 else ["None"] + model_list
model_choices = [*model_list, "None"] if n == 0 else ["None", *model_list]
w.ad_model = gr.Dropdown(
label="ADetailer model" + suffix(n),
@@ -164,7 +164,7 @@ def one_ui_group(
fn=on_change, inputs=[state, widget], outputs=[state], queue=False
)
all_inputs = [state] + w.tolist()
all_inputs = [state, *w.tolist()]
target_button = i2i_button if is_img2img else t2i_button
target_button.click(
fn=on_generate_click, inputs=all_inputs, outputs=state, queue=False
@@ -402,7 +402,7 @@ def inpainting(w: Widgets, n: int, is_img2img: bool):
def controlnet(w: Widgets, n: int, is_img2img: bool):
eid = partial(elem_id, n=n, is_img2img=is_img2img)
cn_models = ["None"] + get_cn_models()
cn_models = ["None", *get_cn_models()]
with gr.Row(variant="panel"):
with gr.Column(variant="compact"):

View File

@@ -16,7 +16,7 @@ profile = "black"
known_first_party = ["launch", "modules"]
[tool.ruff]
select = ["A", "B", "C4", "C90", "COM", "E", "EM", "F", "FA", "I001", "ISC", "N", "PIE", "PT", "RET", "RUF", "SIM", "UP", "W"]
select = ["A", "B", "C4", "C90", "E", "EM", "F", "FA", "I001", "ISC", "N", "PIE", "PT", "RET", "RUF", "SIM", "UP", "W"]
ignore = ["B008", "B905", "E501", "F401", "UP007"]
[tool.ruff.isort]

View File

@@ -15,7 +15,7 @@ from typing import Any
import gradio as gr
import torch
import modules # noqa: F401
import modules
from adetailer import (
AFTER_DETAILER,
__version__,
@@ -647,7 +647,7 @@ def make_axis_on_xyz_grid():
if xyz_grid is None:
return
model_list = ["None"] + list(model_mapping.keys())
model_list = ["None", *model_mapping.keys()]
def set_value(p, x, xs, *, field: str):
if not hasattr(p, "adetailer_xyz"):
@@ -696,7 +696,7 @@ def make_axis_on_xyz_grid():
"[ADetailer] ControlNet model 1st",
str,
partial(set_value, field="ad_controlnet_model"),
choices=lambda: ["None"] + get_cn_models(),
choices=lambda: ["None", *get_cn_models()],
),
]