diff --git a/scripts/remove-classifier-keywords/script.py b/scripts/remove-classifier-keywords/script.py index f697766..f9649d4 100644 --- a/scripts/remove-classifier-keywords/script.py +++ b/scripts/remove-classifier-keywords/script.py @@ -1,16 +1,20 @@ from inspire_utils.record import get_value from inspirehep.curation.search_check_do import SearchCheckDo + class RemoveClassifierKeywords(SearchCheckDo): query = "keywords.source:classifier" @staticmethod def check(record, logger, state): - if any(keyword.get("source", "") == "classifier" for keyword in get_value(record, "keywords", [])): - return True + if any( + keyword.get("source", "") == "classifier" + for keyword in get_value(record, "keywords", []) + ): + return True else: - return False - + return False + @staticmethod def do(record, logger, state): for keyword in record.get("keywords", []): @@ -19,4 +23,5 @@ def do(record, logger, state): if not record["keywords"]: record.pop("keywords") + RemoveClassifierKeywords()