From ae4bca95b9923be642b3b1f6f7771b7ffce6ed5f Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Mon, 26 Aug 2024 12:25:13 +0300 Subject: Replace map with list comprehension. * gn3/db/rdf.py (get_wiki_entries_by_symbol): Use list comprehensions. Signed-off-by: Munyoki Kilyungi --- gn3/db/rdf.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gn3') 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 -- cgit v1.2.3