diff options
Diffstat (limited to 'gn3')
-rw-r--r-- | gn3/db/rdf/wiki.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gn3/db/rdf/wiki.py b/gn3/db/rdf/wiki.py index 4464eed..6624886 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] if categories else [] + result["categories"] = [categories] result["categories"] = sorted(result["categories"]) - pmids = result.get("pubmed_ids") + pmids = result.get("pubmed_ids", []) if isinstance(pmids, str): - result["pubmed_ids"] = [pmids] if pmids else [] + result["pubmed_ids"] = [pmids] if isinstance(pmids, int): result["pubmed_ids"] = [pmids] result["pubmed_ids"] = [ |