aboutsummaryrefslogtreecommitdiff
path: root/gn3/db
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-09-23 12:05:52 +0300
committerBonfaceKilz2024-09-23 12:32:51 +0300
commit05735bad5a38f47b6e30b05dc4fc754de3fbcbd6 (patch)
treea08b647626b08221bff27a829769829eaee59628 /gn3/db
parent509c8d0bf8b4c36d3efcb9d70d401baa740911b0 (diff)
downloadgenenetwork3-05735bad5a38f47b6e30b05dc4fc754de3fbcbd6.tar.gz
Revert "Remove one-line if/else statement."
This reverts commit 0d15840913c9cc401d1e74295aa5e17e34f2987b. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3/db')
-rw-r--r--gn3/db/rdf/wiki.py8
1 files changed, 4 insertions, 4 deletions
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"] = [