diff options
author | Arun Isaac | 2023-01-19 17:49:21 +0000 |
---|---|---|
committer | Arun Isaac | 2023-01-19 17:49:21 +0000 |
commit | 13a7c5cf58a1b456a50d69ea761f7106d2fe4978 (patch) | |
tree | be3a41c2006d1b50e16f6daf45c35420f32d6b84 /gn3/api/search.py | |
parent | 606130cd1c2d3267233a7f09d4ac1d68a5e5f82b (diff) | |
download | genenetwork3-13a7c5cf58a1b456a50d69ea761f7106d2fe4978.tar.gz |
search: Only look for SI suffix in the last character.
Suffixes are the last character, not everything but the last character.
* gn3/api/search.py (apply_si_suffix): Only look for SI suffix in the last
character.
Diffstat (limited to 'gn3/api/search.py')
-rw-r--r-- | gn3/api/search.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gn3/api/search.py b/gn3/api/search.py index 03f257d..2c11d4c 100644 --- a/gn3/api/search.py +++ b/gn3/api/search.py @@ -150,7 +150,7 @@ def parse_range(range_string: str) -> tuple[Maybe[str], Maybe[str]]: def apply_si_suffix(location: str) -> int: """Apply SI suffixes kilo, mega, giga and convert to bases.""" suffixes = {"k": 3, "m": 6, "g": 9} - if location[:-1] in suffixes: + if location[-1] in suffixes: return int(float(location[:-1])*10**suffixes[location[-1].lower()]) else: return int(location) |