rename data type to just DICT - for compatibility with other nodes
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
+3
-3
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user