Skip to content

Commit 5cdd214

Browse files
authored
Merge pull request #5 from StableLlama/consolidation
version 0.2.0 with consolidation of nodes
2 parents ac0aa7b + be067b2 commit 5cdd214

17 files changed

+1411
-1222
lines changed

pyproject.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "basic_data_handling"
7-
version = "0.1.0"
7+
version = "0.2.0"
88
description = """NOTE: Still in development! Expect breaking changes!
99
Basic Python functions for manipulating data that every programmer is used to.
1010
Currently supported ComfyUI data types: BOOLEAN, FLOAT, INT, STRING and data lists.
1111
Additionally supported Python data types as custom data types: DICT, LIST.
1212
Data handling is supported with comparisons and control flow operations.
1313
Also contains math, regex, and file system path manipulation functions."""
1414
authors = [
15-
{name = "Basic data handling"}
15+
{name = "StableLlama"}
1616
]
1717
readme = "README.md"
1818
license = {text = "MIT license"}
@@ -44,7 +44,10 @@ Icon = ""
4444

4545
[tool.pytest.ini_options]
4646
minversion = "8.0"
47-
pythonpath = "src"
47+
pythonpath = [
48+
"src",
49+
"../..", # Path to parent directory containing comfy module
50+
]
4851
testpaths = [
4952
"tests",
5053
]

src/basic_data_handling/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from . import (boolean_nodes, casting_nodes, comparison_nodes, control_flow_nodes,
22
data_list_nodes, dict_nodes, float_nodes, int_nodes, list_nodes,
3-
math_nodes, path_nodes, regex_nodes, set_nodes, string_nodes)
3+
math_nodes, math_formula_node, path_nodes, regex_nodes, set_nodes,
4+
string_nodes)
45

56
NODE_CLASS_MAPPINGS = {}
67
NODE_CLASS_MAPPINGS.update(boolean_nodes.NODE_CLASS_MAPPINGS)
@@ -16,6 +17,7 @@
1617
NODE_CLASS_MAPPINGS.update(regex_nodes.NODE_CLASS_MAPPINGS)
1718
NODE_CLASS_MAPPINGS.update(set_nodes.NODE_CLASS_MAPPINGS)
1819
NODE_CLASS_MAPPINGS.update(math_nodes.NODE_CLASS_MAPPINGS)
20+
NODE_CLASS_MAPPINGS.update(math_formula_node.NODE_CLASS_MAPPINGS)
1921
NODE_CLASS_MAPPINGS.update(string_nodes.NODE_CLASS_MAPPINGS)
2022

2123
NODE_DISPLAY_NAME_MAPPINGS = {}
@@ -32,4 +34,5 @@
3234
NODE_DISPLAY_NAME_MAPPINGS.update(regex_nodes.NODE_DISPLAY_NAME_MAPPINGS)
3335
NODE_DISPLAY_NAME_MAPPINGS.update(set_nodes.NODE_DISPLAY_NAME_MAPPINGS)
3436
NODE_DISPLAY_NAME_MAPPINGS.update(math_nodes.NODE_DISPLAY_NAME_MAPPINGS)
37+
NODE_DISPLAY_NAME_MAPPINGS.update(math_formula_node.NODE_DISPLAY_NAME_MAPPINGS)
3538
NODE_DISPLAY_NAME_MAPPINGS.update(string_nodes.NODE_DISPLAY_NAME_MAPPINGS)

src/basic_data_handling/boolean_nodes.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from inspect import cleandoc
2+
from comfy.comfy_types.node_typing import IO, ComfyNodeABC
23

3-
class BooleanAnd:
4+
class BooleanAnd(ComfyNodeABC):
45
"""
56
Returns the logical AND result of two boolean values.
67
@@ -10,12 +11,12 @@ class BooleanAnd:
1011
def INPUT_TYPES(cls):
1112
return {
1213
"required": {
13-
"input1": ("BOOLEAN", {"default": False, "forceInput": True}),
14-
"input2": ("BOOLEAN", {"default": False, "forceInput": True}),
14+
"input1": (IO.BOOLEAN, {"default": False, "forceInput": True}),
15+
"input2": (IO.BOOLEAN, {"default": False, "forceInput": True}),
1516
}
1617
}
1718

18-
RETURN_TYPES = ("BOOLEAN",)
19+
RETURN_TYPES = (IO.BOOLEAN,)
1920
CATEGORY = "Basic/BOOLEAN"
2021
DESCRIPTION = cleandoc(__doc__ or "")
2122
FUNCTION = "and_operation"
@@ -24,7 +25,7 @@ def and_operation(self, input1: bool, input2: bool) -> tuple[bool]:
2425
return (input1 and input2,)
2526

2627

27-
class BooleanOr:
28+
class BooleanOr(ComfyNodeABC):
2829
"""
2930
Returns the logical OR result of two boolean values.
3031
@@ -34,12 +35,12 @@ class BooleanOr:
3435
def INPUT_TYPES(cls):
3536
return {
3637
"required": {
37-
"input1": ("BOOLEAN", {"default": False, "forceInput": True}),
38-
"input2": ("BOOLEAN", {"default": False, "forceInput": True}),
38+
"input1": (IO.BOOLEAN, {"default": False, "forceInput": True}),
39+
"input2": (IO.BOOLEAN, {"default": False, "forceInput": True}),
3940
}
4041
}
4142

