CC_flows / src /data_transformations /correctness_flag.py
martinjosifoski's picture
Fix bugs, clean code, bring everything up-to-date and standardize a bit more.
f748a3e
raw
history blame
521 Bytes
from typing import Dict, Any
from flows.data_transformations.abstract import DataTransformation
class CorrectnessFlag(DataTransformation):
def __init__(self, output_key, input_key):
super().__init__(output_key)
self.input_key = input_key
def __call__(self, data_dict: Dict[str, Any], **kwargs) -> Dict[str, Any]:
all_tests_passed = all([test_result["status"] for test_result in data_dict[self.input_key]])
data_dict[self.output_key] = all_tests_passed
return data_dict