refactor: func modules -> static methods right within nodes

This commit is contained in:
Lex Darlog (DRL)
2025-07-27 05:18:07 +05:00
parent 7dc5ee2fd8
commit e4e6fb918b
13 changed files with 238 additions and 278 deletions
+12 -5
View File
@@ -13,7 +13,7 @@ from comfy.comfy_types.node_typing import IO as _IO
from . import _meta
from .docstring_formatter import format_docstring as _format_docstring
from .enums import DataTypes as _DataTypes
from .funcs_dict_add_string import set_dict_string as _set_dict_string
from .funcs_common import _new_dict_with_updated_key, _T
# A tiny optimization by reusing the same immutable dict:
@@ -52,9 +52,16 @@ class StringConstructorDictAddString:
def INPUT_TYPES(cls):
return _input_types
@staticmethod
def main(
self, name: str, cleanup: bool, string: str,
dict: _t.Dict[str, _t.Any] = None,
name: str, cleanup: bool, string: str,
dict: _t.Dict[str, _T] = None,
# unique_id: str = None,
):
return _set_dict_string(name, string, strip_lines=cleanup, in_dict=dict)
) -> _t.Tuple[_t.Dict[str, _t.Union[_T, str]]]:
"""Update/append a string to the dict."""
string = '' if string is None else str(string)
if cleanup:
string = '\n'.join(
x.strip() for x in string.splitlines()
)
return (_new_dict_with_updated_key(dict, name, string), )