def _is_classifier_incident_types_found(self, classifier_data): """Check if the classifier incident types were found Args: classifier_data (dict): Dictionary that holds the extracted details from the given classfier. Returns: bool. Whether the classifier related incident types are found. """ is_valid = True classifier_incident_types = set( classifier_data.get('incident_types', set())) if classifier_incident_types: # setting initially to false, if the incident types is in the id_set, it will be valid is_valid = False for incident_type in self.incident_types_set: incident_type_name = list(incident_type.keys())[0] # remove a related incident types if exists in the id_set if incident_type_name in classifier_incident_types: classifier_incident_types.remove(incident_type_name) if not classifier_incident_types: break if not classifier_incident_types: # if nothing remains, these incident types were all found is_valid = True else: # there are missing incident types in the id_set, classifier is invalid error_message, error_code = Errors.classifier_non_existent_incident_types( str(classifier_incident_types)) if not self.handle_error( error_message, error_code, file_path="id_set.json"): is_valid = True return is_valid