aboutsummaryrefslogtreecommitdiff
path: root/gn3/api
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-09-05 14:41:41 +0300
committerBonfaceKilz2023-09-05 14:57:51 +0300
commit8bb89dd929506af37675ed5e65737ac79ca0678e (patch)
tree36c7bcdaefc62b33e1710d02d50df8f901c7c120 /gn3/api
parentbf8296c5c3093aef32a5cd91fb008ad257e7a2f1 (diff)
downloadgenenetwork3-8bb89dd929506af37675ed5e65737ac79ca0678e.tar.gz
Fix C3001: Lambda expression assigned to a variable
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3/api')
-rw-r--r--gn3/api/search.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/gn3/api/search.py b/gn3/api/search.py
index aa844ee..c741b15 100644
--- a/gn3/api/search.py
+++ b/gn3/api/search.py
@@ -152,7 +152,8 @@ def parse_position_field(location_slot: int, query: bytes) -> xapian.Query:
"""Parse position and return a xapian query."""
start, end = parse_position(query.decode("utf-8"))
# TODO: Convert the xapian index to use bases instead of megabases.
- to_megabases = lambda x: str(Decimal(x)/10**6)
+ def to_megabases(val):
+ return str(Decimal(val)/10**6)
return (xapian.NumberRangeProcessor(location_slot)
(start.maybe("", to_megabases), end.maybe("", to_megabases))) # type: ignore
@@ -176,7 +177,8 @@ def parse_location_field(species_query: xapian.Query,
def make_query(interval: ChromosomalInterval) -> xapian.Query:
# TODO: Convert the xapian index to use bases instead of megabases.
- to_megabases = lambda x: str(Decimal(x)/10**6)
+ def to_megabases(val):
+ return str(Decimal(val)/10**6)
return combine_queries(xapian.Query.OP_AND,
species_query,
xapian.Query(chromosome_prefix + interval.chromosome),