diff options
| author | Frederick Muriuki Muriithi | 2025-02-28 13:14:58 -0600 |
|---|---|---|
| committer | Frederick Muriuki Muriithi | 2025-02-28 13:14:58 -0600 |
| commit | 82f1d0da007019d949a39408c45425e00b22aa34 (patch) | |
| tree | aa6ed8bba4336317621043a3e1e7edc30433c6bf /gn3/api | |
| parent | f3a6c0adc3e5cb78c1a663fc686f00853729b5d7 (diff) | |
| download | genenetwork3-82f1d0da007019d949a39408c45425e00b22aa34.tar.gz | |
Fix issues caught by mypy.
Diffstat (limited to 'gn3/api')
| -rw-r--r-- | gn3/api/search.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gn3/api/search.py b/gn3/api/search.py index f696428..6aed2ad 100644 --- a/gn3/api/search.py +++ b/gn3/api/search.py @@ -6,7 +6,7 @@ import gzip import json from functools import partial, reduce from pathlib import Path -from typing import Callable +from typing import Union, Callable import urllib.parse from flask import abort, Blueprint, current_app, jsonify, request @@ -65,7 +65,10 @@ def field_processor_or(*field_processors: FieldProcessorFunction) -> FieldProces for field_processor in field_processors])) -def liftover(chain_file: Path, position: ChromosomalPosition) -> Maybe[ChromosomalPosition]: +def liftover( + chain_file: Union[str, Path], + position: ChromosomalPosition +) -> Maybe[ChromosomalPosition]: """Liftover chromosomal position using chain file.""" # The chain file format is described at # https://genome.ucsc.edu/goldenPath/help/chain.html @@ -91,7 +94,10 @@ def liftover(chain_file: Path, position: ChromosomalPosition) -> Maybe[Chromosom return Nothing -def liftover_interval(chain_file: str, interval: ChromosomalInterval) -> ChromosomalInterval: +def liftover_interval( + chain_file: Union[str, Path], + interval: ChromosomalInterval +) -> ChromosomalInterval: """ Liftover interval using chain file. @@ -258,7 +264,7 @@ def parse_query(synteny_files_directory: Path, query: str): xapian.Query(species_prefix + lifted_species), chromosome_prefix, range_prefixes.index("position"), - partial(liftover_interval, + partial(liftover_interval,# type: ignore[arg-type] synteny_files_directory / chain_file))) queryparser.add_boolean_prefix( shorthand, |
