diff options
author | Frederick Muriuki Muriithi | 2023-07-10 11:36:47 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-07-10 11:36:47 +0300 |
commit | c6ac30d4ccc26553a12e8c37cdf9078cbe9084b3 (patch) | |
tree | a40cea1c2b129e0e37b70d42c6f87fe51a5ec178 /gn3/api/search.py | |
parent | edebea34ac6545909737ce9540e9d51858550873 (diff) | |
download | genenetwork3-migrate-to-python3.10.tar.gz |
Fix linting errors caused by bump to Python 3.10migrate-to-python3.10
Diffstat (limited to 'gn3/api/search.py')
-rw-r--r-- | gn3/api/search.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gn3/api/search.py b/gn3/api/search.py index aa844ee..ada845d 100644 --- a/gn3/api/search.py +++ b/gn3/api/search.py @@ -147,12 +147,14 @@ def parse_position(spec: str) -> tuple[Maybe[int], Maybe[int]]: point = apply_si_suffix(spec) return Just(max(0, point - width)), Just(point + width) +def to_megabases(val): + """Convert `val` to megabases.""" + return str(Decimal(val)/10**6) 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) return (xapian.NumberRangeProcessor(location_slot) (start.maybe("", to_megabases), end.maybe("", to_megabases))) # type: ignore @@ -176,7 +178,6 @@ 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) return combine_queries(xapian.Query.OP_AND, species_query, xapian.Query(chromosome_prefix + interval.chromosome), |