From 05735bad5a38f47b6e30b05dc4fc754de3fbcbd6 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Mon, 23 Sep 2024 12:05:52 +0300 Subject: Revert "Remove one-line if/else statement." This reverts commit 0d15840913c9cc401d1e74295aa5e17e34f2987b. Signed-off-by: Munyoki Kilyungi --- gn3/db/rdf/wiki.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gn3/db') diff --git a/gn3/db/rdf/wiki.py b/gn3/db/rdf/wiki.py index 6624886..4464eed 100644 --- a/gn3/db/rdf/wiki.py +++ b/gn3/db/rdf/wiki.py @@ -40,13 +40,13 @@ def __sanitize_result(result: dict) -> dict: """Make sure `categories` and `pubmed_ids` are always arrays""" if not result: return {} - categories = result.get("categories", []) + categories = result.get("categories") if isinstance(categories, str): - result["categories"] = [categories] + result["categories"] = [categories] if categories else [] result["categories"] = sorted(result["categories"]) - pmids = result.get("pubmed_ids", []) + pmids = result.get("pubmed_ids") if isinstance(pmids, str): - result["pubmed_ids"] = [pmids] + result["pubmed_ids"] = [pmids] if pmids else [] if isinstance(pmids, int): result["pubmed_ids"] = [pmids] result["pubmed_ids"] = [ -- cgit v1.2.3