diff --git a/pyproject.toml b/pyproject.toml index fc3343fe9..d8c4f3e5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,6 +44,7 @@ target-version = "py38" "tests/library/test_loaders.py" = ["N802", "N803"] "tests/library/test_dataclass.py" = ["F811"] "src/unitxt/validate.py" = ["B024"] +"src/unitxt/standard.py" = ["C901"] "src/unitxt/type_utils.py" = ["C901"] "src/unitxt/dataclass.py" = ["C901"] "src/unitxt/operators.py" = ["C901"] diff --git a/src/unitxt/standard.py b/src/unitxt/standard.py index 857ea8ddd..5f7cfba4d 100644 --- a/src/unitxt/standard.py +++ b/src/unitxt/standard.py @@ -187,6 +187,11 @@ def produce(self, task_instances): return list(multi_stream["__inference__"]) def prepare(self): + # To avoid the Python's mutable default list trap, we set the default value to None + # and then set it to an empty list if it is None. + if self.card.preprocess_steps is None: + self.card.preprocess_steps = [] + self.set_pipelines() loader = self.card.loader