class DataChecker: """ The general DataChecker class :param data: Any variable that needs to be verified :attribute data: stores the provided data :attribute dtype: stores the type of the provided data :attribute errors: stores a list of generated errors """ def __init__(self, data): self.data = data self.d_type = type(data) self.errors = [] def save_error(self, error: str): """ Saving the error message :param error: error message :return: """ self.errors.append(error) def generate_response(self) -> dict: """ Checks all the errors and generates resonse dict :return: Dictionary {'check_passed': bool, 'message':str} """ if len(self.errors) > 0: check_passed = False else: check_passed = True return {"check_passed": check_passed, "message": ", ".join(self.errors)}