mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
## Summary
Refactored monolithic devtools node definitions into organized module
structure for better maintainability and separation of concerns.
## Changes
- **What**: Split 700+ line `dev_nodes.py` into modular structure under
`tools/devtools/nodes/` with categorized files: `errors.py`,
`inputs.py`, `models.py`, `remote.py`
- **Dependencies**: None
## Review Focus
Module import structure and ensure all node registrations are properly
preserved in the consolidated mappings.
**Before:**
```
tools/devtools/
├── __init__.py
└── dev_nodes.py (738 lines)
```
**After:**
```
tools/devtools/
├── __init__.py
├── dev_nodes.py (65 lines - imports only)
└── nodes/
├── __init__.py (consolidated mappings)
├── errors.py (error/debug nodes)
├── inputs.py (input/widget nodes)
├── models.py (model/patch nodes)
└── remote.py (remote/combo nodes)
```
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6020-refactor-reorganize-devtools-test-nodes-into-modules-2896d73d365081e89efef7e88ca8fee3)
by [Unito](https://www.unito.io)
90 lines
2.1 KiB
Python
90 lines
2.1 KiB
Python
from __future__ import annotations
|
|
|
|
|
|
class ErrorRaiseNode:
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {"required": {}}
|
|
|
|
RETURN_TYPES = ("IMAGE",)
|
|
FUNCTION = "raise_error"
|
|
CATEGORY = "DevTools"
|
|
DESCRIPTION = "Raise an error for development purposes"
|
|
|
|
def raise_error(self):
|
|
raise Exception("Error node was called!")
|
|
|
|
|
|
class ErrorRaiseNodeWithMessage:
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {"required": {"message": ("STRING", {"multiline": True})}}
|
|
|
|
RETURN_TYPES = ()
|
|
OUTPUT_NODE = True
|
|
|
|
FUNCTION = "raise_error"
|
|
CATEGORY = "DevTools"
|
|
DESCRIPTION = "Raise an error with message for development purposes"
|
|
|
|
def raise_error(self, message: str):
|
|
raise Exception(message)
|
|
|
|
|
|
class ExperimentalNode:
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {"required": {}}
|
|
|
|
RETURN_TYPES = ()
|
|
OUTPUT_NODE = True
|
|
FUNCTION = "experimental_function"
|
|
CATEGORY = "DevTools"
|
|
DESCRIPTION = "A experimental node"
|
|
|
|
EXPERIMENTAL = True
|
|
|
|
def experimental_function(self):
|
|
print("Experimental node was called!")
|
|
|
|
|
|
class DeprecatedNode:
|
|
@classmethod
|
|
def INPUT_TYPES(cls):
|
|
return {"required": {}}
|
|
|
|
RETURN_TYPES = ()
|
|
OUTPUT_NODE = True
|
|
FUNCTION = "deprecated_function"
|
|
CATEGORY = "DevTools"
|
|
DESCRIPTION = "A deprecated node"
|
|
|
|
DEPRECATED = True
|
|
|
|
def deprecated_function(self):
|
|
print("Deprecated node was called!")
|
|
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"DevToolsErrorRaiseNode": ErrorRaiseNode,
|
|
"DevToolsErrorRaiseNodeWithMessage": ErrorRaiseNodeWithMessage,
|
|
"DevToolsExperimentalNode": ExperimentalNode,
|
|
"DevToolsDeprecatedNode": DeprecatedNode,
|
|
}
|
|
|
|
NODE_DISPLAY_NAME_MAPPINGS = {
|
|
"DevToolsErrorRaiseNode": "Raise Error",
|
|
"DevToolsErrorRaiseNodeWithMessage": "Raise Error with Message",
|
|
"DevToolsExperimentalNode": "Experimental Node",
|
|
"DevToolsDeprecatedNode": "Deprecated Node",
|
|
}
|
|
|
|
__all__ = [
|
|
"ErrorRaiseNode",
|
|
"ErrorRaiseNodeWithMessage",
|
|
"ExperimentalNode",
|
|
"DeprecatedNode",
|
|
"NODE_CLASS_MAPPINGS",
|
|
"NODE_DISPLAY_NAME_MAPPINGS",
|
|
]
|