dict ->{}

This commit is contained in:
mcDandy
2026-02-03 13:17:39 +01:00
parent e01a74d6ad
commit 7e637da47f
14 changed files with 28 additions and 27 deletions
+1
View File
@@ -162,6 +162,7 @@ You can also get the node from comfy manager under the name of More math.
- `reshape(tensor, shape)` or `rshp`: Reshapes the tensor to a new shape. (e.g., `rshp(a, [S0*S1, S2, S3])`)
- `blur(x, sigma)` or `gaussian`: Applies a Gaussian blur with given `sigma` along last two or spatial dimensions (toggleable by optional parameter) - default use last 2 dimensions.
- `edge(x)`: Applies a Sobel edge detection filter along the last two dimension or spatial dimensions (Height and Width) - can be selected by optional value (0 or missing = use last 2 dimensions).
- `batch_shuffle(tensor, indices)` or `shuffle` or `select`: Reorders or gathers slices along the 0th dimension of a tensor based on a list of indices. (e.g., `shuffle(V0, [0, 0, 1])` repeats the first frame twice and then the second).
### FFT (Tensor Only)
+2 -2
View File
@@ -51,7 +51,7 @@ class AudioMathNode(io.ComfyNode):
)
@classmethod
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack=dict()):
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack={}):
input_stream = InputStream(Expression)
lexer = MathExprLexer(input_stream)
@@ -83,7 +83,7 @@ class AudioMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, V, F, Expression, length_mismatch="tile",stack=dict()):
def execute(cls, V, F, Expression, length_mismatch="tile",stack={}):
# Identify all present audio inputs and their keys
tensor_keys = [k for k, v in V.items() if v is not None and isinstance(v, dict) and "waveform" in v]
if not tensor_keys:
+2 -2
View File
@@ -39,7 +39,7 @@ class CLIPMathNode(io.ComfyNode):
tooltip = cleandoc(__doc__)
@classmethod
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack=dict()):
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack={}):
input_stream = InputStream(Expression)
lexer = MathExprLexer(input_stream)
@@ -71,7 +71,7 @@ class CLIPMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, V, F, Expression, length_mismatch="tile",stack=dict()) -> io.NodeOutput:
def execute(cls, V, F, Expression, length_mismatch="tile",stack={}) -> io.NodeOutput:
# Determine reference CLIP
a = V.get("V0")
if a is None:
+2 -2
View File
@@ -46,7 +46,7 @@ class ConditioningMathNode(io.ComfyNode):
)
@classmethod
def check_lazy_status(cls, Expression,Expression_pi, V, F,batching, length_mismatch="tile",stack=dict()):
def check_lazy_status(cls, Expression,Expression_pi, V, F,batching, length_mismatch="tile",stack={}):
input_stream = InputStream(Expression)
lexer = MathExprLexer(input_stream)
@@ -83,7 +83,7 @@ class ConditioningMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, V, F, Expression, Expression_pi,batching, length_mismatch="tile",stack=dict()):
def execute(cls, V, F, Expression, Expression_pi,batching, length_mismatch="tile",stack={}):
# Identify all present conditioning inputs
tensor_keys = [k for k, v in V.items() if v is not None and isinstance(v, list) and len(v) > 0]
if not tensor_keys:
+2 -2
View File
@@ -41,7 +41,7 @@ class FloatMathNode(io.ComfyNode):
tooltip = cleandoc(__doc__)
@classmethod
def check_lazy_status(cls, FloatFunc, V,stack=dict()):
def check_lazy_status(cls, FloatFunc, V,stack={}):
input_stream = InputStream(FloatFunc)
lexer = MathExprLexer(input_stream)
stream = CommonTokenStream(lexer)
@@ -72,7 +72,7 @@ class FloatMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, FloatFunc, V,stack=dict()):
def execute(cls, FloatFunc, V,stack={}):
variables = {}
# Populate aliases
+3 -3
View File
@@ -47,7 +47,7 @@ class GuiderMathNode(io.ComfyNode):
)
@classmethod
def check_lazy_status(cls, Expression,Expression1, V, F,stack=dict()):
def check_lazy_status(cls, Expression,Expression1, V, F,stack={}):
input_stream = InputStream(Expression)
input_stream1 = InputStream(Expression1)
lexer = MathExprLexer(input_stream)
@@ -82,12 +82,12 @@ class GuiderMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, V, F, Expression,Expression1,stack=dict()):
def execute(cls, V, F, Expression,Expression1,stack={}):
return (MathGuider(V, F, Expression,Expression1),stack)
class MathGuider:
def __init__(self, V, F, expression,expression1,stack=dict()):
def __init__(self, V, F, expression,expression1,stack={}):
self.V = V
self.F = F
self.expression = expression
+2 -2
View File
@@ -42,7 +42,7 @@ class ImageMathNode(io.ComfyNode):
)
@classmethod
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack=dict()):
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack={}):
input_stream = InputStream(Expression)
lexer = MathExprLexer(input_stream)
@@ -74,7 +74,7 @@ class ImageMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, V, F, Expression, length_mismatch="error",stack=dict()):
def execute(cls, V, F, Expression, length_mismatch="error",stack={}):
# I and F are Autogrow.Type which is dict[str, Any]
# Identify all present tensors and their keys
+2 -2
View File
@@ -57,7 +57,7 @@ class LatentMathNode(io.ComfyNode):
tooltip = cleandoc(__doc__)
@classmethod
def check_lazy_status(cls, Expression, V, F,batching, length_mismatch="tile",stack=dict()):
def check_lazy_status(cls, Expression, V, F,batching, length_mismatch="tile",stack={}):
input_stream = InputStream(Expression)
lexer = MathExprLexer(input_stream)
@@ -89,7 +89,7 @@ class LatentMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, V, F, Expression,batching, length_mismatch="tile",stack=dict()) -> io.NodeOutput:
def execute(cls, V, F, Expression,batching, length_mismatch="tile",stack={}) -> io.NodeOutput:
# Determine reference latent
ref_latent = None
for lat in V.values():
+2 -2
View File
@@ -43,7 +43,7 @@ class MaskMathNode(io.ComfyNode):
)
@classmethod
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack=dict()):
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack={}):
input_stream = InputStream(Expression)
lexer = MathExprLexer(input_stream)
@@ -75,7 +75,7 @@ class MaskMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, V, F, Expression, length_mismatch="tile",stack=dict()):
def execute(cls, V, F, Expression, length_mismatch="tile",stack={}):
# Identify all present tensors and their keys
tensor_keys = [k for k, v in V.items() if v is not None]
if not tensor_keys:
+2 -2
View File
@@ -40,7 +40,7 @@ class ModelMathNode(io.ComfyNode):
tooltip = cleandoc(__doc__)
@classmethod
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack=dict()):
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack={}):
input_stream = InputStream(Expression)
lexer = MathExprLexer(input_stream)
@@ -72,7 +72,7 @@ class ModelMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, V, F, Expression, length_mismatch="tile",stack=dict()) -> io.NodeOutput:
def execute(cls, V, F, Expression, length_mismatch="tile",stack={}) -> io.NodeOutput:
# Determine reference model for cloning
a = V.get("V0")
if a is None:
+2 -2
View File
@@ -42,7 +42,7 @@ class NoiseMathNode(io.ComfyNode):
)
@classmethod
def check_lazy_status(cls, Noise, V, F,stack=dict()):
def check_lazy_status(cls, Noise, V, F,stack={}):
input_stream = InputStream(Noise)
lexer = MathExprLexer(input_stream)
stream = CommonTokenStream(lexer)
@@ -73,7 +73,7 @@ class NoiseMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, Noise, V,F,stack=dict()):
def execute(cls, Noise, V,F,stack={}):
return (NoiseExecutor(V,F, Noise,stack),)
+2 -2
View File
@@ -42,7 +42,7 @@ class SigmasMathNode(io.ComfyNode):
)
@classmethod
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack=dict()):
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack={}):
input_stream = InputStream(Expression)
lexer = MathExprLexer(input_stream)
@@ -74,7 +74,7 @@ class SigmasMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, V, F, Expression, length_mismatch="tile",stack=dict()):
def execute(cls, V, F, Expression, length_mismatch="tile",stack={}):
# I and F are Autogrow.Type which is dict[str, Any]
# Determine reference image for zero-initialization (fallback for a,b,c,d)
+2 -2
View File
@@ -40,7 +40,7 @@ class VAEMathNode(io.ComfyNode):
tooltip = cleandoc(__doc__)
@classmethod
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack=dict()):
def check_lazy_status(cls, Expression, V, F, length_mismatch="tile",stack={}):
input_stream = InputStream(Expression)
lexer = MathExprLexer(input_stream)
@@ -72,7 +72,7 @@ class VAEMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, V, F, Expression, length_mismatch="tile",stack=dict()) -> io.NodeOutput:
def execute(cls, V, F, Expression, length_mismatch="tile",stack={}) -> io.NodeOutput:
# Determine reference VAE
a = V.get("V0")
if a is None:
+2 -2
View File
@@ -43,7 +43,7 @@ class VideoMathNode(io.ComfyNode):
)
@classmethod
def check_lazy_status(cls, Expression,Expression_pi, V, F, length_mismatch="tile",stack=dict()):
def check_lazy_status(cls, Expression,Expression_pi, V, F, length_mismatch="tile",stack={}):
input_stream = InputStream(Expression)
lexer = MathExprLexer(input_stream)
@@ -80,7 +80,7 @@ class VideoMathNode(io.ComfyNode):
return needed1
@classmethod
def execute(cls, V, F, Expression, Expression_pi, length_mismatch="tile",stack=dict()):
def execute(cls, V, F, Expression, Expression_pi, length_mismatch="tile",stack={}):
tensor_keys = [k for k, v in V.items() if v is not None]
if not tensor_keys:
raise ValueError("At least one input is required.")