diff --git a/__init__.py b/__init__.py index e2ee80f..e50d074 100644 --- a/__init__.py +++ b/__init__.py @@ -1,7 +1,6 @@ from .nodes.combiner import ETSplitTextNode, ETJoinTextNode from .nodes.converter import ETATOI, ETITOA from .nodes.formatter import ETTextFormatter2Node, ETTextFormatter5Node, ETTextFormatter10Node -from .nodes.scripting import ETPythonTextScript3Node from .nodes.replacer import ETReplaceTextNode et_nodes = { @@ -16,8 +15,6 @@ et_nodes = { ("Text Formatter (10 Arguments)", ETTextFormatter10Node), ("Text Replacer", ETReplaceTextNode), - - ("Python Text Script (3 Arguments)", ETPythonTextScript3Node), } NODE_CLASS_MAPPINGS = {cls.__name__: cls for display_name, cls in et_nodes} diff --git a/nodes/scripting.py b/nodes/scripting.py deleted file mode 100644 index eb23d3c..0000000 --- a/nodes/scripting.py +++ /dev/null @@ -1,50 +0,0 @@ -from typing import Any - - -class AnyType(str): - def __ne__(self, __value: object) -> bool: - return False - - -anyType = AnyType("*") - - -class ETPythonTextScript3Node: - """ - A node that takes a number of arguments and a Python script to execute - them with. Intended as a bruteforce method if no general purpose string - utility nodes are available for a certain function. - """ - - @classmethod - def INPUT_TYPES(s): - return { - "required": { - "script": ("STRING", {"multiline": True, "tooltip": "A python script to execute. Gets access to arg0~2 and may return text via a result variable."}), - }, - "optional": { - "arg0": (anyType, {"forceInput": True, "tooltip": "An argument passed to the script. Value is None if not connected."}), - "arg1": (anyType, {"forceInput": True, "tooltip": "An argument passed to the script. Value is None if not connected."}), - "arg2": (anyType, {"forceInput": True, "tooltip": "An argument passed to the script. Value is None if not connected."}), - }, - } - - RETURN_TYPES = ("STRING",) - RETURN_NAMES = ("text",) - - CATEGORY = "exectails" - FUNCTION = "process" - - def process(self, script, arg0=None, arg1=None, arg2=None) -> tuple: - - localVars = {} - result = exec(script, {"arg0": arg0, "arg1": arg1, "arg2": arg2}, localVars) - - result = None - if "result" in localVars: - result = str(localVars["result"]) - - return (result,) - - def flatten(self, value: list) -> str: - return " ".join([str(s) for s in value])