42-
RETURN_TYPES = ("BOOLEAN",)
43+
RETURN_TYPES = (IO.BOOLEAN,)
4344
CATEGORY = "Basic/BOOLEAN"
4445
DESCRIPTION = cleandoc(__doc__ or "")
4546
FUNCTION = "or_operation"
@@ -48,7 +49,7 @@ def or_operation(self, input1: bool, input2: bool) -> tuple[bool]:
4849
return (input1 or input2,)
4950

5051

51-
class BooleanNot:
52+
class BooleanNot(ComfyNodeABC):
5253
"""
5354
Returns the logical NOT result of a boolean value.
5455
@@ -58,11 +59,11 @@ class BooleanNot:
5859
def INPUT_TYPES(cls):
5960
return {
6061
"required": {
61-
"input": ("BOOLEAN", {"default": False, "forceInput": True}),
62+
"input": (IO.BOOLEAN, {"default": False, "forceInput": True}),
6263
}
6364
}
6465

65-
RETURN_TYPES = ("BOOLEAN",)
66+
RETURN_TYPES = (IO.BOOLEAN,)
6667
CATEGORY = "Basic/BOOLEAN"
6768
DESCRIPTION = cleandoc(__doc__ or "")
6869
FUNCTION = "not_operation"
@@ -71,7 +72,7 @@ def not_operation(self, input: bool) -> tuple[bool]:
7172
return (not input,)
7273

7374

74-
class BooleanXor:
75+
class BooleanXor(ComfyNodeABC):
7576
"""
7677
Returns the logical XOR result of two boolean values.
7778
@@ -81,12 +82,12 @@ class BooleanXor:
8182
def INPUT_TYPES(cls):
8283
return {
8384
"required": {
84-
"input1": ("BOOLEAN", {"default": False, "forceInput": True}),
85-
"input2": ("BOOLEAN", {"default": False, "forceInput": True}),
85+
"input1": (IO.BOOLEAN, {"default": False, "forceInput": True}),
86+
"input2": (IO.BOOLEAN, {"default": False, "forceInput": True}),
8687
}
8788
}
8889

89-
RETURN_TYPES = ("BOOLEAN",)
90+
RETURN_TYPES = (IO.BOOLEAN,)
9091
CATEGORY = "Basic/BOOLEAN"
9192
DESCRIPTION = cleandoc(__doc__ or "")
9293
FUNCTION = "xor_operation"
@@ -95,7 +96,7 @@ def xor_operation(self, input1: bool, input2: bool) -> tuple[bool]:
9596
return (input1 != input2,)
9697

9798

98-
class BooleanNand:
99+
class BooleanNand(ComfyNodeABC):
99100
"""
100101
Returns the logical NAND result of two boolean values.
101102
@@ -105,12 +106,12 @@ class BooleanNand:
105106
def INPUT_TYPES(cls):
106107
return {
107108
"required": {
108-
"input1": ("BOOLEAN", {"default": False, "forceInput": True}),
109-
"input2": ("BOOLEAN", {"default": False, "forceInput": True}),
109+
"input1": (IO.BOOLEAN, {"default": False, "forceInput": True}),
110+
"input2": (IO.BOOLEAN, {"default": False, "forceInput": True}),
110111
}
111112
}
112113

113-
RETURN_TYPES = ("BOOLEAN",)
114+
RETURN_TYPES = (IO.BOOLEAN,)
114115
CATEGORY = "Basic/BOOLEAN"
115116
DESCRIPTION = cleandoc(__doc__ or "")
116117
FUNCTION = "nand_operation"
@@ -119,7 +120,7 @@ def nand_operation(self, input1: bool, input2: bool) -> tuple[bool]:
119120
return (not (input1 and input2),)
120121

121122

122-
class BooleanNor:
123+
class BooleanNor(ComfyNodeABC):
123124
"""
124125
Returns the logical NOR result of two boolean values.
125126
@@ -129,12 +130,12 @@ class BooleanNor:
129130
def INPUT_TYPES(cls):
130131
return {
131132
"required": {
132-
"input1": ("BOOLEAN", {"default": False, "forceInput": True}),
133-
"input2": ("BOOLEAN", {"default": False, "forceInput": True}),
133+
"input1": (IO.BOOLEAN, {"default": False, "forceInput": True}),
134+
"input2": (IO.BOOLEAN, {"default": False, "forceInput": True}),
134135
}
135136
}
136137

137-
RETURN_TYPES = ("BOOLEAN",)
138+
RETURN_TYPES = (IO.BOOLEAN,)
138139
CATEGORY = "Basic/BOOLEAN"
139140
DESCRIPTION = cleandoc(__doc__ or "")
140141
FUNCTION = "nor_operation"

0 commit comments

Comments
 (0)