From 3307933ae86edc6e0f7cd07681e68554a3029659 Mon Sep 17 00:00:00 2001 From: tlakshmi Date: Thu, 21 Nov 2024 13:34:43 +0100 Subject: [PATCH] minor self fix --- pyironflow/create_macro.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyironflow/create_macro.py b/pyironflow/create_macro.py index 469088b8..adaaef34 100644 --- a/pyironflow/create_macro.py +++ b/pyironflow/create_macro.py @@ -71,14 +71,14 @@ def custom(wf = dict, name = str, root_path='../pyiron_nodes/pyiron_nodes'): from typing import Optional @as_macro_node() -def ''' + name + '''(wf, ''' + var_def + '''): +def ''' + name + '''(self, ''' + var_def + '''): ''') for j in imports: file.write(j + "\n") for i, (k, v) in enumerate(wf.children.items()): rest, n = get_import_path(v).rsplit('.', 1) - file.write(" wf." + v.label + " = " + n + "()\n") + file.write(" self." + v.label + " = " + n + "()\n") for i, (k, v) in enumerate(wf.children.items()): rest, n = get_import_path(v).rsplit('.', 1) @@ -92,13 +92,13 @@ def ''' + name + '''(wf, ''' + var_def + '''): for p in new_list: if v.label == p[1]: - node_def = node_def + p[2] + " = wf."+ p[0] + ", " + node_def = node_def + p[2] + " = self."+ p[0] + ", " node_def = node_def[:-2] - file.write(" wf." + v.label + ".set_input_values" + "(" + node_def + ")\n") + file.write(" self." + v.label + ".set_input_values" + "(" + node_def + ")\n") rest, n = list(wf.outputs.channel_dict.keys())[0].rsplit('__', 1) - file.write(" return wf." + rest) + file.write(" return self." + rest) print("\nSuccessfully created macro: " + root_path + '/' + name + '.py') file.close()