Files
daxcay-ComfyUI-DataSet/classes/DataSet_FindAndReplace.py
T
daxcay e8752c4f71 Major update
Made changes to make nodes more cohesive
2024-07-05 09:04:31 +05:30

37 lines
1016 B
Python

class DataSet_FindAndReplace:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"TextFileContents": ("STRING", {"forceInput": True}),
"SearchFor": ("STRING", {"multiline": True, "default": "concept"}),
"ReplaceWith": ("STRING", {"multiline": True, "default": "concept"})
},
}
INPUT_IS_LIST = True
RETURN_TYPES = ("STRING", )
RETURN_NAMES = ("TextFileContents",)
OUTPUT_IS_LIST = (True,)
FUNCTION = "SaR"
OUTPUT_NODE = True
CATEGORY = "🔶DATASET🔶"
def SaR(self, TextFileContents, SearchFor, ReplaceWith):
edited = []
for content in TextFileContents:
edited.append(content.replace(SearchFor[0], ReplaceWith[0]))
return (edited,)
N_CLASS_MAPPINGS = {
"DataSet_FindAndReplace": DataSet_FindAndReplace,
}
N_DISPLAY_NAME_MAPPINGS = {
"DataSet_FindAndReplace": "DataSet_FindAndReplace",
}