diff --git a/tests/test_concat_by_target_node.py b/tests/test_concat_by_target_node.py index bead86a..fc5f2c0 100644 --- a/tests/test_concat_by_target_node.py +++ b/tests/test_concat_by_target_node.py @@ -31,7 +31,7 @@ class TestConcatByTargetNode(unittest.TestCase): self.assertLessEqual(float(image.max().item()), 1.0) self.assertTrue(torch.allclose(mask, torch.zeros_like(mask))) - def test_new_port_names_are_accepted(self): + def test_legacy_port_names_are_accepted(self): image_a = self.make_image(width=2, height=2, value=0.2) image_b = self.make_image(width=1, height=2, value=0.8) diff --git a/tests/test_concat_by_target_registration.py b/tests/test_concat_by_target_registration.py index e1d6965..368c85f 100644 --- a/tests/test_concat_by_target_registration.py +++ b/tests/test_concat_by_target_registration.py @@ -41,10 +41,10 @@ class TestConcatByTargetRegistration(unittest.TestCase): self.assertEqual(required["background_value"][1]["default"], 0.0) self.assertEqual(required["multiple_of"][0], "INT") self.assertEqual(required["allow_batch_broadcast"][0], "BOOLEAN") - self.assertEqual(optional["image/mask_A"][0], "IMAGE,MASK") - self.assertEqual(optional["image/mask_B"][0], "IMAGE,MASK") - self.assertNotIn("a", optional) - self.assertNotIn("b", optional) + self.assertEqual(str(optional["a"][0]), "*") + self.assertEqual(str(optional["b"][0]), "*") + self.assertNotIn("image/mask_A", optional) + self.assertNotIn("image/mask_B", optional) self.assertNotIn("image_a", optional) self.assertNotIn("image_b", optional) self.assertNotIn("mask_a", optional) diff --git a/utils/concat_by_target.py b/utils/concat_by_target.py index 5e49b81..b08eae0 100644 --- a/utils/concat_by_target.py +++ b/utils/concat_by_target.py @@ -16,11 +16,18 @@ TARGET_CHOICES = ["A", "B"] POSITION_CHOICES = ["top", "bottom", "left", "right"] RESIZE_MODE_CHOICES = ["keep_proportion", "stretch", "none"] ALIGN_CHOICES = ["start", "center", "end"] -INPUT_DATA_CHOICES = "IMAGE,MASK" PORT_A_NAME = "image/mask_A" PORT_B_NAME = "image/mask_B" +class AnyType(str): + def __ne__(self, other): # pragma: no cover - exercised by ComfyUI type checks + return False + + +ANY_TYPE = AnyType("*") + + def _require_torch(): if torch is None or torch_nn_functional is None: raise RuntimeError("[LLS] torch is required for LLS Concat By Target.") from _TORCH_ERR @@ -452,8 +459,8 @@ class LLSConcatByTarget: "allow_batch_broadcast": ("BOOLEAN", {"default": True}), }, "optional": { - PORT_A_NAME: (INPUT_DATA_CHOICES,), - PORT_B_NAME: (INPUT_DATA_CHOICES,), + "a": (ANY_TYPE,), + "b": (ANY_TYPE,), }, }