MCPcopy
hub / github.com/pythongosssss/ComfyUI-Custom-Scripts / write_text

Method write_text

py/text_files.py:182–193  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

180 FUNCTION = "write_text"
181
182 def write_text(self, **kwargs):
183 self.file = get_file(kwargs["root_dir"], kwargs["file"])
184 if kwargs["append"] == "new only" and os.path.exists(self.file):
185 raise FileExistsError(
186 self.file + " already exists and 'new only' is selected.")
187 with open(self.file, "a+" if kwargs["append"] == "append" else "w") as f:
188 is_append = f.tell() != 0
189 if is_append and kwargs["insert"]:
190 f.write("\n")
191 f.write(kwargs["text"])
192
193 return super().load_text(**kwargs)
194
195
196NODE_CLASS_MAPPINGS = {

Callers

nothing calls this directly

Calls 2

get_fileFunction · 0.85
load_textMethod · 0.80

Tested by

no test coverage detected