fixed: an invalid namespace issue introduced by refactoring.

fixed: ruff check

https://github.com/ltdrdata/ComfyUI-Impact-Pack/issues/1042
This commit is contained in:
Dr.Lt.Data
2025-07-09 23:51:49 +09:00
parent 6d438d8b5d
commit df330c1b06
10 changed files with 19 additions and 16 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ import os
import logging
version_code = [8, 19]
version_code = [8, 19, 1]
version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
my_path = os.path.dirname(__file__)
+3 -3
View File
@@ -64,7 +64,7 @@ def is_execution_model_version_supported():
try:
import comfy_execution # noqa: F401
return True
except:
except Exception:
return False
@@ -2346,7 +2346,7 @@ class SafeToGPU:
if model_management.get_free_memory(device) > self.size * 1.3:
try:
obj.to(device)
except:
except Exception:
logging.warning(f"[Impact Pack] The model is not moved to the '{device}' due to insufficient memory. [1]")
else:
logging.warning(f"[Impact Pack] The model is not moved to the '{device}' due to insufficient memory. [2]")
@@ -2395,7 +2395,7 @@ try:
previewer = Latent2RGBPreviewer(latent_format.latent_rgb_factors)
return previewer
except:
except Exception:
logging.error("#########################################################################")
logging.error("[ERROR] ComfyUI-Impact-Pack: Please update ComfyUI to the latest version.")
logging.error("#########################################################################")
+2 -2
View File
@@ -377,7 +377,7 @@ class DetailerForEach:
if cnet_pils is not None:
cnet_pil_list.extend(cnet_pils)
if not (enhanced_image is None):
if enhanced_image is not None:
# don't latent composite-> converting to latent caused poor quality
# use image paste
image = image.cpu()
@@ -388,7 +388,7 @@ class DetailerForEach:
if detailer_hook is not None:
image = detailer_hook.post_paste(image)
if not (enhanced_image is None):
if enhanced_image is not None:
# Convert enhanced_pil_alpha to RGBA mode
enhanced_image_alpha = utils.tensor_convert_rgba(enhanced_image)
new_seg_image = enhanced_image.numpy() # alpha should not be applied to seg_image
+1 -1
View File
@@ -14,7 +14,7 @@ import comfy.model_management as mm
try:
from comfy_extras.nodes_custom_sampler import Noise_EmptyNoise, Noise_RandomNoise
import node_helpers
except:
except Exception:
logging.warning("\n#############################################\n[Impact Pack] ComfyUI is an outdated version.\n#############################################\n")
raise Exception("[Impact Pack] ComfyUI is an outdated version.")
+2 -2
View File
@@ -373,7 +373,7 @@ def onprompt_for_switch(json_data):
if 'BOOLEAN' == input_node['inputs']['typ']:
try:
onprompt_cond_branch_info[k] = input_node['inputs']['value'].lower() == "true"
except:
except Exception:
pass
else:
onprompt_cond_branch_info[k] = cond_input
@@ -507,7 +507,7 @@ def onprompt_populate_wildcards(json_data):
else:
logging.info(f"[Impact Pack] Only `ImpactInt`, `Seed (rgthree)` and `Primitive` Node are allowed as the seed for '{v['class_type']}'. It will be ignored. ")
continue
except:
except Exception:
continue
else:
input_seed = int(inputs['seed'])
+2 -2
View File
@@ -654,7 +654,7 @@ class ImpactControlBridge:
# so extra_pnginfo is useless in here
try:
workflow = core.current_prompt['extra_data']['extra_pnginfo']['workflow']
except:
except Exception:
logging.info("[Impact Pack] core.current_prompt['extra_data']['extra_pnginfo']['workflow']")
return 0
@@ -713,7 +713,7 @@ class ImpactControlBridge:
PromptServer.instance.send_sync("impact-bridge-continue", {"node_id": unique_id, 'actives': list(should_be_active_nodes)})
nodes.interrupt_processing()
elif behavior == "Mute" or behavior == True:
elif behavior == "Mute" or behavior == True: # noqa: E712
# mute
should_be_mute_nodes = active_nodes + bypass_nodes
if len(should_be_mute_nodes) > 0:
+3 -3
View File
@@ -1130,7 +1130,7 @@ class DilateMaskInSEGS:
def doit(self, segs, dilation):
new_segs = []
for seg in segs[1]:
mask = core.dilate_mask(seg.cropped_mask, dilation)
mask = utils.dilate_mask(seg.cropped_mask, dilation)
seg = SEG(seg.cropped_image, mask, seg.confidence, seg.crop_region, seg.bbox, seg.label, seg.control_net_wrapper)
new_segs.append(seg)
@@ -1178,7 +1178,7 @@ class Dilate_SEG_ELT:
CATEGORY = "ImpactPack/Util"
def doit(self, seg, dilation):
mask = core.dilate_mask(seg.cropped_mask, dilation)
mask = utils.dilate_mask(seg.cropped_mask, dilation)
seg = SEG(seg.cropped_image, mask, seg.confidence, seg.crop_region, seg.bbox, seg.label, seg.control_net_wrapper)
return (seg,)
@@ -1963,7 +1963,7 @@ class SEGSUpscaler:
positive, negative, denoise,
noise_mask=cropped_mask, control_net_wrapper=seg.control_net_wrapper,
inpaint_model=inpaint_model, noise_mask_feather=noise_mask_feather, scheduler_func_opt=scheduler_func_opt)
if not (enhanced_image is None):
if enhanced_image is not None:
new_image = new_image.cpu()
enhanced_image = enhanced_image.cpu()
left = seg.crop_region[0]
+1 -1
View File
@@ -572,7 +572,7 @@ def split_string_with_sep(input_string):
else:
try:
seed = int(matches[i][5:-1])
except:
except Exception:
seed = None
result_list.append(seed)
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui-impact-pack"
description = "This node pack offers various detector nodes and detailer nodes that allow you to configure a workflow that automatically enhances facial details. And provide iterative upscaler."
version = "8.19"
version = "8.19.1"
license = { file = "LICENSE.txt" }
dependencies = ["segment-anything", "scikit-image", "piexif", "transformers", "opencv-python-headless", "GitPython", "scipy>=1.11.4"]
+3
View File
@@ -0,0 +1,3 @@
[lint]
ignore = ["E402","E701"]
exclude = ["install.py", "*.ipynb"]