The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
Enforce all pyflake lint rules (#6033)
Chenlei Hu563291ee515b
diff --git a/api_server/routes/internal/internal_routes.py b/api_server/routes/internal/internal_routes.pyindex aaefa9335..8f74529ba 100644--- a/api_server/routes/internal/internal_routes.py+++ b/api_server/routes/internal/internal_routes.py@@ -40,7 +40,7 @@ class InternalRoutes:return web.json_response("".join([(l["t"] + " - " + l["m"]) for l in app.logger.get_logs()]))@self.routes.get('/logs/raw')- async def get_logs(request):+ async def get_raw_logs(request):self.terminal_service.update_size()return web.json_response({"entries": list(app.logger.get_logs()),diff --git a/comfy/controlnet.py b/comfy/controlnet.pyindex 666014eff..7f5988377 100644--- a/comfy/controlnet.py+++ b/comfy/controlnet.py@@ -821,7 +821,7 @@ def load_t2i_adapter(t2i_data, model_options={}): #TODO: model_optionsfor i in range(4):for j in range(2):prefix_replace["adapter.body.{}.resnets.{}.".format(i, j)] = "body.{}.".format(i * 2 + j)- prefix_replace["adapter.body.{}.".format(i, j)] = "body.{}.".format(i * 2)+ prefix_replace["adapter.body.{}.".format(i, )] = "body.{}.".format(i * 2)prefix_replace["adapter."] = ""t2i_data = comfy.utils.state_dict_prefix_replace(t2i_data, prefix_replace)keys = t2i_data.keys()diff --git a/comfy/ldm/modules/sub_quadratic_attention.py b/comfy/ldm/modules/sub_quadratic_attention.pyindex 6d2de0fe3..7c5f1d9f9 100644--- a/comfy/ldm/modules/sub_quadratic_attention.py+++ b/comfy/ldm/modules/sub_quadratic_attention.py@@ -22,7 +22,6 @@ except ImportError:from typing import Optional, NamedTuple, Listfrom typing_extensions import Protocol-from torch import Tensorfrom typing import Listfrom comfy import model_managementdiff --git a/comfy/patcher_extension.py b/comfy/patcher_extension.pyindex 514469185..8367977a0 100644--- a/comfy/patcher_extension.py+++ b/comfy/patcher_extension.py@@ -113,7 +113,7 @@ class WrapperExecutor:def _create_next_executor(self) -> 'WrapperExecutor':new_idx = self.idx + 1if new_idx > len(self.wrappers):- raise Exception(f"Wrapper idx exceeded available wrappers; something went very wrong.")+ raise Exception("Wrapper idx exceeded available wrappers; something went very wrong.")if self.class_obj is None:return WrapperExecutor.new_executor(self.original, self.wrappers, new_idx)return WrapperExecutor.new_class_executor(self.original, self.class_obj, self.wrappers, new_idx)diff --git a/comfy_extras/nodes_clip_sdxl.py b/comfy_extras/nodes_clip_sdxl.pyindex 70764b230..14269caf3 100644--- a/comfy_extras/nodes_clip_sdxl.py+++ b/comfy_extras/nodes_clip_sdxl.py@@ -22,14 +22,15 @@ class CLIPTextEncodeSDXL:@classmethoddef INPUT_TYPES(s):return {"required": {+ "clip": ("CLIP", ),"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),"height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),"crop_w": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),"crop_h": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),"target_width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),"target_height": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),- "text_g": ("STRING", {"multiline": True, "dynamicPrompts": True}), "clip": ("CLIP", ),- "text_l": ("STRING", {"multiline": True, "dynamicPrompts": True}), "clip": ("CLIP", ),+ "text_g": ("STRING", {"multiline": True, "dynamicPrompts": True}),+ "text_l": ("STRING", {"multiline": True, "dynamicPrompts": True}),}}RETURN_TYPES = ("CONDITIONING",)FUNCTION = "encode"diff --git a/execution.py b/execution.pyindex 8fff89839..b57463621 100644--- a/execution.py+++ b/execution.py@@ -760,7 +760,7 @@ def validate_prompt(prompt):if 'class_type' not in prompt[x]:error = {"type": "invalid_prompt",- "message": f"Cannot execute because a node is missing the class_type property.",+ "message": "Cannot execute because a node is missing the class_type property.","details": f"Node ID '#{x}'","extra_info": {}}diff --git a/notebooks/comfyui_colab.ipynb b/notebooks/comfyui_colab.ipynbindex c43bdd7ac..5560b5ff9 100644--- a/notebooks/comfyui_colab.ipynb+++ b/notebooks/comfyui_colab.ipynb@@ -237,11 +237,7 @@"source": ["!npm install -g localtunnel\n","\n",- "import subprocess\n","import threading\n",- "import time\n",- "import socket\n",- "import urllib.request\n","\n","def iframe_thread(port):\n"," while True:\n",@@ -288,8 +284,6 @@"outputs": [],"source": ["import threading\n",- "import time\n",- "import socket\n","def iframe_thread(port):\n"," while True:\n"," time.sleep(0.5)\n",diff --git a/ruff.toml b/ruff.tomlindex 069aa279c..a83d450b1 100644--- a/ruff.toml+++ b/ruff.toml@@ -4,7 +4,7 @@ lint.ignore = ["ALL"]# Enable specific ruleslint.select = ["S307", # suspicious-eval-usage- "F401", # unused-import- "F841", # unused-local-variable- "F821", # undefined-name+ # The "F" series in Ruff stands for "Pyflakes" rules, which catch various Python syntax errors and undefined names.+ # See all rules here: https://docs.astral.sh/ruff/rules/#pyflakes-f+ "F",]\ No newline at end of filediff --git a/server.py b/server.pyindex 728360bcd..a8f0d7672 100644--- a/server.py+++ b/server.py@@ -584,7 +584,7 @@ class PromptServer():return web.json_response(self.prompt_queue.get_history(max_items=max_items))@routes.get("/history/{prompt_id}")- async def get_history(request):+ async def get_history_prompt_id(request):prompt_id = request.match_info.get("prompt_id", None)return web.json_response(self.prompt_queue.get_history(prompt_id=prompt_id))@@ -831,7 +831,7 @@ class PromptServer():try:json_data = handler(json_data)except Exception:- logging.warning(f"[ERROR] An error occurred during the on_prompt_handler processing")+ logging.warning("[ERROR] An error occurred during the on_prompt_handler processing")logging.warning(traceback.format_exc())return json_data