File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,7 @@ def run_ad(args):
96
96
def get_model_definition (model_key ):
97
97
"""Get the model definition from the Julia script."""
98
98
lines = []
99
+ submodels = []
99
100
record = False
100
101
with open ("models.jl" , "r" ) as file :
101
102
for line in file :
@@ -104,8 +105,14 @@ def get_model_definition(model_key):
104
105
record = True
105
106
if record :
106
107
lines .append (line )
107
- if record and line .strip () == "end" :
108
- break
108
+
109
+ if "to_submodel" in line :
110
+ submodel_name = line .split ("to_submodel(" )[1 ].split ("(" )[0 ]
111
+ submodels .append (submodel_name )
112
+ if line == "end" :
113
+ break
114
+ for submodel in submodels :
115
+ lines = [get_model_definition (submodel ), * lines ]
109
116
return "<br>" .join (lines )
110
117
111
118
You can’t perform that action at this time.
0 commit comments