From 5a9002a881116951ebc18f79b327365e18bc3bab Mon Sep 17 00:00:00 2001 From: Robert Queenin <2177841+ecalifornica@users.noreply.github.com> Date: Fri, 25 Aug 2023 20:57:10 -0700 Subject: [PATCH 1/3] Fix undefined names Fixes linter error F821. --- src/hgvs/dataproviders/uta.py | 5 +++++ src/hgvs/normalizer.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/hgvs/dataproviders/uta.py b/src/hgvs/dataproviders/uta.py index 9bcbe81b..93f1ae37 100644 --- a/src/hgvs/dataproviders/uta.py +++ b/src/hgvs/dataproviders/uta.py @@ -626,6 +626,11 @@ def _set_search_path(self, cur): cur.execute("set search_path = {self.url.schema},public;".format(self=self)) +class UTA_sqlite(UTABase): + def __init__(self, url, mode, cache): + raise NotImplementedError + + class ParseResult(urlparse.ParseResult): """Subclass of url.ParseResult that adds database and schema methods, and provides stringification. diff --git a/src/hgvs/normalizer.py b/src/hgvs/normalizer.py index 3f95cc5b..133ba9f1 100644 --- a/src/hgvs/normalizer.py +++ b/src/hgvs/normalizer.py @@ -13,9 +13,11 @@ import hgvs import hgvs.validator import hgvs.variantmapper +from hgvs.dataproviders.ncbi import connect from hgvs.exceptions import (HGVSDataNotAvailableError, HGVSInvalidVariantError, HGVSUnsupportedOperationError) +from hgvs.parser import Parser from hgvs.utils.norm import normalize_alleles _logger = logging.getLogger(__name__) From d0943b86e18dc5e0e17d38bf7a8b825e0c5a7586 Mon Sep 17 00:00:00 2001 From: Robert Queenin <2177841+ecalifornica@users.noreply.github.com> Date: Sun, 10 Sep 2023 16:59:48 -0700 Subject: [PATCH 2/3] Remove SQLite scheme from data provider --- src/hgvs/dataproviders/uta.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/hgvs/dataproviders/uta.py b/src/hgvs/dataproviders/uta.py index 93f1ae37..599398a5 100644 --- a/src/hgvs/dataproviders/uta.py +++ b/src/hgvs/dataproviders/uta.py @@ -103,9 +103,7 @@ def connect(db_url=None, pooling=hgvs.global_config.uta.pooling, application_nam _logger.warning(f"You are executing tests using remote data ({db_url})") url = _parse_url(db_url) - if url.scheme == "sqlite": - conn = UTA_sqlite(url, mode, cache) - elif url.scheme == "postgresql": + if url.scheme == "postgresql": conn = UTA_postgresql(url=url, pooling=pooling, application_name=application_name, mode=mode, cache=cache) else: # fell through connection scheme cases @@ -626,11 +624,6 @@ def _set_search_path(self, cur): cur.execute("set search_path = {self.url.schema},public;".format(self=self)) -class UTA_sqlite(UTABase): - def __init__(self, url, mode, cache): - raise NotImplementedError - - class ParseResult(urlparse.ParseResult): """Subclass of url.ParseResult that adds database and schema methods, and provides stringification. From b8fbc96be2b4702f75a702c7a5d6008f99c1e0c8 Mon Sep 17 00:00:00 2001 From: Robert Queenin <2177841+ecalifornica@users.noreply.github.com> Date: Sun, 10 Sep 2023 19:53:36 -0700 Subject: [PATCH 3/3] Fix undefined name errors in tests Fixes linter error F821. --- tests/test_hgvs_alignmentmapper.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_hgvs_alignmentmapper.py b/tests/test_hgvs_alignmentmapper.py index 89acd90b..cbf44685 100644 --- a/tests/test_hgvs_alignmentmapper.py +++ b/tests/test_hgvs_alignmentmapper.py @@ -53,14 +53,14 @@ def x_test_alignmentmapper_AlignmentMapper_LCE3C_uncertain(self): alt_ac = "NC_000001.10" test_cases = [ { - "g": parser.parse_g_interval("(?_152573139)"), - "n": parser.parse_n_interval("(?_2)"), - "c": parser.parse_c_interval("(?_-69)"), + "g": self.parser.parse_g_interval("(?_152573139)"), + "n": self.parser.parse_n_interval("(?_2)"), + "c": self.parser.parse_c_interval("(?_-69)"), }, { - "g": parser.parse_g_interval("(152573138_?)"), - "n": parser.parse_n_interval("(1_?)"), - "c": parser.parse_c_interval("(-70_?)"), + "g": self.parser.parse_g_interval("(152573138_?)"), + "n": self.parser.parse_n_interval("(1_?)"), + "c": self.parser.parse_c_interval("(-70_?)"), }, ] self.run_cases(tx_ac, alt_ac, test_cases)