Skip to content

Commit df330c1

Browse files
committed
fixed: an invalid namespace issue introduced by refactoring.
fixed: ruff check #1042
1 parent 6d438d8 commit df330c1

10 files changed

Lines changed: 19 additions & 16 deletions

File tree

modules/impact/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44

55

6-
version_code = [8, 19]
6+
version_code = [8, 19, 1]
77
version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
88

99
my_path = os.path.dirname(__file__)

modules/impact/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def is_execution_model_version_supported():
6464
try:
6565
import comfy_execution # noqa: F401
6666
return True
67-
except:
67+
except Exception:
6868
return False
6969

7070

@@ -2346,7 +2346,7 @@ def to_device(self, obj, device):
23462346
if model_management.get_free_memory(device) > self.size * 1.3:
23472347
try:
23482348
obj.to(device)
2349-
except:
2349+
except Exception:
23502350
logging.warning(f"[Impact Pack] The model is not moved to the '{device}' due to insufficient memory. [1]")
23512351
else:
23522352
logging.warning(f"[Impact Pack] The model is not moved to the '{device}' due to insufficient memory. [2]")
@@ -2395,7 +2395,7 @@ def get_previewer(device, latent_format=latent_formats.SD15(), force=False, meth
23952395
previewer = Latent2RGBPreviewer(latent_format.latent_rgb_factors)
23962396
return previewer
23972397

2398-
except:
2398+
except Exception:
23992399
logging.error("#########################################################################")
24002400
logging.error("[ERROR] ComfyUI-Impact-Pack: Please update ComfyUI to the latest version.")
24012401
logging.error("#########################################################################")

modules/impact/impact_pack.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ def do_detail(image, segs, model, clip, vae, guide_size, guide_size_for_bbox, ma
377377
if cnet_pils is not None:
378378
cnet_pil_list.extend(cnet_pils)
379379

380-
if not (enhanced_image is None):
380+
if enhanced_image is not None:
381381
# don't latent composite-> converting to latent caused poor quality
382382
# use image paste
383383
image = image.cpu()
@@ -388,7 +388,7 @@ def do_detail(image, segs, model, clip, vae, guide_size, guide_size_for_bbox, ma
388388
if detailer_hook is not None:
389389
image = detailer_hook.post_paste(image)
390390

391-
if not (enhanced_image is None):
391+
if enhanced_image is not None:
392392
# Convert enhanced_pil_alpha to RGBA mode
393393
enhanced_image_alpha = utils.tensor_convert_rgba(enhanced_image)
394394
new_seg_image = enhanced_image.numpy() # alpha should not be applied to seg_image

modules/impact/impact_sampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
try:
1515
from comfy_extras.nodes_custom_sampler import Noise_EmptyNoise, Noise_RandomNoise
1616
import node_helpers
17-
except:
17+
except Exception:
1818
logging.warning("\n#############################################\n[Impact Pack] ComfyUI is an outdated version.\n#############################################\n")
1919
raise Exception("[Impact Pack] ComfyUI is an outdated version.")
2020

modules/impact/impact_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def onprompt_for_switch(json_data):
373373
if 'BOOLEAN' == input_node['inputs']['typ']:
374374
try:
375375
onprompt_cond_branch_info[k] = input_node['inputs']['value'].lower() == "true"
376-
except:
376+
except Exception:
377377
pass
378378
else:
379379
onprompt_cond_branch_info[k] = cond_input
@@ -507,7 +507,7 @@ def onprompt_populate_wildcards(json_data):
507507
else:
508508
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. ")
509509
continue
510-
except:
510+
except Exception:
511511
continue
512512
else:
513513
input_seed = int(inputs['seed'])

modules/impact/logics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ def IS_CHANGED(self, value, mode, behavior="Stop", unique_id=None, prompt=None,
654654
# so extra_pnginfo is useless in here
655655
try:
656656
workflow = core.current_prompt['extra_data']['extra_pnginfo']['workflow']
657-
except:
657+
except Exception:
658658
logging.info("[Impact Pack] core.current_prompt['extra_data']['extra_pnginfo']['workflow']")
659659
return 0
660660

@@ -713,7 +713,7 @@ def doit(self, value, mode, behavior="Stop", unique_id=None, prompt=None, extra_
713713
PromptServer.instance.send_sync("impact-bridge-continue", {"node_id": unique_id, 'actives': list(should_be_active_nodes)})
714714
nodes.interrupt_processing()
715715

716-
elif behavior == "Mute" or behavior == True:
716+
elif behavior == "Mute" or behavior == True: # noqa: E712
717717
# mute
718718
should_be_mute_nodes = active_nodes + bypass_nodes
719719
if len(should_be_mute_nodes) > 0:

modules/impact/segs_nodes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,7 @@ def INPUT_TYPES(s):
11301130
def doit(self, segs, dilation):
11311131
new_segs = []
11321132
for seg in segs[1]:
1133-
mask = core.dilate_mask(seg.cropped_mask, dilation)
1133+
mask = utils.dilate_mask(seg.cropped_mask, dilation)
11341134
seg = SEG(seg.cropped_image, mask, seg.confidence, seg.crop_region, seg.bbox, seg.label, seg.control_net_wrapper)
11351135
new_segs.append(seg)
11361136

@@ -1178,7 +1178,7 @@ def INPUT_TYPES(s):
11781178
CATEGORY = "ImpactPack/Util"
11791179

11801180
def doit(self, seg, dilation):
1181-
mask = core.dilate_mask(seg.cropped_mask, dilation)
1181+
mask = utils.dilate_mask(seg.cropped_mask, dilation)
11821182
seg = SEG(seg.cropped_image, mask, seg.confidence, seg.crop_region, seg.bbox, seg.label, seg.control_net_wrapper)
11831183
return (seg,)
11841184

@@ -1963,7 +1963,7 @@ def doit(image, segs, model, clip, vae, rescale_factor, resampling_method, super
19631963
positive, negative, denoise,
19641964
noise_mask=cropped_mask, control_net_wrapper=seg.control_net_wrapper,
19651965
inpaint_model=inpaint_model, noise_mask_feather=noise_mask_feather, scheduler_func_opt=scheduler_func_opt)
1966-
if not (enhanced_image is None):
1966+
if enhanced_image is not None:
19671967
new_image = new_image.cpu()
19681968
enhanced_image = enhanced_image.cpu()
19691969
left = seg.crop_region[0]

modules/impact/wildcards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def split_string_with_sep(input_string):
572572
else:
573573
try:
574574
seed = int(matches[i][5:-1])
575-
except:
575+
except Exception:
576576
seed = None
577577
result_list.append(seed)
578578

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-impact-pack"
33
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."
4-
version = "8.19"
4+
version = "8.19.1"
55
license = { file = "LICENSE.txt" }
66
dependencies = ["segment-anything", "scikit-image", "piexif", "transformers", "opencv-python-headless", "GitPython", "scipy>=1.11.4"]
77

ruff.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[lint]
2+
ignore = ["E402","E701"]
3+
exclude = ["install.py", "*.ipynb"]

0 commit comments

Comments
 (0)