diff --git a/__init__.py b/__init__.py index a96c7f2..bf61fc1 100644 --- a/__init__.py +++ b/__init__.py @@ -1,4 +1,4 @@ -from . import api, nodes, tile, region, nsfw, translation, krita +from . import api as api, nodes, tile, region, nsfw, translation, krita NODE_CLASS_MAPPINGS = { "ETN_LoadImageBase64": nodes.LoadImageBase64, diff --git a/api.py b/api.py index 43eae84..c6ab03c 100644 --- a/api.py +++ b/api.py @@ -7,7 +7,7 @@ import traceback import re import logging -from comfy import model_detection, supported_models +from comfy import model_detection import comfy.utils import folder_paths import server @@ -179,7 +179,6 @@ def has_invalid_filename(filename: str): _server: server.PromptServer | None = getattr(server.PromptServer, "instance", None) if _server is not None: - _workflow_exchange = WorkflowExchange(_server) @_server.routes.get("/api/etn/model_info/{folder_name}") @@ -193,10 +192,6 @@ if _server is not None: async def api_model_info(request): return inspect_models("checkpoints") - @_server.routes.get("/etn/model_info") - async def api_model_info(request): - return inspect_models("checkpoints") - @_server.routes.get("/api/etn/languages") async def languages(request): try: @@ -231,7 +226,9 @@ if _server is not None: folder = Path(folder_paths.folder_names_and_paths[folder_name][0][0]) total_size = int(request.headers.get("Content-Length", "0")) - logging.info(f"Uploading {filename} ({total_size/(1024**2):.1f} MB) to {folder} folder") + logging.info( + f"Uploading {filename} ({total_size / (1024**2):.1f} MB) to {folder} folder" + ) with open(folder / filename, "wb") as f: async for chunk, _ in request.content.iter_chunks(): diff --git a/nodes.py b/nodes.py index fd545d4..95c582e 100644 --- a/nodes.py +++ b/nodes.py @@ -85,9 +85,11 @@ class SendImageWebSocket: [format, image, None], server.client_id, ) - results.append( - {"source": "websocket", "content-type": f"image/{format.lower()}", "type": "output"} - ) + results.append({ + "source": "websocket", + "content-type": f"image/{format.lower()}", + "type": "output", + }) return {"ui": {"images": results}} @@ -166,9 +168,9 @@ class ApplyMaskToImage: assert mask.ndim == 3, f"Mask should have shape [B, H, W]. {mask.shape}" assert out.ndim == 4, f"Image should have shape [B, C, H, W]. {out.shape}" - assert ( - out.shape[-2:] == mask.shape[-2:] - ), f"Image size {out.shape[-2:]} must match mask size {mask.shape[-2:]}" + assert out.shape[-2:] == mask.shape[-2:], ( + f"Image size {out.shape[-2:]} must match mask size {mask.shape[-2:]}" + ) is_mask_batch = mask.shape[0] == out.shape[0] # Apply each mask in the batch to its corresponding image's alpha channel diff --git a/pyproject.toml b/pyproject.toml index adc5bea..1961c57 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,20 @@ [project] name = "comfyui-tooling-nodes" description = "Provides nodes and server API extensions geared towards using ComfyUI as a backend for external tools." -version = "2.0.0" +version = "2.0.1" license = { file = "LICENSE" } [project.urls] Repository = "https://github.com/Acly/comfyui-tooling-nodes" +[tool.ruff] +target-version = "py311" +line-length = 100 +preview = true + +[tool.ruff.lint] +ignore = ["E741"] + [tool.black] line-length = 100 preview = true diff --git a/region.py b/region.py index 292bd28..2602d5f 100644 --- a/region.py +++ b/region.py @@ -115,7 +115,6 @@ class ListRegionMasks: class AttentionMask: - @classmethod def INPUT_TYPES(s): return {