aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-08-26 12:25:13 +0300
committerBonfaceKilz2024-08-26 15:35:33 +0300
commitae4bca95b9923be642b3b1f6f7771b7ffce6ed5f (patch)
tree7d001d099ab41a88c3867a664e863479c94f9d64
parentc60d7c9599d8a1d1514f16e7ba7c333270840baa (diff)
downloadgenenetwork3-ae4bca95b9923be642b3b1f6f7771b7ffce6ed5f.tar.gz
Replace map with list comprehension.
* gn3/db/rdf.py (get_wiki_entries_by_symbol): Use list comprehensions. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r--gn3/db/rdf.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/gn3/db/rdf.py b/gn3/db/rdf.py
index 9d6346b..3f4db9b 100644
--- a/gn3/db/rdf.py
+++ b/gn3/db/rdf.py
@@ -102,9 +102,11 @@ CONSTRUCT {
query, context,
sparql_uri
)
- if data := results.get("data"):
- for result in data:
- if result.get("categories"):
- result["categories"] = list(map(str.strip,
- result.get("categories").split(";")))
+ data = results.get("data")
+ if not data:
+ return results
+ for result in data:
+ if result.get("categories"):
+ result["categories"] = [
+ x.strip() for x in result.get("categories").split(";")]
return results