Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def new_input_types(*args, **kwargs):
# Reflection is used to determine what the function signature is, so we can't just change the function signature
raise NotImplementedError("VariantSupport does not support VALIDATE_INPUTS yet")
else:
def validate_inputs(input_types):
inputs = cls.INPUT_TYPES()
def validate_individual(input_types, inputs):
for key, value in input_types.items():
if isinstance(value, SmartType):
continue
Expand All @@ -47,6 +46,17 @@ def validate_inputs(input_types):
if expected_type is not None and MakeSmartType(value) != expected_type:
return f"Invalid type of {key}: {value} (expected {expected_type})"
return True
def validate_inputs(input_types):
inputs = cls.INPUT_TYPES()
if isinstance(input_types, list):
for input_type in input_types:
responce = validate_individual(input_type, inputs)
Copy link
Copy Markdown
Contributor

@guill guill Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you fix the typo responce -> response? (I tried to change it myself, but it looks like the option for allowing maintainers to edit this PR was turned off.)

if isinstance(responce, str):
return responce
return True
else:
return validate_individual(input_types, inputs)

Comment on lines +49 to +59
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def validate_inputs(input_types):
inputs = cls.INPUT_TYPES()
if isinstance(input_types, list):
for input_type in input_types:
responce = validate_individual(input_type, inputs)
if isinstance(responce, str):
return responce
return True
else:
return validate_individual(input_types, inputs)
def validate_inputs(input_types):
inputs = cls.INPUT_TYPES()
if isinstance(input_types, list):
for input_type in input_types:
response = validate_individual(input_type, inputs)
if isinstance(response, str):
return response
return True
else:
return validate_individual(input_types, inputs)

setattr(cls, "VALIDATE_INPUTS", validate_inputs)
return cls
return decorator
Expand Down
2 changes: 1 addition & 1 deletion utility_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def INPUT_TYPES(cls):
}

RETURN_TYPES = ("ACCUMULATION",)
INPUT_IS_LIST = (True,)
INPUT_IS_LIST = True

FUNCTION = "list_to_accumulation"

Expand Down