@@ -45,7 +45,7 @@ class JsonUtility:
45
45
46
46
def __init__ (self , output_path : str , output_overwrite : bool = False ):
47
47
self .input_paths = None
48
- self .variables = None
48
+ self .variables = { "inputs" : {}, "outputs" : {}, "metas" : {}}
49
49
self .data = []
50
50
self .test_plan = None
51
51
self .scenario = None
@@ -65,6 +65,7 @@ def set_paths(self, json_path: str, dag_path: str, data_paths: str):
65
65
def setup (self , scenario : Scenario ):
66
66
"""Function to populate all the necessary parts of the json_class needed to execute tests"""
67
67
self .scenario = scenario
68
+ self ._get_scenario_variables ()
68
69
self .scenario .setup_treatment_variables ()
69
70
self .causal_specification = CausalSpecification (
70
71
scenario = self .scenario , causal_dag = CausalDAG (self .input_paths .dag_path )
@@ -232,6 +233,14 @@ def _append_to_file(self, line: str, log_level: int = None):
232
233
if log_level :
233
234
logger .log (level = log_level , msg = line )
234
235
236
+ def _get_scenario_variables (self ):
237
+ for input in self .scenario .inputs ():
238
+ self .variables ["inputs" ][input .name ] = input
239
+ for output in self .scenario .outputs ():
240
+ self .variables ["outputs" ][output .name ] = output
241
+ for meta in self .scenario .metas ():
242
+ self .variables ["metas" ][meta .name ] = meta
243
+
235
244
@staticmethod
236
245
def check_file_exists (output_path : Path , overwrite : bool ):
237
246
"""Method that checks if the given path to an output file already exists. If overwrite is true the check is
@@ -262,7 +271,7 @@ def get_args(test_args=None) -> argparse.Namespace:
262
271
parser .add_argument (
263
272
"-w" ,
264
273
help = "Specify to overwrite any existing output files. This can lead to the loss of existing outputs if not "
265
- "careful" ,
274
+ "careful" ,
266
275
action = "store_true" ,
267
276
)
268
277
parser .add_argument (
0 commit comments