Skip to content

Commit

Permalink
FIX transformer loader now outputs a dictionary per column instead of…
Browse files Browse the repository at this point in the history
… the usual dict output
  • Loading branch information
mathysgrapotte committed Jan 17, 2025
1 parent 3f64f18 commit d15cd01
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/stimulus/data/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ def set_data_transformer_as_attribute(self, field_name: str, data_transformer: A
field_name (str): The name of the field to set the data transformer for
data_transformer (Any): The data transformer to set
"""
setattr(self, field_name, {"data_transformation_generators": data_transformer})
# check if the field already exists, if it does not, initialize it to an empty dict
if not hasattr(self, field_name):
setattr(self, field_name, {data_transformer.__class__.__name__: data_transformer})
else:
self.field_name[data_transformer.__class__.__name__] = data_transformer

def initialize_column_data_transformers_from_config(self, transform_config: yaml_data.YamlTransform) -> None:
"""Build the loader from a config dictionary.
Expand Down

0 comments on commit d15cd01

Please sign in to comment.