mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-10 18:05:16 +00:00
Enforce all pyflake lint rules (#6033)
* Enforce F821 undefined-name * Enforce all pyflake lint rules
This commit is contained in:
parent
6c0377f43e
commit
563291ee51
@ -40,7 +40,7 @@ class InternalRoutes:
|
|||||||
return web.json_response("".join([(l["t"] + " - " + l["m"]) for l in app.logger.get_logs()]))
|
return web.json_response("".join([(l["t"] + " - " + l["m"]) for l in app.logger.get_logs()]))
|
||||||
|
|
||||||
@self.routes.get('/logs/raw')
|
@self.routes.get('/logs/raw')
|
||||||
async def get_logs(request):
|
async def get_raw_logs(request):
|
||||||
self.terminal_service.update_size()
|
self.terminal_service.update_size()
|
||||||
return web.json_response({
|
return web.json_response({
|
||||||
"entries": list(app.logger.get_logs()),
|
"entries": list(app.logger.get_logs()),
|
||||||
|
@ -821,7 +821,7 @@ def load_t2i_adapter(t2i_data, model_options={}): #TODO: model_options
|
|||||||
for i in range(4):
|
for i in range(4):
|
||||||
for j in range(2):
|
for j in range(2):
|
||||||
prefix_replace["adapter.body.{}.resnets.{}.".format(i, j)] = "body.{}.".format(i * 2 + j)
|
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."] = ""
|
prefix_replace["adapter."] = ""
|
||||||
t2i_data = comfy.utils.state_dict_prefix_replace(t2i_data, prefix_replace)
|
t2i_data = comfy.utils.state_dict_prefix_replace(t2i_data, prefix_replace)
|
||||||
keys = t2i_data.keys()
|
keys = t2i_data.keys()
|
||||||
|
@ -22,7 +22,6 @@ except ImportError:
|
|||||||
from typing import Optional, NamedTuple, List
|
from typing import Optional, NamedTuple, List
|
||||||
from typing_extensions import Protocol
|
from typing_extensions import Protocol
|
||||||
|
|
||||||
from torch import Tensor
|
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from comfy import model_management
|
from comfy import model_management
|
||||||
|
@ -113,7 +113,7 @@ class WrapperExecutor:
|
|||||||
def _create_next_executor(self) -> 'WrapperExecutor':
|
def _create_next_executor(self) -> 'WrapperExecutor':
|
||||||
new_idx = self.idx + 1
|
new_idx = self.idx + 1
|
||||||
if new_idx > len(self.wrappers):
|
if 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:
|
if self.class_obj is None:
|
||||||
return WrapperExecutor.new_executor(self.original, self.wrappers, new_idx)
|
return WrapperExecutor.new_executor(self.original, self.wrappers, new_idx)
|
||||||
return WrapperExecutor.new_class_executor(self.original, self.class_obj, self.wrappers, new_idx)
|
return WrapperExecutor.new_class_executor(self.original, self.class_obj, self.wrappers, new_idx)
|
||||||
|
@ -22,14 +22,15 @@ class CLIPTextEncodeSDXL:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(s):
|
def INPUT_TYPES(s):
|
||||||
return {"required": {
|
return {"required": {
|
||||||
|
"clip": ("CLIP", ),
|
||||||
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
"width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||||
"height": ("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_w": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION}),
|
||||||
"crop_h": ("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_width": ("INT", {"default": 1024.0, "min": 0, "max": MAX_RESOLUTION}),
|
||||||
"target_height": ("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_g": ("STRING", {"multiline": True, "dynamicPrompts": True}),
|
||||||
"text_l": ("STRING", {"multiline": True, "dynamicPrompts": True}), "clip": ("CLIP", ),
|
"text_l": ("STRING", {"multiline": True, "dynamicPrompts": True}),
|
||||||
}}
|
}}
|
||||||
RETURN_TYPES = ("CONDITIONING",)
|
RETURN_TYPES = ("CONDITIONING",)
|
||||||
FUNCTION = "encode"
|
FUNCTION = "encode"
|
||||||
|
@ -760,7 +760,7 @@ def validate_prompt(prompt):
|
|||||||
if 'class_type' not in prompt[x]:
|
if 'class_type' not in prompt[x]:
|
||||||
error = {
|
error = {
|
||||||
"type": "invalid_prompt",
|
"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}'",
|
"details": f"Node ID '#{x}'",
|
||||||
"extra_info": {}
|
"extra_info": {}
|
||||||
}
|
}
|
||||||
|
@ -237,11 +237,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"!npm install -g localtunnel\n",
|
"!npm install -g localtunnel\n",
|
||||||
"\n",
|
"\n",
|
||||||
"import subprocess\n",
|
|
||||||
"import threading\n",
|
"import threading\n",
|
||||||
"import time\n",
|
|
||||||
"import socket\n",
|
|
||||||
"import urllib.request\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"def iframe_thread(port):\n",
|
"def iframe_thread(port):\n",
|
||||||
" while True:\n",
|
" while True:\n",
|
||||||
@ -288,8 +284,6 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"import threading\n",
|
"import threading\n",
|
||||||
"import time\n",
|
|
||||||
"import socket\n",
|
|
||||||
"def iframe_thread(port):\n",
|
"def iframe_thread(port):\n",
|
||||||
" while True:\n",
|
" while True:\n",
|
||||||
" time.sleep(0.5)\n",
|
" time.sleep(0.5)\n",
|
||||||
|
@ -4,7 +4,7 @@ lint.ignore = ["ALL"]
|
|||||||
# Enable specific rules
|
# Enable specific rules
|
||||||
lint.select = [
|
lint.select = [
|
||||||
"S307", # suspicious-eval-usage
|
"S307", # suspicious-eval-usage
|
||||||
"F401", # unused-import
|
# The "F" series in Ruff stands for "Pyflakes" rules, which catch various Python syntax errors and undefined names.
|
||||||
"F841", # unused-local-variable
|
# See all rules here: https://docs.astral.sh/ruff/rules/#pyflakes-f
|
||||||
"F821", # undefined-name
|
"F",
|
||||||
]
|
]
|
@ -584,7 +584,7 @@ class PromptServer():
|
|||||||
return web.json_response(self.prompt_queue.get_history(max_items=max_items))
|
return web.json_response(self.prompt_queue.get_history(max_items=max_items))
|
||||||
|
|
||||||
@routes.get("/history/{prompt_id}")
|
@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)
|
prompt_id = request.match_info.get("prompt_id", None)
|
||||||
return web.json_response(self.prompt_queue.get_history(prompt_id=prompt_id))
|
return web.json_response(self.prompt_queue.get_history(prompt_id=prompt_id))
|
||||||
|
|
||||||
@ -831,7 +831,7 @@ class PromptServer():
|
|||||||
try:
|
try:
|
||||||
json_data = handler(json_data)
|
json_data = handler(json_data)
|
||||||
except Exception:
|
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())
|
logging.warning(traceback.format_exc())
|
||||||
|
|
||||||
return json_data
|
return json_data
|
||||||
|
Loading…
Reference in New Issue
Block a user