Fix absolute imports, fix linting issue with dataclass

This commit is contained in:
Benjamin Berman 2025-02-18 19:59:09 -08:00
parent ffc6a7fd38
commit 1e74a4cf08
3 changed files with 37 additions and 7 deletions

View File

@ -191,10 +191,6 @@ class ExportedNodes:
class _ExportedNodesAsChainMap(ExportedNodes):
NODE_CLASS_MAPPINGS: ChainMap[str, CustomNode] = field(default_factory=ChainMap)
NODE_DISPLAY_NAME_MAPPINGS: ChainMap[str, str] = field(default_factory=ChainMap)
EXTENSION_WEB_DIRS: ChainMap[str, str] = field(default_factory=ChainMap)
@classmethod
def from_iter(cls, *exported_nodes: ExportedNodes):
en = _ExportedNodesAsChainMap()

View File

@ -1,9 +1,9 @@
# todo: this should be defined in a common place, the fact that the nodes are imported by execution the way that they are is pretty radioactive
import lazy_object_proxy
from comfy.execution_context import current_execution_context
from comfy.nodes.package import import_all_nodes_in_workspace
from comfy.nodes.package_typing import ExportedNodes, exported_nodes_view
from .execution_context import current_execution_context
from .nodes.package import import_all_nodes_in_workspace
from .nodes.package_typing import ExportedNodes, exported_nodes_view
nodes: ExportedNodes = lazy_object_proxy.Proxy(import_all_nodes_in_workspace)

View File

@ -513,6 +513,40 @@ class IntToFloat(CustomNode):
return float(value),
class IntToString(CustomNode):
@classmethod
def INPUT_TYPES(cls) -> InputTypes:
return {
"required": {
"value": ("INT", {}),
}
}
CATEGORY = "arithmetic"
RETURN_TYPES = ("STRING",)
FUNCTION = "execute"
def execute(self, value: int = 0):
return str(value),
class FloatToString(CustomNode):
@classmethod
def INPUT_TYPES(cls) -> InputTypes:
return {
"required": {
"value": ("FLOAT", {}),
}
}
CATEGORY = "arithmetic"
RETURN_TYPES = ("STRING",)
FUNCTION = "execute"
def execute(self, value: float = 0):
return str(value),
class FloatToInt(CustomNode):
@classmethod
def INPUT_TYPES(cls) -> InputTypes: