combine fft filter into a single node, fix tests

This commit is contained in:
2026-03-29 17:42:04 -07:00
parent f2be62ac46
commit d94e92666d
12 changed files with 205 additions and 3593 deletions

View File

@@ -15,28 +15,38 @@ NODE_CLASS_MAPPINGS: dict[str, type] = {}
NODE_DISPLAY_NAME_MAPPINGS: dict[str, str] = {}
def get_node_output_specs(cls: type) -> tuple[tuple[str, str], ...]:
def get_node_output_specs(cls: type) -> tuple[tuple[str, str, dict], ...]:
raw_outputs = getattr(cls, "OUTPUTS", None)
if raw_outputs is None:
raise AttributeError(f"{cls.__name__} must define OUTPUTS.")
specs: list[tuple[str, str]] = []
specs: list[tuple[str, str, dict]] = []
for index, output in enumerate(raw_outputs):
if not isinstance(output, (list, tuple)) or len(output) != 2:
if not isinstance(output, (list, tuple)) or len(output) not in (2, 3):
raise TypeError(
f"{cls.__name__}.OUTPUTS[{index}] must be a 2-item tuple of (type, name)."
f"{cls.__name__}.OUTPUTS[{index}] must be a 2- or 3-item tuple of (type, name[, meta])."
)
type_name, name = output
specs.append((str(type_name), str(name)))
type_name = output[0]
name = output[1]
meta: dict = output[2] if len(output) == 3 else {}
specs.append((str(type_name), str(name), meta))
return tuple(specs)
def get_node_output_types(cls: type) -> tuple[str, ...]:
return tuple(type_name for type_name, _ in get_node_output_specs(cls))
return tuple(type_name for type_name, _, _meta in get_node_output_specs(cls))
def get_node_output_names(cls: type) -> tuple[str, ...]:
return tuple(name for _, name in get_node_output_specs(cls))
return tuple(name for _, name, _meta in get_node_output_specs(cls))
def get_node_output_accepted_types(cls: type) -> tuple[list[str], ...]:
"""Return per-slot accepted_types lists (empty list means only the declared type)."""
return tuple(
list(meta.get("accepted_types", []))
for _, _, meta in get_node_output_specs(cls)
)
def register_node(display_name: str | None = None):
@@ -77,6 +87,7 @@ def get_node_info(class_name: str) -> dict[str, Any]:
"input_order": {k: list(v.keys()) for k, v in input_types.items()},
"output": list(get_node_output_types(cls)),
"output_name": list(get_node_output_names(cls)),
"output_accepted_types": list(get_node_output_accepted_types(cls)),
"output_node": bool(getattr(cls, "OUTPUT_NODE", False)),
"manual_trigger": bool(getattr(cls, "MANUAL_TRIGGER", False)),
"description": getattr(cls, "DESCRIPTION", ""),