From 3683a610e2a7107664df67f07b40bb02dd3cdf18 Mon Sep 17 00:00:00 2001 From: "Lex Darlog (DRL)" <3897975+Lex-DRL@users.noreply.github.com> Date: Mon, 21 Jul 2025 20:11:10 +0500 Subject: [PATCH] rename data type to just `DICT` - for compatibility with other nodes --- CHANGELOG.md | 2 ++ enums.py | 6 +++--- node_dict_add_any.py | 10 +++++----- node_dict_add_string.py | 10 +++++----- node_dict_from_text.py | 10 +++++----- node_dict_preview.py | 10 +++++----- node_formatter.py | 6 +++--- 7 files changed, 28 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3feb02..8aedfda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ The minimally-complete version. New node: - `Add ANY to Format-Dict (Advanced)` +The Format-Dict data type name changed from `STR_DICT` to just `DICT` - for potential compatibility with other nodes. + # v0.0.1 MVP nodes: diff --git a/enums.py b/enums.py index 8bbbc83..5c759b0 100644 --- a/enums.py +++ b/enums.py @@ -22,7 +22,7 @@ class __BaseEnum(_StrEnum): class DataTypes(__BaseEnum): """Additional data-types defined byt the node pack.""" - STR_DICT = 'STR_DICT' + DICT = 'DICT' @staticmethod def __custom_input_type_dict(_dict_args: _t.Tuple[_t.Dict[str, T], ...], kwargs: _t.Dict[str, T]) -> _t.Dict[str, T]: @@ -34,5 +34,5 @@ class DataTypes(__BaseEnum): return res_dict @classmethod - def input_str_dict(cls, *_dicts: _t.Dict[str, T], **kwargs: T) -> _t.Tuple[_t.Union['DataTypes', str], _t.Dict[str, T]]: - return cls.STR_DICT, cls.__custom_input_type_dict(_dicts, kwargs) + def input_dict(cls, *_dicts: _t.Dict[str, T], **kwargs: T) -> _t.Tuple[_t.Union['DataTypes', str], _t.Dict[str, T]]: + return cls.DICT, cls.__custom_input_type_dict(_dicts, kwargs) diff --git a/node_dict_add_any.py b/node_dict_add_any.py index 93f912c..3196607 100644 --- a/node_dict_add_any.py +++ b/node_dict_add_any.py @@ -26,7 +26,7 @@ _input_types = _deepfreeze({ )}), }, 'optional': { - 'str_dict': _input_types_str['optional']['str_dict'], + 'dict': _input_types_str['optional']['dict'], 'value': (_IO.ANY, {"forceInput": True, 'tooltip': "The actual non-string item to add into the dict."}), }, # 'hidden': { @@ -42,8 +42,8 @@ class StringConstructorDictAddAny: DESCRIPTION = _format_docstring(_cleandoc(__doc__)) FUNCTION = 'main' - RETURN_TYPES = (_DataTypes.STR_DICT, ) - RETURN_NAMES = (_DataTypes.STR_DICT.lower(), ) + RETURN_TYPES = (_DataTypes.DICT, ) + RETURN_NAMES = (_DataTypes.DICT.lower(), ) # OUTPUT_TOOLTIPS = tuple() @classmethod @@ -52,7 +52,7 @@ class StringConstructorDictAddAny: def main( self, name: str, value: _t.Any = None, - str_dict: _t.Dict[str, _t.Any] = None, + dict: _t.Dict[str, _t.Any] = None, # unique_id: str = None, ): - return _set_dict_any_type_item(name, value, in_dict=str_dict) + return _set_dict_any_type_item(name, value, in_dict=dict) diff --git a/node_dict_add_string.py b/node_dict_add_string.py index 58d9c44..6de5a1c 100644 --- a/node_dict_add_string.py +++ b/node_dict_add_string.py @@ -29,7 +29,7 @@ _input_types = _deepfreeze({ 'string': (_IO.STRING, {'multiline': True, 'tooltip': "The actual sub-string to add into the dict."}), }, 'optional': { - 'str_dict': _DataTypes.input_str_dict(tooltip="An optional Format-Dictionary to extend/update."), + 'dict': _DataTypes.input_dict(tooltip="An optional Format-Dictionary to extend/update."), }, # 'hidden': { # 'unique_id': 'UNIQUE_ID', # used for text display at the bottom of the node @@ -44,8 +44,8 @@ class StringConstructorDictAddString: DESCRIPTION = _format_docstring(_cleandoc(__doc__)) FUNCTION = 'main' - RETURN_TYPES = (_DataTypes.STR_DICT, ) - RETURN_NAMES = (_DataTypes.STR_DICT.lower(), ) + RETURN_TYPES = (_DataTypes.DICT, ) + RETURN_NAMES = (_DataTypes.DICT.lower(), ) # OUTPUT_TOOLTIPS = tuple() @classmethod @@ -54,7 +54,7 @@ class StringConstructorDictAddString: def main( self, name: str, cleanup: bool, string: str, - str_dict: _t.Dict[str, _t.Any] = None, + dict: _t.Dict[str, _t.Any] = None, # unique_id: str = None, ): - return _set_dict_string(name, string, strip_lines=cleanup, in_dict=str_dict) + return _set_dict_string(name, string, strip_lines=cleanup, in_dict=dict) diff --git a/node_dict_from_text.py b/node_dict_from_text.py index 62db62f..95ecb24 100644 --- a/node_dict_from_text.py +++ b/node_dict_from_text.py @@ -33,7 +33,7 @@ _input_types = _deepfreeze({ )}), }, 'optional': { - 'str_dict': _input_types_str['optional']['str_dict'], + 'dict': _input_types_str['optional']['dict'], }, 'hidden': { 'unique_id': 'UNIQUE_ID', # used for text display at the bottom of the node @@ -52,8 +52,8 @@ class StringConstructorDictFromText: OUTPUT_NODE = True # Just to show the status message even if not connected to anything FUNCTION = 'main' - RETURN_TYPES = (_DataTypes.STR_DICT, ) - RETURN_NAMES = (_DataTypes.STR_DICT.lower(), ) + RETURN_TYPES = (_DataTypes.DICT, ) + RETURN_NAMES = (_DataTypes.DICT.lower(), ) # OUTPUT_TOOLTIPS = tuple() @classmethod @@ -62,7 +62,7 @@ class StringConstructorDictFromText: def main( self, cleanup: bool, strings: str, show_status: bool, - str_dict: _t.Dict[str, _t.Any] = None, + dict: _t.Dict[str, _t.Any] = None, unique_id: str = None, ): - return _parse_dict_from_text(strings, strip_lines=cleanup, show=show_status, in_dict=str_dict, unique_id=unique_id) + return _parse_dict_from_text(strings, strip_lines=cleanup, show=show_status, in_dict=dict, unique_id=unique_id) diff --git a/node_dict_preview.py b/node_dict_preview.py index 48b17dd..f5c4d21 100644 --- a/node_dict_preview.py +++ b/node_dict_preview.py @@ -17,7 +17,7 @@ from .funcs_dict_preview import preview_str_dict as _preview_str_dict # A tiny optimization by reusing the same immutable dict: _input_types = _deepfreeze({ 'required': { - 'str_dict': _DataTypes.input_str_dict(tooltip="A Format-Dictionary."), + 'dict': _DataTypes.input_dict(tooltip="A Format-Dictionary."), }, # 'optional': {}, 'hidden': { @@ -37,8 +37,8 @@ class StringConstructorDictPreview: OUTPUT_NODE = True FUNCTION = 'main' - RETURN_TYPES = (_DataTypes.STR_DICT, ) - RETURN_NAMES = (_DataTypes.STR_DICT.lower(), ) + RETURN_TYPES = (_DataTypes.DICT, ) + RETURN_NAMES = (_DataTypes.DICT.lower(), ) # OUTPUT_TOOLTIPS = tuple() @classmethod @@ -46,7 +46,7 @@ class StringConstructorDictPreview: return _input_types def main( - self, str_dict: _t.Dict[str, _t.Any], + self, dict: _t.Dict[str, _t.Any], unique_id: str = None, ): - return _preview_str_dict(str_dict, unique_id=unique_id) + return _preview_str_dict(dict, unique_id=unique_id) diff --git a/node_formatter.py b/node_formatter.py index c80fed2..79fc978 100644 --- a/node_formatter.py +++ b/node_formatter.py @@ -30,7 +30,7 @@ _input_types = _deepfreeze({ )}), }, 'optional': { - 'str_dict': _DataTypes.input_str_dict(tooltip=( + 'dict': _DataTypes.input_dict(tooltip=( "The dictionary to take named sub-strings from. It could be left unconnected, if the pattern doesn't reference " "any sub-strings - then, this node acts exactly the same as a regular string-primitive node." )), @@ -62,7 +62,7 @@ class StringConstructorFormatter: def main( self, template: str, show_status: bool, - str_dict: _t.Dict[str, _t.Any] = None, + dict: _t.Dict[str, _t.Any] = None, unique_id: str = None, ): - return _formatter(template, str_dict, show=show_status, unique_id=unique_id) + return _formatter(template, dict, show=show_status, unique_id=unique_id)